X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/e69e60ccf1aa77a40cd5b15c4361f378ce332a42..f8ef6c208aee42dd24c8836797a89f786c985a6f:/src/domain.sml diff --git a/src/domain.sml b/src/domain.sml index 04ee532..7ee4690 100644 --- a/src/domain.sml +++ b/src/domain.sml @@ -102,6 +102,14 @@ val yourDomain = yourDomainHost fun validUser s = size s > 0 andalso size s < 20 andalso CharVector.all Char.isAlphaNum s +fun validEmailUser s = + size s > 0 andalso size s < 50 + andalso CharVector.all (fn ch => Char.isAlphaNum ch + orelse ch = #"." + orelse ch = #"_" + orelse ch = #"-" + orelse ch = #"+") s + val validGroup = validUser val _ = Env.type_one "no_spaces" @@ -504,26 +512,28 @@ val _ = Env.containerV_one "domain" end fun saveNamed (kind, soa : soa, masterIp) node = - let - val outf = domainFile {node = node, name = "named.conf"} - in - TextIO.output (outf, "\nzone \""); - TextIO.output (outf, dom); - TextIO.output (outf, "\" IN {\n\ttype "); - TextIO.output (outf, kind); - TextIO.output (outf, ";\n\tfile \""); - TextIO.output (outf, Config.Bind.zonePath_real); - TextIO.output (outf, "/"); - TextIO.output (outf, dom); - TextIO.output (outf, ".zone\";\n"); - case kind of - "master" => TextIO.output (outf, "\tallow-update { none; };\n") - | _ => (TextIO.output (outf, "\tmasters { "); - TextIO.output (outf, masterIp); - TextIO.output (outf, "; };\n")); - TextIO.output (outf, "};\n"); - TextIO.closeOut outf - end + if dom = "localhost" then + () + else let + val outf = domainFile {node = node, name = "named.conf"} + in + TextIO.output (outf, "\nzone \""); + TextIO.output (outf, dom); + TextIO.output (outf, "\" IN {\n\ttype "); + TextIO.output (outf, kind); + TextIO.output (outf, ";\n\tfile \""); + TextIO.output (outf, Config.Bind.zonePath_real); + TextIO.output (outf, "/"); + TextIO.output (outf, dom); + TextIO.output (outf, ".zone\";\n"); + case kind of + "master" => TextIO.output (outf, "\tallow-update { none; };\n") + | _ => (TextIO.output (outf, "\tmasters { "); + TextIO.output (outf, masterIp); + TextIO.output (outf, "; };\n")); + TextIO.output (outf, "};\n"); + TextIO.closeOut outf + end in case kind of NoDns => masterNode := NONE @@ -693,7 +703,7 @@ fun rmdom doms = before Posix.FileSys.closedir dir end handle OS.SysErr _ => - (print ("Warning: System error deleteing domain " ^ dom ^ " on " ^ node ^ ".\n"); + (print ("Warning: System error deleting domain " ^ dom ^ " on " ^ node ^ ".\n"); actions) in visitDom (dom, dname, actions) @@ -724,4 +734,9 @@ fun rmdom doms = app cleanupNode Config.nodeIps end +fun homedirOf uname = + Posix.SysDB.Passwd.home (Posix.SysDB.getpwnam uname) + +fun homedir () = homedirOf (getUser ()) + end