X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/411a85f26421358c20b11839310cce6caff8cf77..08a04eb413e8ee58ee35affc5c4125b622ea75c4:/src/main.sml?ds=sidebyside diff --git a/src/main.sml b/src/main.sml index 9204159..03d5877 100644 --- a/src/main.sml +++ b/src/main.sml @@ -205,6 +205,24 @@ fun requestRevoke acl = OpenSSL.close bio end +fun requestListPerms user = + let + val (_, bio) = requestBio (fn () => ()) + in + Msg.send (bio, MsgListPerms user); + (case Msg.recv bio of + NONE => (print "Server closed connection unexpectedly.\n"; + NONE) + | SOME m => + case m of + MsgPerms perms => SOME perms + | MsgError s => (print ("Listing failed: " ^ s ^ "\n"); + NONE) + | _ => (print "Unexpected server reply.\n"; + NONE)) + before OpenSSL.close bio + end + fun service () = let val () = Acl.read Config.aclFile @@ -310,6 +328,20 @@ fun service () = handle OpenSSL.OpenSSL _ => (); loop ()) + | MsgListPerms user => + ((Msg.send (bio, MsgPerms (Acl.queryAll user)); + print ("Sent permission list for user " ^ user ^ ".\n")) + handle OpenSSL.OpenSSL s => + (print "OpenSSL error\n"; + Msg.send (bio, + MsgError + ("Error during permission listing: " + ^ s))); + (ignore (OpenSSL.readChar bio); + OpenSSL.close bio) + handle OpenSSL.OpenSSL _ => (); + loop ()) + | _ => (Msg.send (bio, MsgError "Unexpected command") handle OpenSSL.OpenSSL _ => ();