| ["tpe", node, uname] => OS.Process.exit (Main.requestTrustedPath {node = node, uname = uname})
| ["sockperm", node, uname] => OS.Process.exit (Main.requestSocketPerm {node = node, uname = uname})
| ["firewall", node, uname] => OS.Process.exit (Main.requestFirewall {node = node, uname = uname})
- | ["describe", dom] => print (Domain.describe dom)
+ | ["describe", dom] => Main.requestDescribe dom
| ["users"] =>
(Acl.read Config.aclFile;
app (fn s => (print s; print "\n")) (Acl.users ()))
val requestRegen : unit -> unit
val requestRegenTc : unit -> unit
val requestRmuser : string -> unit
+ val requestDescribe : string -> unit
val requestSlavePing : unit -> OS.Process.status
val requestSlaveShutdown : unit -> unit
before OpenSSL.close bio
end
+fun requestDescribe dom =
+ let
+ val (_, bio) = requestBio (fn () => ())
+ in
+ Msg.send (bio, MsgDescribe dom);
+ case Msg.recv bio of
+ NONE => print "Server closed connection unexpectedly.\n"
+ | SOME m =>
+ case m of
+ MsgDescription s => print s
+ | MsgError s => print ("Description failed: " ^ s ^ "\n")
+ | _ => print "Unexpected server reply.\n";
+ OpenSSL.close bio
+ end
+
fun regenerateEither tc checker context =
let
fun ifReal f =
in
if !ErrorMsg.anyErrors then
(ErrorMsg.reset ();
- print ("User " ^ user ^ "'s configuration has errors!\n"))
+ print ("User " ^ user ^ "'s configuration has errors!\n");
+ ok := false)
else
app checker files
end
SOME "Script execution failed."))
(fn () => ())
+ | MsgDescribe dom =>
+ doIt (fn () => if not (Domain.validDomain dom) then
+ ("Requested description of invalid domain " ^ dom,
+ SOME "Invalid domain name")
+ else if not (Domain.yourDomain dom
+ orelse Acl.query {user = user, class = "priv", value = "all"}) then
+ ("Requested description of " ^ dom ^ ", but not allowed access",
+ SOME "Access denied")
+ else
+ (Msg.send (bio, MsgDescription (Domain.describe dom));
+ ("Sent description of domain " ^ dom,
+ NONE)))
+ (fn () => ())
+
| _ =>
doIt (fn () => ("Unexpected command",
SOME "Unexpected command"))
OpenSSL.writeString (bio, dbtype);
OpenSSL.writeString (bio, dbname))
| MsgMysqlFixperms => OpenSSL.writeInt (bio, 38)
+ | MsgDescribe dom => (OpenSSL.writeInt (bio, 39);
+ OpenSSL.writeString (bio, dom))
+ | MsgDescription s => (OpenSSL.writeInt (bio, 40);
+ OpenSSL.writeString (bio, s))
fun checkIt v =
case v of
SOME (MsgGrantDb {dbtype = dbtype, dbname = dbname})
| _ => NONE)
| 38 => SOME MsgMysqlFixperms
+ | 39 => Option.map MsgDescribe (OpenSSL.readString bio)
+ | 40 => Option.map MsgDescription (OpenSSL.readString bio)
| _ => NONE)
end
(* Grant all allowed privileges on a DBMS database to the user *)
| MsgMysqlFixperms
(* Run the script to grant DROP privileges on MySQL tables to owning users *)
+ | MsgDescribe of string
+ (* Ask for a listing of all of a domain's real configuration *)
+ | MsgDescription of string
+ (* Reply to MsgDescribe *)
end