zoneChanged := false;
didDomain := ""))
-val dns : TextIO.outstream option ref = ref NONE
+val dns : Domain.files option ref = ref NONE
val _ = Domain.registerBefore
- (fn _ => dns := Option.map (fn node => Domain.domainFile {node = node,
- name = "dns"})
+ (fn _ => dns := Option.map (fn node => Domain.domainsFile {node = node,
+ name = "dns"})
(Domain.dnsMaster ()))
val _ = Domain.registerAfter
- (fn _ => (Option.app TextIO.closeOut (!dns);
+ (fn _ => (Option.app (fn files => #close files ()) (!dns);
dns := NONE))
val dl = ErrorMsg.dummyLoc
fun writeRecord (evs, r) =
case !dns of
NONE => print "Warning: DNS directive ignored because no master DNS server is configured for this domain\n"
- | SOME file =>
+ | SOME files =>
let
- fun write s = TextIO.output (file, s)
+ fun write s = #write files s
+ fun writeDom () = #writeDom files ()
val ttl = Env.env Env.int (evs, "TTL")
in
case r of
A (from, to) => (write from;
write ".";
- write (Domain.currentDomain ());
+ writeDom ();
write ".\t";
write (Int.toString ttl);
write "\tIN\tA\t";
write "\n")
| CNAME (from, to) => (write from;
write ".";
- write (Domain.currentDomain ());
+ writeDom ();
write ".\t";
write (Int.toString ttl);
write "\tIN\tCNAME\t";
fun padBy ch amt s =
if size s < amt then
- CharVector.tabulate (amt, fn _ => ch) ^ s
+ CharVector.tabulate (amt - size s, fn _ => ch) ^ s
else
s
val min = readILine inf
val () = TextIO.closeIn inf
+ val serialPath = OS.Path.joinDirFile {dir = Config.serialDir,
+ file = #domain fs}
+
val oldSerial = let
- val inf = TextIO.openIn (OS.Path.joinDirFile {dir = #dir fs,
- file = "serial"})
+ val inf = TextIO.openIn serialPath
in
SOME (readLine inf)
before TextIO.closeIn inf
- end handle IO.Io _ => NONE
+ end handle IO.Io {name, ...} => NONE
val newSerial =
case serial of
"00")
end
- val outf = TextIO.openOut (OS.Path.joinDirFile {dir = #dir fs,
- file = "serial"})
+ val outf = TextIO.openOut serialPath
val _ = TextIO.output (outf, newSerial)
val _ = TextIO.closeOut outf
fn cl => "Error reloading bind with " ^ cl)
else
()))
+
+val () = Domain.registerResetLocal (fn () =>
+ ignore (OS.Process.system (Config.rm ^ " -rf /var/domtool/zones/*")))
+
end