]> andersk Git - moira.git/blobdiff - server/mr_glue.c
have access_list make sure people can't change their group IDs
[moira.git] / server / mr_glue.c
index 95dca80d853ce919d6c30cbc7ea642e01b85a8fb..67b1d2fe6653475f8332ab67114dd7c305725013 100644 (file)
@@ -9,9 +9,12 @@
  *     a program expecting a library level interface.
  * 
  *     $Log$
- *     Revision 1.4  1987-09-21 15:17:09  wesommer
- *     Also need to initialize pseudo_client.clname.
+ *     Revision 1.5  1988-06-30 14:39:30  mar
+ *     argument to sms_auth; trim args before returning them, fix trigger_dcm
  *
+ * Revision 1.4  87/09/21  15:17:09  wesommer
+ * Also need to initialize pseudo_client.clname.
+ * 
  * Revision 1.3  87/08/22  17:31:56  wesommer
  * Fix a "fall-through".
  * 
@@ -30,13 +33,15 @@ static char *rcsid_sms_glue_c = "$Header$";
 #include "sms_server.h"
 #include <krb.h>               /* XXX for error codes */
 #include <pwd.h>
+#include "query.h"
+
 static int already_connected = 0;
 
 #define CHECK_CONNECTED { if (!already_connected) return SMS_NOT_CONNECTED; }
 
 static client pseudo_client;
-extern int krb_err_base;
-extern char *malloc();
+extern int krb_err_base, errno;
+extern char *malloc(), *whoami;
 
 sms_connect()
 {
@@ -69,11 +74,12 @@ sms_noop()
 /*
  * This routine is rather bogus, as it only fills in who you claim to be.
  */
-sms_auth()
+sms_auth(prog)
+char *prog;
 {
     struct passwd *pw;
     extern char *krb_realm;
-    char buf[1024];
+    char buf[1024], *strsave();
     
     CHECK_CONNECTED;
     pw = getpwuid(getuid());
@@ -90,9 +96,28 @@ sms_auth()
     strcat(buf, pseudo_client.kname.realm);
     pseudo_client.clname = malloc(strlen(buf)+1);
     strcpy(pseudo_client.clname, buf);
+    pseudo_client.users_id = get_users_id(pseudo_client.kname.name);
+    pseudo_client.entity = strsave(prog);
     return 0;
 }
 
+struct hint {
+    int (*proc)();
+    char *hint;
+};
+
+callback(argc, argv, arg)
+int argc;
+char **argv;
+struct hint *arg;
+{
+    if (sms_trim_args(argc, argv) == SMS_NO_MEM) {
+       com_err(whoami, SMS_NO_MEM, "while trimmming args");
+    }
+    (*arg->proc)(argc, argv, arg->hint);
+}
+
+
 int sms_query(name, argc, argv, callproc, callarg)
     char *name;                /* Query name */
     int argc;          /* Arg count */
@@ -100,8 +125,12 @@ int sms_query(name, argc, argv, callproc, callarg)
     int (*callproc)(); /* Callback procedure */
     char *callarg;             /* Callback argument */
 {
+    struct hint hints;
+
+    hints.proc = callproc;
+    hints.hint = callarg;
     return sms_process_query(&pseudo_client, name, argc, argv,
-                            callproc, callarg);
+                            callback, &hints);
 }
 
 int sms_access(name, argc, argv)
@@ -118,8 +147,12 @@ int sms_query_internal(argc, argv, callproc, callarg)
     int (*callproc)();
     char *callarg;
 {
+    struct hint hints;
+
+    hints.proc = callproc;
+    hints.hint = callarg;
     return sms_process_query(&pseudo_client, argv[0], argc-1, argv+1,
-                            callproc, callarg);
+                            callback, &hints);
 }
 
 int sms_access_internal(argc, argv)
@@ -135,6 +168,40 @@ sms_shutdown(why)
     fprintf(stderr, "Sorry, not implemented\n");
 }
 
+
+/* trigger_dcm is also used as a followup routine to the 
+ * set_server_host_override query, hence the two dummy arguments.
+ */
+
+struct query pseudo_query = {
+       "trigger_dcm",
+       "tdcm",
+};
+
+trigger_dcm(dummy0, dummy1, cl)
+       int dummy0, dummy1;
+       client *cl;
+{
+       register int pid, status;
+       
+       if (status = check_query_access(&pseudo_query, 0, cl))
+           return(status);
+
+       pid = vfork();
+       switch (pid) {
+       case 0:
+               execl("/u1/sms/bin/startdcm", "startdcm", 0);
+               exit(1);
+               
+       case -1:
+               return(errno);
+
+       default:
+               return(SMS_SUCCESS);
+       }
+}
+
+
 /*
  * Local Variables:
  * mode: c
This page took 0.061522 seconds and 4 git commands to generate.