Back to server-slide describe
[hcoop/domtool2.git] / src / main.sml
index ec795e3..8cc5a3a 100644 (file)
@@ -883,7 +883,7 @@ fun requestDescribe dom =
          | SOME m =>
            case m of
                MsgDescription s => print s
-             | MsgError s => print ("Describe failed: " ^ s ^ "\n")
+             | MsgError s => print ("Description failed: " ^ s ^ "\n")
              | _ => print "Unexpected server reply.\n";
        OpenSSL.close bio
     end
@@ -957,7 +957,8 @@ fun regenerateEither tc checker context =
                    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
@@ -1433,13 +1434,17 @@ fun service () =
                                      (fn () => ())
 
                               | MsgDescribe dom =>
-                                doIt (fn () => (if Domain.validDomain dom then
-                                                    (Msg.send (bio, MsgDescription (Domain.describe dom));
-                                                     ("Requested description of domain " ^ dom,
-                                                      NONE))
-                                                else
-                                                    ("Requested description of invalid domain " ^ dom,
-                                                     SOME "Invalid domain name")))
+                                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 () => ())
 
                               | _ =>