Fix key creation in a chroot
authorJamie Cameron <jcameron@webmin.com>
Thu, 2 Jul 2009 19:59:20 +0000 (19:59 +0000)
committerJamie Cameron <jcameron@webmin.com>
Thu, 2 Jul 2009 19:59:20 +0000 (19:59 +0000)
bind8/bind8-lib.pl
bind8/records-lib.pl

index 03d9954..274e502 100644 (file)
@@ -2953,7 +2953,7 @@ foreach my $f (readdir(ZONEDIR)) {
                $rv->{'algorithmid'} = $1;
                $rv->{'keyid'} = $2;
                local $config{'short_names'} = 0;       # Force canonicalization
-               local ($pub) = &read_zone_file("$dir/$f", $dom);
+               local ($pub) = &read_zone_file("$dir/$f", $dom, undef, 0, 1);
                $pub || return "Public key file $dir/$f does not contain ".
                               "any records";
                $pub->{'name'} eq $dom."." ||
index d307c51..fa1b82d 100644 (file)
@@ -1,6 +1,6 @@
 # Functions for managing BIND 4 and 8/9 records files
 
-# read_zone_file(file, origin, [previous], [only-soa])
+# read_zone_file(file, origin, [previous], [only-soa], [no-chroot])
 # Reads a DNS zone file and returns a data structure of records. The origin
 # must be a domain without the trailing dot, or just .
 sub read_zone_file
@@ -14,7 +14,7 @@ if ($origin ne ".") {
        $origin =~ s/\.*$//;
        }
 $file = &absolute_path($_[0]);
-local $rootfile = &make_chroot($file);
+local $rootfile = $_[4] ? $file : &make_chroot($file);
 open(FILE, $rootfile);
 $lnum = 0;
 local ($gotsoa, $aftersoa);