(* HCoop Domtool (http://hcoop.sourceforge.net/)
- * Copyright (c) 2006, Adam Chlipala
+ * Copyright (c) 2006-2007, Adam Chlipala
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
val _ = Env.type_one "no_spaces"
Env.string
- (CharVector.all (fn ch => not (Char.isSpace ch)))
+ (CharVector.all (fn ch => Char.isPrint ch andalso not (Char.isSpace ch)
+ andalso ch <> #"\"" andalso ch <> #"'"))
val _ = Env.type_one "no_newlines"
Env.string
- (CharVector.all (fn ch => ch <> #"\n" andalso ch <> #"\r"))
+ (CharVector.all (fn ch => Char.isPrint ch andalso ch <> #"\n" andalso ch <> #"\r"
+ andalso ch <> #"\"" andalso ch <> #"'"))
val _ = Env.type_one "ip"
Env.string
close ()
end
- fun saveNamed (kind, soa : soa, masterIp) node =
+ fun saveNamed (kind, soa : soa, masterIp, slaveIps) node =
if dom = "localhost" then
()
else let
in
write "\nzone \"";
writeDom ();
- write "\" IN {\n\ttype ";
+ write "\" {\n\ttype ";
write kind;
write ";\n\tfile \"";
write Config.Bind.zonePath_real;
writeDom ();
write ".zone\";\n";
case kind of
- "master" => write "\tallow-update { none; };\n"
+ "master" => (write "\tallow-transfer {\n";
+ app (fn ip => (write "\t\t";
+ write ip;
+ write ";\n")) slaveIps;
+ write "\t};\n")
| _ => (write "\tmasters { ";
write masterIp;
write "; };\n");
let
val masterIp =
case #master dns of
- InternalMaster node => valOf (SM.find (nodeMap, node))
+ InternalMaster node => nodeIp node
| ExternalMaster ip => ip
+
+ val slaveIps = map nodeIp (#slaves dns)
in
app (saveSoa ("slave", #soa dns)) (#slaves dns);
- app (saveNamed ("slave", #soa dns, masterIp)) (#slaves dns);
+ app (saveNamed ("slave", #soa dns, masterIp, slaveIps)) (#slaves dns);
case #master dns of
InternalMaster node =>
(masterNode := SOME node;
saveSoa ("master", #soa dns) node;
- saveNamed ("master", #soa dns, masterIp) node)
- | _ => masterNode := NONE;
- !befores dom
- end
+ saveNamed ("master", #soa dns, masterIp, slaveIps) node)
+ | _ => masterNode := NONE
+ end;
+ !befores dom
end,
fn () => !afters (!current))