zoneconf.in: Support the `also-notify' variable.
[zoneconf] / zoneconf.in
index 4a6713f..43892db 100755 (executable)
@@ -992,6 +992,7 @@ define-configuration-space zone ZONECFG {
   define-simple dir-mode 2775
   define-simple zone-file "%v/%z.zone"
   define-simple soa-format increment
+  define-simple allow-query nil
   define-list views *
   define-list sign-views {}
   define-list signzone-command \
@@ -1016,6 +1017,7 @@ define-configuration-space zone ZONECFG {
           "-Sfail" \
           "-Wfail" \
           "%z" "%f"]
+  define-list also-notify nil
 
   define setvar {name value} {
     dict set ZONECFG(var) $name $value
@@ -1152,8 +1154,12 @@ proc compute-zone-properties {view config} {
        foreach host $hosts {
          set bang [string first "!" $host]
          if {$bang >= 0} {
-           set before [string range $host 0 [expr {$bang - 1}]]
            set after [string range $host [expr {$bang + 1}] end]
+           if {$bang} {
+             set before [string range $host 0 [expr {$bang - 1}]]
+           } else {
+             set before $after
+           }
            if {[local-address-p $before]} {
              set host $after
            } else {
@@ -1276,6 +1282,9 @@ proc write-zone-stanza {view chan config} {
     master {
       puts $chan "\ttype master;"
       puts $chan "\tfile \"$zone(server-file-name)\";"
+      if {![string equal $zone(also-notify) "nil"]} {
+       puts $chan "\talso-notify { [join $zone(also-notify) {; }]; };"
+      }
       switch -exact -- $zone(type) {
        dynamic {
          write-ddns-update-policy "\t" $chan $config
@@ -1296,6 +1305,9 @@ proc write-zone-stanza {view chan config} {
       }
     }
   }
+  if {![string equal $zone(allow-query) nil]} {
+    puts $chan "\tallow-query {$zone(allow-query)};"
+  }
   puts $chan "};";
 }