X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/e0b80e65c8132f096ed5c92e42d4da7d33ff369b..3bf720f753c0a50e6c5f753a9a786d68fa15af93:/src/domain.sml diff --git a/src/domain.sml b/src/domain.sml index ea3d70a..b2c0c5c 100644 --- a/src/domain.sml +++ b/src/domain.sml @@ -1,5 +1,5 @@ (* 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 @@ -114,10 +114,12 @@ val validGroup = validUser 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 @@ -538,7 +540,7 @@ val _ = Env.containerV_one "domain" close () end - fun saveNamed (kind, soa : soa, masterIp) node = + fun saveNamed (kind, soa : soa, masterIp, slaveIps) node = if dom = "localhost" then () else let @@ -546,7 +548,7 @@ val _ = Env.containerV_one "domain" in write "\nzone \""; writeDom (); - write "\" IN {\n\ttype "; + write "\" {\n\ttype "; write kind; write ";\n\tfile \""; write Config.Bind.zonePath_real; @@ -554,7 +556,11 @@ val _ = Env.containerV_one "domain" 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"); @@ -568,19 +574,21 @@ val _ = Env.containerV_one "domain" 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))