]> andersk Git - moira.git/blobdiff - server/qsupport.qc
Case-insensitive stuff.
[moira.git] / server / qsupport.qc
index 887a4a5203ea5b62fa3980845d5d1a705e17c884..5e3638346f3508628b5d3798a85acfc5228157f6 100644 (file)
@@ -329,6 +329,17 @@ setup_ausr(q, argv, cl)
     client *cl;
 ##{
 ##  int nuid, rowcount;
+##  char *mit_id;
+
+#ifdef notdef
+    /* this is currently disabled because we need an index on ID's
+     * before it can run in finite time.
+     */
+    mit_id = argv[U_MITID];
+##  retrieve (rowcount = any(u.#mit_id where u.#mit_id = mit_id))
+    if (ingres_errno) return(mr_errcode);
+    if (rowcount) return(MR_EXISTS);
+#endif notdef
 
     if (!strcmp(argv[1], UNIQUE_UID) || atoi(argv[1]) == -1) {
        if (set_next_object_id("uid", "users"))
@@ -463,6 +474,9 @@ int setup_dmac(q, argv)
 ##  repeat retrieve (flag = any(printcap.mach_id where printcap.mach_id=@id))
     if (flag)
        return(MR_IN_USE);
+##  repeat retrieve (flag = any(printcap.quotaserver where printcap.quotaserver=@id))
+    if (flag)
+       return(MR_IN_USE);
 ##  repeat retrieve (flag = any(palladium.mach_id where palladium.mach_id=@id))
     if (flag)
        return(MR_IN_USE);
@@ -564,6 +578,10 @@ int setup_dlis(q, argv)
 ##                     servers.acl_type = "LIST"))
     if (flag)
        return(MR_IN_USE);
+##  repeat retrieve (flag = any(quota.entity_id where quota.entity_id=@id and
+##                     quota.type = "GROUP"))
+    if (flag)
+       return(MR_IN_USE);
 ##  repeat retrieve (flag=any(hostaccess.acl_id where hostaccess.acl_id=@id and
 ##                     hostaccess.acl_type = "LIST"))
     if (flag)
@@ -660,11 +678,11 @@ int setup_dshi(q, argv)
 setup_afil(q, argv)
     struct query *q;
     char *argv[];
-{
-    char *type;
+##{
+    char *type, *name;
     int mach_id;
-    char *name;
-    char *access;  
+##  int ok;
+##  char ftype[32], *access;
 
     type = argv[1];
     mach_id = *(int *)argv[2];
@@ -672,11 +690,17 @@ setup_afil(q, argv)
     access = argv[5];
     var_phys_id = 0;
 
+    sprintf(ftype, "fs_access_%s", type);
+##  retrieve (ok = any(alias.trans where alias.name = ftype and
+##                          alias.type = "TYPE" and alias.trans = access))
+    if (ingres_errno) return(mr_errcode);
+    if (ok == 0) return(MR_FILESYS_ACCESS);
+
     if (!strcmp(type, "NFS"))
        return (check_nfs(mach_id, name, access));
     else
        return(MR_SUCCESS);
-}
+##}
 
 
 /* Verify the arguments, depending on the FStype.  Also, if this is an
@@ -690,9 +714,9 @@ setup_ufil(q, argv, cl)
     client *cl;
 ##{
     int mach_id, status;
-    char *type, *name, *access;  
+    char *type, *name;  
 ##  int fid, total, who;
-##  char *entity;
+##  char *entity, ftype[32], *access;
 
     type = argv[2];
     mach_id = *(int *)argv[3];
@@ -703,6 +727,12 @@ setup_ufil(q, argv, cl)
     who = cl->client_id;
     entity = cl->entity;
 
+    sprintf(ftype, "fs_access_%s", type);
+##  retrieve (total = any(alias.trans where alias.name = ftype and
+##                          alias.type = "TYPE" and alias.trans = access))
+    if (ingres_errno) return(mr_errcode);
+    if (total == 0) return(MR_FILESYS_ACCESS);
+
     if (!strcmp(type, "NFS")) {
        status = check_nfs(mach_id, name, access);
 ##     replace quota (phys_id = var_phys_id) where quota.filsys_id = fid
@@ -710,7 +740,8 @@ setup_ufil(q, argv, cl)
        return(status);
     } else if (!strcmp(type, "AFS")) {
        total = 0;
-##     retrieve (total = sum(quota.quota where quota.filsys_id = fid))
+##     retrieve (total = sum(quota.quota where quota.filsys_id = fid
+##                           and quota.phys_id != 0))
        if (ingres_errno) return(mr_errcode);
        if (total != 0) {
 ##         append quota (quota = total, filsys_id = fid,
@@ -743,10 +774,6 @@ setup_ufil(q, argv, cl)
     register char *cp1;
     register char *cp2;
 
-    caccess = (isupper(*access)) ? tolower(*access) : *access;
-    if (caccess != 'r' && caccess != 'w' && caccess != 'n')
-      return(MR_FILESYS_ACCESS);
-
     status = MR_NFS;
 ##  range of np is nfsphys
 ##  repeat retrieve (var_phys_id = np.#nfsphys_id, dir = trim(np.#dir))
@@ -1476,6 +1503,40 @@ followup_aqot(q, argv, cl)
 ##}
 
 
+followup_gpce(q, sq, v, action, actarg, cl)
+    struct query *q;
+    register struct save_queue *sq;
+    struct validate *v;
+    register int (*action)();
+    register int actarg;
+    client *cl;
+{
+    register int i, j;
+    char **argv, *malloc();
+    int id, status;
+
+    i = q->vcnt - 2;
+    while (sq_get_data(sq, &argv)) {
+       id = atoi(argv[PCAP_QSERVER]);
+       status = id_to_name(id, "MACHINE", &argv[PCAP_QSERVER]);
+       if (status) return (status);
+       id = atoi(argv[i]);
+       if (id > 0)
+         status = id_to_name(id, "USER", &argv[i]);
+       else
+         status = id_to_name(-id, "STRING", &argv[i]);
+       if (status && status != MR_NO_MATCH)
+         return(status);
+       (*action)(q->vcnt, argv, actarg);
+       for (j = 0; j < q->vcnt; j++)
+         free(argv[j]);
+       free(argv);
+    }
+    sq_destroy(sq);
+    return(MR_SUCCESS);
+}
+
+
 /* followup_gzcl:
  */
 
@@ -1750,7 +1811,7 @@ get_list_info(q, aargv, cl, action, actarg)
  * how many different ancestors a member is allowed to have.
  */
 
-#define MAXLISTDEPTH   100
+#define MAXLISTDEPTH   1024
 
 int add_member_to_list(q, argv, cl)
     struct query *q;
@@ -2534,7 +2595,7 @@ register_user(q, argv, cl)
 
     /* find user */
 ##  repeat retrieve (users_id = u.#users_id)
-##     where u.#uid = @uid and (u.status = 0 or u.status = 5)
+##     where u.#uid = @uid and (u.status = 0 or u.status = 5 or u.status = 6)
 ##  inquire_equel(rowcount = "rowcount");
     if (rowcount == 0)
       return(MR_NO_MATCH);
@@ -2681,7 +2742,8 @@ register_user(q, argv, cl)
     if (rowcount != 1)
       return(MR_INTERNAL);
     aargv[0] = login;
-    aargv[1] = login;
+    aargv[1] = "USER";
+    aargv[2] = login;
     sprintf(buffer, "q.entity_id = %d and q.filsys_id = values.value and q.type = \"USER\" and values.name = \"filsys_id\"", users_id);
     incremental_after("quota", buffer, aargv);
     com_err(whoami, 0, "quota of %d assigned", quota);
This page took 0.038317 seconds and 4 git commands to generate.