Fix a bug introduced by delegation (upon domain deletion).
This commit is contained in:
parent
e94bed139b
commit
9388663688
1 changed files with 8 additions and 2 deletions
|
|
@ -91,7 +91,7 @@ class DNSManager::Storage
|
||||||
# Instead of generating the file for each change (synchronously),
|
# Instead of generating the file for each change (synchronously),
|
||||||
# it will be regenerated periodically by a script outside the application.
|
# it will be regenerated periodically by a script outside the application.
|
||||||
def delegation_token_file
|
def delegation_token_file
|
||||||
"#{@delegationdir}/regen-token-file"
|
"#{@delegationdir}/.regen-token-file"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Updates the token file.
|
# Updates the token file.
|
||||||
|
|
@ -394,12 +394,16 @@ class DNSManager::Storage
|
||||||
def remove_delegation_file(domain : String) : Nil
|
def remove_delegation_file(domain : String) : Nil
|
||||||
Baguette::Log.info "(domain #{domain}) removing a delegation file."
|
Baguette::Log.info "(domain #{domain}) removing a delegation file."
|
||||||
File.delete "#{@delegationdir}/#{domain}"
|
File.delete "#{@delegationdir}/#{domain}"
|
||||||
|
rescue e : File::NotFoundError
|
||||||
|
Baguette::Log.info "(domain #{domain}) delegation file not found - ignoring."
|
||||||
end
|
end
|
||||||
|
|
||||||
# Removes a Bind9 zonefile.
|
# Removes a Bind9 zonefile.
|
||||||
def remove_bind9_zonefile(domain : String) : Nil
|
def remove_bind9_zonefile(domain : String) : Nil
|
||||||
Baguette::Log.info "(domain #{domain}) removing a Bind9 zone file."
|
Baguette::Log.info "(domain #{domain}) removing a Bind9 zone file."
|
||||||
File.delete "#{@zonefiledir}/#{domain}"
|
File.delete "#{@zonefiledir}/#{domain}"
|
||||||
|
rescue e : File::NotFoundError
|
||||||
|
Baguette::Log.info "(domain #{domain}) zone file not found - ignoring."
|
||||||
end
|
end
|
||||||
|
|
||||||
# Deletes a domain.
|
# Deletes a domain.
|
||||||
|
|
@ -545,12 +549,14 @@ class DNSManager::Storage
|
||||||
|
|
||||||
# WARNING: this function removes a zone with all its related data (zone file, delegation file, indexes, etc.).
|
# WARNING: this function removes a zone with all its related data (zone file, delegation file, indexes, etc.).
|
||||||
#
|
#
|
||||||
|
# WARNING: this function doesn't check for ownership authorizations (could cause a chicken-egg problem when
|
||||||
|
# deleting a domain).
|
||||||
|
#
|
||||||
# RATIONALE: wipe_zone can be used to renew to remove zone-related content (the entry in the zone db, tokens
|
# RATIONALE: wipe_zone can be used to renew to remove zone-related content (the entry in the zone db, tokens
|
||||||
# and generated zone file) while preserving the entry in the domain db.
|
# and generated zone file) while preserving the entry in the domain db.
|
||||||
# wipe_zone is called when the domain is deleted or when it is delegated.
|
# wipe_zone is called when the domain is deleted or when it is delegated.
|
||||||
def wipe_zone(user_id : UserDataID, domain_name : String)
|
def wipe_zone(user_id : UserDataID, domain_name : String)
|
||||||
zone = zone_must_exist! domain_name
|
zone = zone_must_exist! domain_name
|
||||||
user_should_own! user_id, domain_name
|
|
||||||
|
|
||||||
Baguette::Log.info "Wiping zone content for #{domain_name}"
|
Baguette::Log.info "Wiping zone content for #{domain_name}"
|
||||||
# Remove the related zone and their registered tokens.
|
# Remove the related zone and their registered tokens.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue