]> andersk Git - moira.git/blobdiff - server/qsupport.qc
don't allow a user with non-zero status to be deleted; don't allow
[moira.git] / server / qsupport.qc
index bb7a011a55ba54e4865366196c063a5cc48c9da7..ebaa1d8f2465d337747a4b44ca8c9e9741cf802f 100644 (file)
@@ -345,6 +345,12 @@ int setup_dusr(q, argv)
 ##  int flag, id;
 
     id = *(int *)argv[0];
+
+    /* For now, only allow users to be deleted if their status is 0 */
+##  repeat retrieve (flag = u.status) where u.users_id = @id
+    if (flag != 0)
+      return(SMS_IN_USE);
+
 ##  repeat delete nfsquota where nfsquota.users_id = @id
 ##  repeat retrieve (flag = any(members.member_id where members.member_id=@id
 ##                      and members.member_type = "USER"))
@@ -385,6 +391,7 @@ char **argv;
 ##                                     where machine.mach_id = u.pop_id 
 ##                                             and u.pop_id != 0
 ##                                             and u.users_id = @id))
+##     where u.users_id = @id
     if (!flag)
       return(SMS_MACHINE);
     if (strcmp(type, "POP"))
@@ -437,6 +444,9 @@ int setup_dmac(q, argv)
 ##  repeat retrieve (flag = any(hostaccess.mach_id where hostaccess.mach_id=@id))
     if (flag)
        return(SMS_IN_USE);
+##  repeat retrieve (flag = any(pcap.mach_id where pcap.mach_id=@id))
+    if (flag)
+       return(SMS_IN_USE);
 
 ##  repeat delete mcmap where mcmap.mach_id = @id
     return(SMS_SUCCESS);
@@ -525,7 +535,7 @@ int setup_dlis(q, argv)
     if (flag)
        return(SMS_IN_USE);
 ##  repeat retrieve (flag = any(list.name where list.acl_id=@id and
-##                     list.acl_type = "LIST"))
+##                     list.acl_type = "LIST" and list.list_id != @id))
     if (flag)
        return(SMS_IN_USE);
 ##  repeat retrieve (flag = any(servers.name where servers.acl_id=@id and
@@ -1205,7 +1215,7 @@ followup_glin(q, sq, v, action, actarg, cl)
 
     idx = 8;
     if (!strcmp(q->shortname, "gsin"))
-      idx = 11;
+      idx = 12;
 
     while (sq_get_data(sq, &argv)) {
        sms_trim_args(q->vcnt, argv);
@@ -2143,7 +2153,7 @@ register_user(q, argv, cl)
 ##  repeat retrieve (flag = any(u.#login where u.#login = @login))
     if (flag)
       return(SMS_IN_USE);
-##  repeat retrieve (flag = any(l.name where l.name = @login))
+##  repeat retrieve (flag = any(l.#name where l.#name = @login))
     if (flag)
       return(SMS_IN_USE);
 ##  repeat retrieve (flag = any(filesys.#name where filesys.#name = @login))
@@ -2219,7 +2229,8 @@ register_user(q, argv, cl)
       return(SMS_NO_ID);
 ##  repeat append filesys (filsys_id = values.value, phys_id = @pid,
 ##                        label = @login, type = "NFS", mach_id = @m_id,
-##                        name = @directory + @login, mount = "/mit/" + @login,
+##                        name = @directory + "/" + @login,
+##                        mount = "/mit/" + @login,
 ##                        access = "w", comments = "User Locker",
 ##                        owner = @users_id, owners = @list_id, createflg = 1,
 ##                        lockertype = "HOMEDIR", modtime = "now",
@@ -2229,7 +2240,7 @@ register_user(q, argv, cl)
     if (rowcount != 1)
       return(SMS_INTERNAL);
     com_err(whoami, 0, "filesys created on mach %d in %s/%s", m_id,
-           trim(directory), login);
+           directory, login);
 
     /* set quota */
 ##  repeat retrieve (quota = values.value) where values.name = "def_quota"
@@ -2251,6 +2262,11 @@ register_user(q, argv, cl)
       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"
+##  repeat replace tblstats (appends = tblstats.appends + 1, modtime = "now")
+##     where tblstats.table = "list" or tblstats.table = "filesys" or
+##           tblstats.table = "nfsquota"
     return(SMS_SUCCESS);
 ##}
 
@@ -2389,7 +2405,7 @@ validate_fields(q, argv, vo, n)
 
 /* validate_chars: verify that there are no illegal characters in
  * the string.  Legal characters are printing chars other than 
- * ", *, ?, [ and ].
+ * ", *, ?, \, [ and ].
  */
 static int illegalchars[] = {
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* ^@ - ^O */
@@ -2397,7 +2413,7 @@ static int illegalchars[] = {
     0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* SPACE - / */
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* 0 - ? */
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ - O */
-    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, /* P - _ */
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, /* P - _ */
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* ` - o */
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, /* p - ^? */
     1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -2598,8 +2614,9 @@ validate_typedata(q, argv, vo)
             * values.[idfield] for the id.
             */
            if (vo->idfield && !strcmp(argv[0], argv[vo->index])) {
+               set_next_object_id(q->validate->object_id, q->rtable);
                name = vo->idfield;
-##             repeat retrieve (id = values.value+1) where values.#name = @name
+##             repeat retrieve (id = values.value) where values.#name = @name
 ##             inquire_equel(rowcount = "rowcount")
                if (rowcount != 1) return(SMS_LIST);
            } else
@@ -2667,6 +2684,4 @@ char *name;
 
 sanity_check_database()
 ##{
-##  replace servers (inprogress = 0)
-##  replace serverhosts (inprogress = 0)
 ##}
This page took 0.035432 seconds and 4 git commands to generate.