fun basis () =
let
+ val _ = ErrorMsg.reset ()
val dir = Posix.FileSys.opendir Config.libRoot
fun loop files =
fun notTmp s =
String.sub (s, 0) <> #"."
+ andalso s <> "_darcs"
andalso CharVector.all (fn ch => Char.isAlphaNum ch orelse ch = #"." orelse ch = #"_" orelse ch = #"-") s
fun setupUser () =
let
val (_, context) = requestContext (fn () => ())
val bio = OpenSSL.connect true (context,
- Config.Dbms.dbmsNode ^ ":" ^ Int.toString Config.slavePort)
+ Domain.nodeIp Config.Dbms.dbmsNode ^ ":" ^ Int.toString Config.slavePort)
in
Msg.send (bio, MsgCreateDbUser dbtype);
case Msg.recv bio of
OpenSSL.close bio
end
+fun requestPortalPasswdMailbox p =
+ let
+ val (_, bio) = requestBio (fn () => ())
+ in
+ (Msg.send (bio, MsgPortalPasswdMailbox p);
+ case Msg.recv bio of
+ NONE => (print "Server closed connection unexpectedly.\n"; OS.Process.failure)
+ | SOME m =>
+ case m of
+ MsgOk => (print ("The password for " ^ #user p ^ "@" ^ #domain p ^ " has been changed.\n");
+ OS.Process.success)
+ | MsgError s => (print ("Set failed: " ^ s ^ "\n"); OS.Process.failure)
+ | _ => (print "Unexpected server reply.\n"; OS.Process.failure))
+ before OpenSSL.close bio
+ end
+
fun requestRmMailbox p =
let
val (_, bio) = requestBio (fn () => ())
ignore (foldl checker' (basis', SM.empty) files)
end
end
- else if String.isSuffix "_admin" user then
+ else if (String.isSuffix "_admin" user) orelse (String.isSuffix ".daemon" user) then
()
else
(print ("Couldn't access " ^ user ^ "'s ~/.domtool directory.\n");
SOME msg))
(fn () => ())
+ | MsgPortalPasswdMailbox {domain, user = emailUser, oldpasswd, newpasswd} =>
+ doIt (fn () =>
+ if not (Acl.query {user = user, class = "priv", value = "vmail"}) then
+ ("User is not authorized to run portal vmail password",
+ SOME "You're not authorized to use the portal password command")
+ else if not (Domain.validEmailUser emailUser) then
+ ("Invalid e-mail username " ^ emailUser,
+ SOME "Invalid e-mail username")
+ else if not (CharVector.all Char.isGraph oldpasswd
+ andalso CharVector.all Char.isGraph newpasswd) then
+ ("Invalid password",
+ SOME "Invalid password; may only contain printable, non-space characters")
+ else
+ case Vmail.portalpasswd {domain = domain, user = emailUser,
+ oldpasswd = oldpasswd, newpasswd = newpasswd} of
+ NONE => ("Changed password of mailbox " ^ emailUser ^ "@" ^ domain,
+ NONE)
+ | SOME msg => ("Error changing mailbox password for " ^ emailUser ^ "@" ^ domain ^ ": " ^ msg,
+ SOME msg))
+ (fn () => ())
+
| MsgRmMailbox {domain, user = emailUser} =>
doIt (fn () =>
if not (Domain.yourDomain domain) then