X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-utils.git;a=blobdiff_plain;f=scripts%2Fnamed-conf;h=120f2b7a78f0fd1bbce7aea63bc3485c50384a88;hp=fdfa404792adbfe7cb42767a6f598ffa2d87acf0;hb=2d961637e0e206ca3afae36a68996750fcabfa67;hpb=f06dbb43881bdeedb7e91092231c9e426874945f diff --git a/scripts/named-conf b/scripts/named-conf index fdfa404..120f2b7 100755 --- a/scripts/named-conf +++ b/scripts/named-conf @@ -354,9 +354,23 @@ sub bad_modifiers ($) { return 0; } +sub zone_conf_settings ($$) { + my ($cfg,$zone) = @_; + my ($sfx,$aref); + foreach $sfx (qw(self_soa self_ns self_addr forbid_addr forbid_slave + conv_glueless indirect_glue)) { + { no strict 'refs'; $aref= [ @$sfx ]; } + @$aref or cfg_fail("failed to specify $sfx before zone") + if $sfx =~ m/^self/; + $cfg->{$sfx}= $aref; + } + foreach $sfx (qw(self_soa self_ns)) { + map { s/\*$/$zone/ } @{ $zone_cfg{$zone}{$sfx} }; + } +} + sub zone_conf ($$$$$@) { my ($zone,$style,$sabbr,$mod,$file,@servers) = @_; - my ($sfx,$aref); $file= qualify("$slave_dir/$slave_prefix".$zone.$slave_suffix) unless length $file; if (!length $output) { @@ -382,16 +396,7 @@ sub zone_conf ($$$$$@) { $zone_cfg{$zone}{'maildir'}= qualify($mail_state_dir); $zone_cfg{$zone}{'mailmwarn'}= $mail_max_warnfreq; } - foreach $sfx (qw(self_soa self_ns self_addr forbid_addr forbid_slave - conv_glueless indirect_glue)) { - { no strict 'refs'; $aref= [ @$sfx ]; } - @$aref or cfg_fail("failed to specify $sfx before zone") - if $sfx =~ m/^self/; - $zone_cfg{$zone}{$sfx}= $aref; - } - foreach $sfx (qw(self_soa self_ns)) { - map { s/\*$/$zone/ } @{ $zone_cfg{$zone}{$sfx} }; - } + zone_conf_settings($zone_cfg{$zone}, $zone); $zone_cfg{$zone}{'output'}= $output; push @zone_cfg_list, $zone; } @@ -420,11 +425,20 @@ sub process_zones (@) { local ($zone,$cfg); foreach $zone (@zones) { - $cfg= $zone_cfg{$zone} || { - 'style_p' => 'foreign', - 's' => "f $group2modcmd{'foreign'}", - 'servers' => [ ], + if ($zone =~ m/\.$/) { + zone_warning("zone specified with trailing dot -". + " will not work", ''); + } + + $cfg= $zone_cfg{$zone}; + if (!$cfg) { + $cfg= { + 'style_p' => 'foreign', + 's' => "f $group2modcmd{'foreign'}", + 'servers' => [ ], }; + zone_conf_settings($cfg, $zone); + } mail_zone_before() or next if $domail; @@ -1100,7 +1114,7 @@ sub dig (&$$$) { if (!$c) { open STDERR, ">&STDOUT" or die $!; exec ('dig', - '+nodef','+nosea','+nodebug','+norecurse', + '+nodef','+nosea','+norecurse', "\@$qaddr",'-t',$qtype,$qowner); die "$quis: exec dig:\n $!\n"; }