X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/8dccfcbc0b748a17f50fcfb2bc1ed77e22eabd94..7e198078aa9f5f361a3c625c91452ec4ff26bca3:/src/domain.sml diff --git a/src/domain.sml b/src/domain.sml index 3e212a2..aebf0f1 100644 --- a/src/domain.sml +++ b/src/domain.sml @@ -134,15 +134,18 @@ fun validDomain s = fun validNode s = List.exists (fn s' => s = s') nodes fun yourDomain s = !fakePrivs orelse SS.member (your_domains (), s) -fun yourUser s = SS.member (your_users (), s) -fun yourGroup s = SS.member (your_groups (), s) +fun yourUser s = !fakePrivs orelse SS.member (your_users (), s) +fun yourGroup s = !fakePrivs orelse SS.member (your_groups (), s) + fun checkPath paths path = + !fakePrivs orelse (List.all (fn s => s <> "..") (String.fields (fn ch => ch = #"/") path) andalso CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"." orelse ch = #"/" orelse ch = #"-" orelse ch = #"_") path andalso SS.exists (fn s' => path = s' orelse String.isPrefix (s' ^ "/") path) (paths ())) val yourPath = checkPath your_paths val readablePath = checkPath readable_paths + fun yourIp s = !fakePrivs orelse SS.member (your_ips (), s) fun yourDomainHost s = @@ -276,6 +279,10 @@ val _ = Env.registerFunction ("defaultMailbox", fn [] => SOME (EString (getUser ()), dl) | _ => NONE) +val _ = Env.registerFunction ("defaultMailUser", + fn [] => SOME (EString (getUser ()), dl) + | _ => NONE) + type soa = {ns : string, serial : int option, @@ -654,7 +661,6 @@ val _ = Env.containerV_one "domain" val slaveIps = map nodeIp (#slaves dns) in - app (saveSoa ("slave", #soa dns)) (#slaves dns); app (saveNamed ("slave", #soa dns, masterIp, slaveIps)) (#slaves dns); case #master dns of InternalMaster node => @@ -686,7 +692,7 @@ fun handleSite (site, files) = in print ("New configuration for node " ^ site ^ "\n"); - if site = Config.defaultNode then + if site = Config.dispatcherName then Slave.handleChanges files else let val bio = OpenSSL.connect true (valOf (!ssl_context), @@ -866,6 +872,7 @@ fun homedirOf uname = Posix.SysDB.Passwd.home (Posix.SysDB.getpwnam uname) fun homedir () = homedirOf (getUser ()) + handle e => if !fakePrivs then "/tmp" else raise e type subject = {node : string, domain : string}