]> andersk Git - moira.git/blobdiff - server/mr_scall.c
Command line printer manipulation client, and build goo.
[moira.git] / server / mr_scall.c
index cee1d109544ba1edb09227af7e3520345e0e4ce1..4604334149e1a03e0caaf7506cbe55e1b7f90bbc 100644 (file)
@@ -32,6 +32,8 @@ extern char *whoami;
 
 extern int dbms_errno, mr_errcode;
 
+int max_version;
+
 void do_call(client *cl);
 void free_rtn_tuples(client *cp);
 int retr_callback(int argc, char **argv, void *p_cl);
@@ -39,6 +41,7 @@ int list_users(client *cl);
 void do_retr(client *cl);
 void do_access(client *cl);
 void get_motd(client *cl);
+void do_version(client *cl);
 
 char *procnames[] = {
   "noop",
@@ -49,6 +52,8 @@ char *procnames[] = {
   "dcm",
   "motd",
   "proxy",
+  "version",
+  "auth_krb5",
 };
 
 int newqueries;
@@ -73,8 +78,7 @@ void client_read(client *cl)
     {
       com_err(whoami, 0, "procno out of range");
       client_reply(cl, MR_UNKNOWN_PROC);
-      mr_destroy_reply(cl->req);
-      return;
+      goto out;
     }
   log_args(procnames[pn], 2, cl->req.mr_argc, cl->req.mr_argv);
 
@@ -82,8 +86,7 @@ void client_read(client *cl)
     {
       client_reply(cl, MR_DOWN);
       com_err(whoami, MR_DOWN, "(query refused)");
-      mr_destroy_reply(cl->req);
-      return;
+      goto out;
     }
 
   /* make sure this gets cleared before every operation */
@@ -122,7 +125,18 @@ void client_read(client *cl)
     case MR_PROXY:
       do_proxy(cl);
       break;
+
+    case MR_SETVERSION:
+      do_version(cl);
+      break;
+
+    case MR_KRB5_AUTH:
+      do_krb5_auth(cl);
+      break;
+
     }
+
+out:
   mr_destroy_reply(cl->req);
   memset(&cl->req, 0, sizeof(mr_params));
 }
@@ -247,6 +261,23 @@ void do_access(client *cl)
   com_err(whoami, 0, "Access check complete.");
 }
 
+void do_version(client *cl)
+{
+  if (cl->req.mr_argc != 1)
+    {
+      client_reply(cl, MR_ARGS);
+      com_err(whoami, MR_ARGS, "incorrect number of arguments");
+      return;
+    }
+
+  cl->version = atoi(cl->req.mr_argv[0]);
+  if (cl->version == -1)
+    cl->version = max_version;
+
+  client_reply(cl, cl->version == max_version ? MR_SUCCESS :
+              cl->version < max_version ? MR_VERSION_LOW : MR_VERSION_HIGH);
+}
+
 void get_motd(client *cl)
 {
   int motd;
This page took 0.176441 seconds and 4 git commands to generate.