Skip to content

Commit

Permalink
Fix check for zone file when doing sub-domain backups https://forum.v…
Browse files Browse the repository at this point in the history
  • Loading branch information
jcameron authored and iliajie committed Apr 23, 2023
1 parent 812ce84 commit 16a9e01
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
20 changes: 13 additions & 7 deletions feature-dns.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2369,17 +2369,23 @@ sub backup_dns
my $r = &require_bind($d);
&$first_print($text{'backup_dnscp'});
my ($recs, $zonefile) = &get_domain_dns_records_and_file($d);
my $z = &get_bind_zone($d->{'dom'}, undef, $d);
if (!$zonefile || !$z) {
# Zone doesn't exist!
&$second_print($text{'backup_dnsnozone'});
if (!$zonefile) {
# Zone file doesn't exist!
&$second_print($text{'backup_dnsnozone2'});
return 0;
}
my $f = &bind8::find("file", $z->{'members'});
my $absfile = &remote_foreign_call($r, "bind8", "make_chroot",
&remote_foreign_call($r, "bind8", "absolute_path", $f->{'values'}->[0]));
if (!$d->{'dns_submode'}) {
# Can just copy the whole zone file
my $z = &get_bind_zone($d->{'dom'}, undef, $d);
if (!$z) {
# Zone doesn't exist!
&$second_print($text{'backup_dnsnozone'});
return 0;
}
my $f = &bind8::find("file", $z->{'members'});
my $absfile = &remote_foreign_call($r, "bind8", "make_chroot",
&remote_foreign_call($r, "bind8", "absolute_path",
$f->{'values'}->[0]));
&copy_write_remote_as_domain_user($d, $r, $absfile, $file);

# Also save DNSSEC keys, if possible
Expand Down
1 change: 1 addition & 0 deletions lang/en
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,7 @@ backup_postgresdump=Dumping PostgresSQL database $1 ..
backup_postgresdumpfailed=.. dump failed! $1
backup_dnscp=Copying records in DNS domain ..
backup_dnsnozone=.. domain not found!
backup_dnsnozone2=.. zone file not found!
backup_dnsnozonefile=.. records file $1 does not exist!
backup_mailaliases=Saving mail aliases ..
backup_mailusers=Saving mail and FTP users ..
Expand Down

0 comments on commit 16a9e01

Please sign in to comment.