X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/41c58dafe735d17b7d3241bf248ca8806a355926..ae272cb5141c5347f205180b8ccf68eb56383ae2:/src/plugins/bind.sml diff --git a/src/plugins/bind.sml b/src/plugins/bind.sml index 46ecbc3..89b3938 100644 --- a/src/plugins/bind.sml +++ b/src/plugins/bind.sml @@ -50,6 +50,8 @@ datatype dns_record = | MX of int * string | NS of string | DefaultA of string + | AAAA of string * string + | DefaultAAAA of string val record = fn (EApp ((EApp ((EVar "dnsA", _), e1), _), e2), _) => (case (Env.string e1, Domain.ip e2) of @@ -66,12 +68,19 @@ val record = fn (EApp ((EApp ((EVar "dnsA", _), e1), _), e2), _) => | (EApp ((EVar "dnsNS", _), e), _) => Option.map NS (Env.string e) | (EApp ((EVar "dnsDefaultA", _), e), _) => - Option.map DefaultA (Env.string e) + Option.map DefaultA (Domain.ip e) + | (EApp ((EApp ((EVar "dnsAAAA", _), e1), _), e2), _) => + (case (Env.string e1, Env.string e2) of + (SOME v1, SOME v2) => SOME (AAAA (v1, v2)) + | _ => NONE) + | (EApp ((EVar "dnsDefaultAAAA", _), e), _) => + Option.map DefaultAAAA (Env.string e) | _ => NONE fun writeRecord (evs, r) = case !dns of - NONE => print "Warning: DNS directive ignored because no master DNS server is configured for this domain\n" + NONE => print ("Warning: DNS directive for " ^ Domain.currentDomain () + ^ " ignored because no master DNS server is configured for this domain\n") | SOME files => let fun write s = #write files s @@ -115,6 +124,20 @@ fun writeRecord (evs, r) = write "\tIN\tNS\t"; write host; write ".\n") + | AAAA (from, to) => (write from; + write "."; + writeDom (); + write ".\t"; + write (Int.toString ttl); + write "\tIN\tAAAA\t"; + write to; + write "\n") + | DefaultAAAA to => (writeDom (); + write ".\t"; + write (Int.toString ttl); + write "\tIN\tAAAA\t"; + write to; + write "\n") end val () = Env.actionV_one "dns" @@ -163,7 +186,7 @@ val () = Slave.registerFileHandler (fn fs => fun dnsChanged () = if #domain fs = !didDomain then () - else if #action fs = Slave.Delete then + else if Slave.isDelete (#action fs) then let val fname = OS.Path.joinBaseExt {base = #domain fs, ext = SOME "zone"} @@ -284,10 +307,10 @@ val () = Domain.registerResetLocal (fn () => val () = Domain.registerDescriber (Domain.considerAll [Domain.Filename {filename = "named.conf", - heading = "named.conf addition", + heading = "named.conf addition:", showEmpty = false}, Domain.Filename {filename = "dns", - heading = "DNS zonefile contents", + heading = "DNS zonefile contents:", showEmpty = false}]) end