]> andersk Git - moira.git/blobdiff - server/qsupport.qc
added users_id & entity to client structure; query counters as globals
[moira.git] / server / qsupport.qc
index 6b5f9dd6d48883c5ca832c85b2f516a245bbda2f..f28dc8a0f1622eb151f7c6f2a1c2a08580754da9 100644 (file)
@@ -6,9 +6,18 @@
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
  *
  *     $Log$
- *     Revision 1.16  1988-01-04 11:56:09  wesommer
- *     Fixed access on access_pop; small changes for xxx_user_by_uid queries.
+ *     Revision 1.18  1988-01-14 12:00:38  mar
+ *     separate access check from setup routine.
+ *     make get_query_need be more paranoid
  *
+Revision 1.17  88/01/04  12:09:00  mar
+fixup pobox access checking & make id assignment more paranoid (wesommer)
+
+Revision 1.16  87/11/12  18:16:56  wesommer
+Add support for delete_user_by_uid.
+Fix access_pop.
+Check a few return codes.
+
 Revision 1.15  87/09/11  15:31:58  wesommer
 add_user_group modified to side-effect the time for tbs for groups as 
 well as the other things.
@@ -143,12 +152,15 @@ access_pop(q, argv, cl)
 ##  int exists;
 
     if (!bcmp(q->name, "add_pobox", 10) && !bcmp(argv[1], "POP", 4)) {
+       box = argv[3];
+       if (strcmp(cl->kname.name, box) != 0) return SMS_PERM;
+       
        users_id = *(int *)argv[0];
        mach_id = *(int *)argv[2];
-       box = argv[3];
+           
 ##      range of p is pobox
-##      repeat retrieve (exists = any(p.#box where p.#users_id = @users_id))
-
+##      repeat retrieve (exists = any(p.#box where p.#users_id = @users_id
+##                                   and p.type = "POP"))
        if (exists) return(SMS_EXISTS);
     }
 
@@ -244,19 +256,15 @@ access_maillist(q, argv, cl)
  **
  **/
 
-setup_add_group(q, argv, cl, access_check)
+setup_add_group(q, argv, cl)
     struct query *q;
     char *argv[];
     client *cl;
-    int access_check;
 ##{
 ##  int ngid;
 ##  int exists;
-    int status;
-
-    status = access_list(q, argv, cl);
-
-    if (status != SMS_SUCCESS || access_check) return(status);
+##  int rowcount;
+       int status;
 
 ##  range of g is groups
 ##  range of v is values
@@ -268,7 +276,9 @@ setup_add_group(q, argv, cl, access_check)
     }
 
 ##  repeat replace v (value = @ngid) where v.name = "gid"
-    return(SMS_SUCCESS);
+##  inquire_equel (rowcount = "rowcount")
+    if (rowcount != 1) return SMS_INGRES_ERR;
+    else return(SMS_SUCCESS);
 ##}
 \f
 /**
@@ -284,17 +294,14 @@ setup_add_group(q, argv, cl, access_check)
  **
  **/
 
-setup_add_user(q, argv, cl, access_check)
+setup_add_user(q, argv, cl)
     struct query *q;
     register char *argv[];
     client *cl;
-    int access_check;
 ##{
 ##  int nuid;
 ##  int exists;
 
-    if (access_check) return(SMS_SUCCESS);
-
     if (!bcmp(argv[1], "#", 2)) {
 ##      range of u is users
 ##      range of v is values
@@ -792,19 +799,16 @@ add_new_quota(q, argv)
     return(SMS_SUCCESS);
 ##}
 
-delete_current_quota(q, argv, cl, access_check)
+delete_current_quota(q, argv, cl)
     struct query *q;
     register char *argv[];
     client *cl;
-    int access_check;
 ##{
 ##  int mach_id;
 ##  int users_id;
 ##  char *device;
 ##  int quota;
 
-    if (access_check) return(SMS_SUCCESS);
-
     mach_id = *(int *)argv[0];
     device = argv[1];
     users_id = *(int *)argv[2];
@@ -1057,11 +1061,15 @@ set_next_object_id(object)
     char *object;
 ##{
 ##  char *name;
+##  int rowcount;
 
-    name = object;
+       name = object;
 ##  range of v is values
 ##  repeat replace v (value = v.value + 1) where v.#name = @name
-    return(SMS_SUCCESS);
+##      inquire_equel (rowcount = "rowcount")
+    if (rowcount != 1)
+       return SMS_INGRES_ERR;
+    else return(SMS_SUCCESS);
 ##}
 
 /**
@@ -1091,7 +1099,8 @@ get_query_need(q, argv, action, actarg)
     last_get_time = argv[1];
     table = q1->rtable;
 
-    if (q1->type != RETRIEVE) return(SMS_NO_MATCH);
+    if (q1 == NULL || q1->type != RETRIEVE || table == NULL)
+       return(SMS_NO_MATCH);
 
 ##  range of tbs is tblstats
 ##  repeat retrieve (need = any(tbs.modtime where tbs.#table = @table and
This page took 0.037789 seconds and 4 git commands to generate.