]> andersk Git - moira.git/blobdiff - server/qsupport.qc
Initial revision
[moira.git] / server / qsupport.qc
index a85f1693cbb2338c9b413aabbf3585f736e2bfd0..f7a0aeb494f107f20addc6796c9bc11f7a5b1c3e 100644 (file)
@@ -4,6 +4,8 @@
  *     $Header$
  *
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  *
  */
 
 static char *rcsid_qsupport_qc = "$Header$";
 #endif lint
 
+#include <mit-copyright.h>
 #include "query.h"
 #include "sms_server.h"
 #include <ctype.h>
 
 
 extern char *whoami, *strsave();
-extern int  ingres_errno;
 
 
 /* Specialized Access Routines */
@@ -889,25 +891,24 @@ set_pobox_modtime(q, argv, cl)
 ##}
 
 
-/* Sets the modtime on a machine record.  The machine name is in argv[0].
- * This routine is different from the generic set_modtime in that the
- * name is uppercased first.
+/* Like set_modtime, but uppercases the name first.
  */
 
-set_mach_modtime(q, argv, cl)
+set_uppercase_modtime(q, argv, cl)
     struct query *q;
     char **argv;
     client *cl;
 ##{
-##  char *host, *entity;
+##  char *name, *entity, *table;
 ##  int who;
 
     entity = cl->entity;
     who = cl->users_id;
+    table = q->rtable;
+    name = argv[0];
 
-    host = argv[0];
-##  repeat replace m (modtime = "now", modby = @who, modwith = @entity)
-##      where m.name = uppercase(@host)
+##  replace table (modtime = "now", modby = who, modwith = entity)
+##      where table.#name = uppercase(name)
     return(SMS_SUCCESS);
 ##}
 
@@ -2172,7 +2173,6 @@ register_user(q, argv, cl)
 ##  repeat retrieve (flag = any(filesys.#name where filesys.#name = @login))
     if (flag)
       return(SMS_IN_USE);
-    if (ingres_errno != 0) return(ingres_errno);
     com_err(whoami, 0, "new login name OK");
 
     /* choose place for pobox, put in mid */
@@ -2180,7 +2180,6 @@ register_user(q, argv, cl)
 ##    where sh.service = "POP" and m.mach_id = sh.mach_id and
 ##     sh.value2 - sh.value1 = max(sh.value2-sh.value1 where sh.service="POP")
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount == 0)
       return(SMS_NO_POBOX);
 
@@ -2191,7 +2190,6 @@ register_user(q, argv, cl)
 ##                   pmodwith=@entity)
 ##     where u.#users_id = @users_id
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
     set_pop_usage(mid, 1);
@@ -2205,7 +2203,6 @@ register_user(q, argv, cl)
       return(SMS_NO_ID);
 ##  repeat retrieve (list_id = values.value) where values.name = "list_id"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
 ##  repeat append list (name = @login, #list_id = @list_id, active = 1,
@@ -2215,13 +2212,11 @@ register_user(q, argv, cl)
 ##                     modby = @who, modwith = @entity)
 ##     where values.name = "gid"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
 ##  repeat append members (#list_id = @list_id, member_type = "USER",
 ##                        member_id = @users_id)
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
     com_err(whoami, 0, "group list created");
@@ -2240,7 +2235,6 @@ register_user(q, argv, cl)
            m_id = mid;
        }
 ##  }
-    if (ingres_errno != 0) return(ingres_errno);
     if (maxsize == 0)
       return(SMS_NO_FILESYS);
 
@@ -2257,7 +2251,6 @@ register_user(q, argv, cl)
 ##                        modby = @who, modwith = @entity)
 ##     where values.name = "filsys_id"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
     com_err(whoami, 0, "filesys created on mach %d in %s/%s", m_id,
@@ -2266,7 +2259,6 @@ register_user(q, argv, cl)
     /* set quota */
 ##  repeat retrieve (quota = values.value) where values.name = "def_quota"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_NO_QUOTA);
 ##  repeat append nfsquota (#users_id = @users_id, filsys_id = values.value,
@@ -2274,25 +2266,21 @@ register_user(q, argv, cl)
 ##                         modby = @who, modwith = @entity)
 ##     where values.name = "filsys_id"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
 ##  repeat replace nfsphys (allocated = nfsphys.allocated + @quota)
 ##     where nfsphys.nfsphys_id = filesys.#phys_id and
 ##           filesys.filsys_id = values.value and values.name = "filsys_id"
 ##  inquire_equel(rowcount = "rowcount");
-    if (ingres_errno != 0) return(ingres_errno);
     if (rowcount != 1)
       return(SMS_INTERNAL);
     com_err(whoami, 0, "quota of %d assigned", quota);
 
 ##  repeat replace tblstats (updates = tblstats.updates + 1, modtime = "now")
 ##     where tblstats.table = "users"
-    if (ingres_errno != 0) return(ingres_errno);
 ##  repeat replace tblstats (appends = tblstats.appends + 1, modtime = "now")
 ##     where tblstats.table = "list" or tblstats.table = "filesys" or
 ##           tblstats.table = "nfsquota"
-    if (ingres_errno != 0) return(ingres_errno);
     return(SMS_SUCCESS);
 ##}
 
This page took 0.043563 seconds and 4 git commands to generate.