X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/9f27d58f1ce0833bb5460d7ca612c74f378548a1..62260c5f8627aa2abfd27f7c2e653eb3d900d793:/src/main.sml diff --git a/src/main.sml b/src/main.sml index 8bb2d4e..cb39416 100644 --- a/src/main.sml +++ b/src/main.sml @@ -275,6 +275,15 @@ fun requestDir dname = end handle ErrorMsg.Error => () +fun requestPing () = + let + val (_, bio) = requestBio (fn () => ()) + in + OpenSSL.close bio; + OS.Process.success + end + handle _ => OS.Process.failure + fun requestShutdown () = let val (_, bio) = requestBio (fn () => ()) @@ -745,10 +754,12 @@ fun service () = | MsgMultiConfig codes => doConfig codes | MsgShutdown => - if Acl.query {user = user, class = "priv", value = "shutdown"} then - print ("Domtool dispatcher shutting down at " ^ Date.toString (Date.fromTimeUniv (Time.now ())) ^ "\n") + if Acl.query {user = user, class = "priv", value = "all"} + orelse Acl.query {user = user, class = "priv", value = "shutdown"} then + print ("Domtool dispatcher shutting down at " ^ Date.toString (Date.fromTimeUniv (Time.now ())) ^ "\n\n") else - (OpenSSL.close bio + (print "Unauthorized shutdown command!\n"; + OpenSSL.close bio handle OpenSSL.OpenSSL _ => (); loop ())