]> andersk Git - moira.git/commitdiff
Add sponsor_type/sponsor_id column to users table, and client support for manipulatin...
authorzacheiss <zacheiss>
Thu, 29 Nov 2007 18:09:07 +0000 (18:09 +0000)
committerzacheiss <zacheiss>
Thu, 29 Nov 2007 18:09:07 +0000 (18:09 +0000)
13 files changed:
clients/addusr/addusr.c
clients/moira/defs.h
clients/moira/f_defs.h
clients/moira/menus.c
clients/moira/user.c
clients/stanley/stanley.c
db/schema.sql
include/moira_site.h
regtape/common.pc
server/mr_server.h
server/qfollow.pc
server/qsupport.pc
server/queries2.c

index 1f66dbd2691d7749f53d46d59ea5313e2f6b1359..a0a946bbe28c781891ced9a9a11344804f9df239 100644 (file)
 
 RCSID("$Header$");
 
+struct owner_type {
+  int type;
+  char *name;
+};
+
+#define M_ANY          0
+#define M_USER         1
+#define M_LIST         2
+#define M_KERBEROS     3
+#define M_NONE         4
+
 #ifdef ATHENA
 #define DEFAULT_SHELL "/bin/athena/tcsh"
 #else
@@ -28,10 +39,13 @@ RCSID("$Header$");
 #endif
 
 #define DEFAULT_WINCONSOLESHELL "cmd"
+#define DEFAULT_WINHOMEDIR "[DFS]"
+#define DEFAULT_WINPROFILEDIR "[DFS]"
 
 /* flags from command line */
 char *class, *comment, *status_str, *shell, *winconsoleshell, *filename;
 int reg_only, reg, verbose, nodupcheck, securereg, nocaps;
+struct owner_type *sponsor;
 
 /* argument parsing macro */
 #define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
@@ -42,6 +56,7 @@ int duplicate, errors;
 void usage(char **argv);
 int usercheck(int argc, char **argv, void *qargv);
 int get_uid(int argc, char **argv, void *qargv);
+struct owner_type *parse_member(char *s);
 
 int main(int argc, char **argv)
 {
@@ -53,6 +68,7 @@ int main(int argc, char **argv)
 
   /* clear all flags & lists */
   reg_only = reg = verbose = lineno = nodupcheck = errors = securereg = nocaps = 0;
+  sponsor = NULL;
   server = NULL;
   filename = "-";
   shell = DEFAULT_SHELL;
@@ -118,6 +134,16 @@ int main(int argc, char **argv)
              else 
                usage(argv);
            }
+         else if (argis("sp", "sponsor"))
+           {
+             if (arg - argv < argc - 1)
+               {
+                 ++arg;
+                 sponsor = parse_member(*arg);
+               }
+             else
+               usage(argv);
+           }
          else if (argis("6", "secure"))
            securereg++;
          else if (argis("r", "reg_only"))
@@ -170,18 +196,21 @@ int main(int argc, char **argv)
     }
 
   /* fire up Moira */
-  if (mrcl_connect(server, "addusr", 3, 1) != MRCL_SUCCESS)
+  if (mrcl_connect(server, "addusr", 12, 1) != MRCL_SUCCESS)
     exit(2);
 
   qargv[U_NAME] = UNIQUE_LOGIN;
   qargv[U_UID] = UNIQUE_UID;
   qargv[U_SHELL] = shell;
   qargv[U_WINCONSOLESHELL] = winconsoleshell;
+  qargv[U_WINHOMEDIR] = DEFAULT_WINHOMEDIR;
+  qargv[U_WINPROFILEDIR] = DEFAULT_WINPROFILEDIR;
   qargv[U_STATE] = status_str;
   qargv[U_CLASS] = class;
   qargv[U_COMMENT] = comment;
   qargv[U_SIGNATURE] = "";
   qargv[U_SECURE] = securereg ? "1" : "0";
+  
   while (fgets(buf, BUFSIZ, input))
     {
       /* throw away terminating newline */
@@ -294,8 +323,49 @@ int main(int argc, char **argv)
                  com_err(whoami, 0, "ADDING user anyway");
                }
            }
-         status = mr_query("add_user_account", U_SECURE + 1, qargv,
-                           NULL, NULL);
+
+         if (sponsor)
+           {
+             qargv[U_SPONSOR_NAME] = sponsor->name;
+             switch (sponsor->type)
+               {
+               case M_ANY:
+               case M_USER:
+                 qargv[U_SPONSOR_TYPE] = "USER";
+                 status = mr_query("add_user_account", 17, qargv, NULL, NULL);
+                 if (sponsor->type != M_ANY || status != MR_USER)
+                   break;
+                 
+               case M_LIST:
+                 qargv[U_SPONSOR_TYPE] = "LIST";
+                 status = mr_query("add_user_account", 17, qargv, NULL, NULL);
+                 break;
+                 
+               case M_KERBEROS:
+                 qargv[U_SPONSOR_TYPE] = "KERBEROS";
+                 status = mrcl_validate_kerberos_member(qargv[U_SPONSOR_NAME],
+                                                        &qargv[U_SPONSOR_NAME]);
+                 if (mrcl_get_message())
+                   mrcl_com_err(whoami);
+                 if (status == MRCL_REJECT)
+               exit(1);
+                 status = mr_query("add_user_account", 17, qargv, NULL, NULL);
+                 break;
+                 
+               case M_NONE:
+                 qargv[U_SPONSOR_TYPE] = "NONE";
+                 status = mr_query("add_user_account", 17, qargv, NULL, NULL);
+                 break;
+               }
+           }
+         else
+           {
+             qargv[U_SPONSOR_TYPE] = "NONE";
+             qargv[U_SPONSOR_NAME] = "NONE";
+         
+             status = mr_query("add_user_account", 17, qargv, NULL, NULL);
+           }
+         
          if (status)
            {
              com_err(whoami, status, "adding user %s %s", first, last);
@@ -359,6 +429,7 @@ void usage(char **argv)
   fprintf(stderr, "   -h | -shell shell (default %s)\n", DEFAULT_SHELL);
   fprintf(stderr, "   -w | -winshell windows console shell (default %s)\n",
          DEFAULT_WINCONSOLESHELL);
+  fprintf(stderr, "   -sp | -sponsor sponsor (default NONE)\n");
   fprintf(stderr, "   -r | -reg_only\n");
   fprintf(stderr, "   -R | -register (and add to database)\n");
   fprintf(stderr, "   -v | -verbose\n");
@@ -396,3 +467,57 @@ int get_uid(int argc, char **argv, void *uidv)
 
   return MR_CONT;
 }
+
+/* Parse a line of input, fetching a member.  NULL is returned if a member
+ * is not found.  ';' is a comment character.
+ */
+struct owner_type *parse_member(char *s)
+{
+  struct owner_type *m;
+  char *p, *lastchar;
+
+  while (*s && isspace(*s))
+    s++;
+  lastchar = p = s;
+  while (*p && *p != '\n' && *p != ';')
+    {
+      if (isprint(*p) && !isspace(*p))
+       lastchar = p++;
+      else
+       p++;
+    }
+  lastchar++;
+  *lastchar = '\0';
+  if (p == s || strlen(s) == 0)
+    return NULL;
+
+  if (!(m = malloc(sizeof(struct owner_type))))
+    return NULL;
+
+  if ((p = strchr(s, ':')))
+    {
+      *p = '\0';
+      m->name = ++p;
+      if (!strcasecmp("user", s))
+       m->type = M_USER;
+      else if (!strcasecmp("list", s))
+       m->type = M_LIST;
+      else if (!strcasecmp("kerberos", s))
+       m->type = M_KERBEROS;
+      else if (!strcasecmp("none", s))
+       m->type = M_NONE;
+      else
+       {
+         m->type = M_ANY;
+         *(--p) = ':';
+         m->name = s;
+       }
+      m->name = strdup(m->name);
+    }
+  else
+    {
+      m->name = strdup(s);
+      m->type = strcasecmp(s, "none") ? M_ANY : M_NONE;
+    }
+  return m;
+}
index cb77700242e8457882eccb01c07e2e9ff507f5bc..6219c3e97902a484020915f67d6e4b06fc025b9b 100644 (file)
@@ -50,7 +50,7 @@ typedef int Bool;
 
 /* What version of the queries are we asking for? */
 
-#define QUERY_VERSION 11
+#define QUERY_VERSION 12
 
 /* This is unimplemented in the menu stuff, but would be nice. */
 
index 824ebceecc24a5fcb7ec272e5cae415eebcbfbf1..0b8f0b95f13a2478ac79e8f96b1539ad1b13b608 100644 (file)
@@ -166,6 +166,7 @@ int AddUserReservation(int argc, char **argv);
 int DelUserReservation(int argc, char **argv);
 int GetUserByReservation(int argc, char **argv);
 void PrintReservationTypes(void);
+int UserBySponsor(int argc, char **argv);
 
 /* printer.c */
 int GetPrn(int argc, char **argv);
index 4a5669656107ce49ceaf8467df9cd969d433c63d..22fc7e074ebcfe12cee869894b130db15818c31f 100644 (file)
@@ -667,6 +667,7 @@ Menu user_menu = {
       {"id", "Show user information by ID number"},
       {"ID number", "ID number: "}
     } },
+    SIMPLEFUNC("sponsor", "Lookup users by sponsor", UserBySponsor),
     {UpdateUser, NULLMENU, 2, {
       {"modify", "Change all user fields"},
       {"login", "Login name: "}
index e95f833a78518bdb3c1324d496c015be52d97f76..b1f1ee382cae8ab4502775dc96de7dd7290b9a9d 100644 (file)
@@ -32,6 +32,8 @@ RCSID("$Header$");
 void CorrectCapitalization(char **name);
 char **AskUserInfo(char **info, Bool name);
 struct mqelem *GetUserInfo(int type, char *name1, char *name2);
+static void PrintLogin(char **info);
+struct mqelem *GetUserBySponsor(char *type, char *name);
 
 #define LOGIN 0
 #define UID   1
@@ -117,6 +119,9 @@ static void PrintUserInfo(char **info)
   sprintf(buf, "Class: %-25s Windows Console Shell: %-10s",
          info[U_CLASS], info[U_WINCONSOLESHELL]);
   Put_message(buf);
+  sprintf(buf, "Sponsor: %s %s", info[U_SPONSOR_TYPE],
+         info[U_SPONSOR_NAME]);
+  Put_message(buf);
   sprintf(buf, "Account is: %-20s MIT ID number: %s",
          UserState(atoi(info[U_STATE])), info[U_MITID]);
   Put_message(buf);
@@ -162,6 +167,8 @@ static char **SetUserDefaults(char **info)
   info[U_SECURE] = strdup("0");
   info[U_WINHOMEDIR] = strdup(DEFAULT_WINHOMEDIR);
   info[U_WINPROFILEDIR] = strdup(DEFAULT_WINPROFILEDIR);
+  info[U_SPONSOR_TYPE] = strdup("NONE");
+  info[U_SPONSOR_NAME] = strdup("NONE");
   info[U_MODTIME] = info[U_MODBY] = info[U_MODWITH] = info[U_END] = NULL;
   info[U_CREATED] = info[U_CREATOR] = NULL;
   return info;
@@ -316,6 +323,13 @@ char **AskUserInfo(char **info, Bool name)
       SUB_ERROR)
     return NULL;
 
+  if (GetTypeFromUser("User's sponsor type", "ace_type", &info[U_SPONSOR_TYPE])
+      == SUB_ERROR)
+    return NULL;
+  if (strcmp(info[U_SPONSOR_TYPE], "NONE") &&
+      GetValueFromUser("Sponsor's Name", &info[U_SPONSOR_NAME]) == SUB_ERROR)
+    return NULL;
+
   state = atoi(info[U_STATE]);
   if (!name || state == 0 || state == 2)
     {
@@ -1157,3 +1171,61 @@ void PrintReservationTypes(void)
   FreeQueue(QueueTop(top));  
 }
 
+int UserBySponsor(int argc, char **argv)
+{
+  char buf[BUFSIZ], temp_buf[BUFSIZ], *type, *name;
+  struct mqelem *top;
+
+  type = strdup("USER");
+  if (GetTypeFromUser("Type of owner", "ace_type", &type) == SUB_ERROR)
+    return DM_NORMAL;
+
+  sprintf(buf, "Name of %s", type);
+  name = strdup(user);
+  if (GetValueFromUser(buf, &name) == SUB_ERROR)
+    return DM_NORMAL;
+
+  switch (YesNoQuestion("Do you want a recursive search (y/n)", FALSE))
+    {
+    case TRUE:
+      sprintf(temp_buf, "R%s", type);     /* "USER to "RUSER", etc. */
+      free(type);
+      type = strdup(temp_buf);
+      break;
+    case FALSE:
+      break;
+    default:
+      return DM_NORMAL;
+    }
+
+  top = GetUserBySponsor(type, name);
+  Loop(top, PrintLogin);
+
+  FreeQueue(top);
+  return DM_NORMAL;
+}
+
+static void PrintLogin(char **info)
+{
+     char buf[BUFSIZ];
+
+     sprintf(buf, "Login: %s", info[U_NAME]);
+     Put_message(buf);
+}
+
+struct mqelem *GetUserBySponsor(char *type, char *name)
+{
+  char *args[2];
+  struct mqelem *elem = NULL;
+  int status;
+
+  args[0] = type;
+  args[1] = name;
+  if ((status = do_mr_query("get_user_account_by_sponsor", 2, args, StoreInfo,
+                           &elem)))
+    {
+      com_err(program_name, status, " in get_user_account_by_sponsor");
+      return NULL;
+    }
+  return QueueTop(elem);
+}
index 68b214ef3e447faa1a5418d7ac1ec342b5b66562..bd70d3aad605a374700beae6b4c5c656c660da80 100644 (file)
 
 RCSID("$Header$");
 
+struct owner_type {
+  int type;
+  char *name;
+};
+
 struct string_list {
   char *string;
   struct string_list *next;
 };
 
+#define M_ANY          0
+#define M_USER         1
+#define M_LIST         2
+#define M_KERBEROS     3
+#define M_NONE         4
+
 /* argument parsing macro */
 #define argis(a, b) (!strcmp(*arg + 1, a) || !strcmp(*arg + 1, b))
 
@@ -35,6 +46,7 @@ struct string_list {
 int info_flag, update_flag, create_flag, deact_flag, reg_flag;
 int list_res_flag, update_res_flag, unformatted_flag, verbose, noauth;
 
+struct owner_type *sponsor;
 struct string_list *reservation_add_queue, *reservation_remove_queue;
 
 char *username, *whoami;
@@ -42,6 +54,8 @@ char *username, *whoami;
 char *newlogin, *uid, *shell, *winshell, *last, *first, *middle, *u_status;
 char *clearid, *class, *comment, *secure, *winhomedir, *winprofiledir;
 
+struct owner_type *parse_member(char *s);
+
 static char *states[] = {
   "Registerable (0)",
   "Active (1)",
@@ -90,6 +104,7 @@ int main(int argc, char **argv)
   u_status = clearid = class = comment = secure = NULL;
   winhomedir = winprofiledir = NULL;
   reservation_add_queue = reservation_remove_queue = NULL;
+  sponsor = NULL;
   whoami = argv[0];
 
   /* parse args */
@@ -227,6 +242,14 @@ int main(int argc, char **argv)
            } else
              usage(argv);
          }
+         else if (argis("sp", "sponsor")) {
+           if (arg - argv < argc - 1) {
+             arg++;
+             update_flag++;
+             sponsor = parse_member(*arg);
+           } else
+             usage(argv);
+         }
          else if (argis("ar", "addreservation")) {
            if (arg - argv < argc - 1) {
              arg++;
@@ -281,7 +304,7 @@ int main(int argc, char **argv)
   }
 
   /* fire up Moira */
-  status = mrcl_connect(server, "stanley", 11, !noauth);
+  status = mrcl_connect(server, "stanley", 12, !noauth);
   if (status == MRCL_AUTH_ERROR)
     {
       com_err(whoami, 0, "Try the -noauth flag if you don't "
@@ -346,8 +369,48 @@ int main(int argc, char **argv)
        argv[U_WINPROFILEDIR] = winprofiledir;
       else
        argv[U_WINPROFILEDIR] = "[DFS]";
-
-      status = wrap_mr_query("add_user_account", 15, argv, NULL, NULL);
+      if (sponsor)
+       {
+         argv[U_SPONSOR_NAME] = sponsor->name;
+         switch (sponsor->type)
+           {
+           case M_ANY:
+           case M_USER:
+             argv[U_SPONSOR_TYPE] = "USER";
+             status = wrap_mr_query("add_user_account", 17, argv, NULL, NULL);
+             if (sponsor->type != M_ANY || status != MR_USER)
+               break;
+
+           case M_LIST:
+             argv[U_SPONSOR_TYPE] = "LIST";
+             status = wrap_mr_query("add_user_account", 17, argv, NULL, NULL);
+             break;
+
+           case M_KERBEROS:
+             argv[U_SPONSOR_TYPE] = "KERBEROS";
+             status = mrcl_validate_kerberos_member(argv[U_SPONSOR_NAME],
+                                                    &argv[U_SPONSOR_NAME]);
+             if (mrcl_get_message())
+               mrcl_com_err(whoami);
+             if (status == MRCL_REJECT)
+               exit(1);
+             status = wrap_mr_query("add_user_account", 17, argv, NULL, NULL);
+             break;
+
+           case M_NONE:
+             argv[U_SPONSOR_TYPE] = "NONE";
+             status = wrap_mr_query("add_user_account", 17, argv, NULL, NULL);
+             break;
+           }
+       }
+      else
+       {
+         argv[U_SPONSOR_TYPE] = "NONE";
+         argv[U_SPONSOR_NAME] = "NONE";
+         
+         status = wrap_mr_query("add_user_account", 17, argv, NULL, NULL);
+       }
+             
       if (status)
        {
          com_err(whoami, status, "while adding user account.");
@@ -385,6 +448,8 @@ int main(int argc, char **argv)
       argv[13] = old_argv[12];
       argv[14] = old_argv[13];
       argv[15] = old_argv[14];
+      argv[16] = old_argv[15];
+      argv[17] = old_argv[16];
       
       argv[0] = username;
       if (newlogin)
@@ -415,8 +480,45 @@ int main(int argc, char **argv)
        argv[14] = winhomedir;
       if (winprofiledir)
        argv[15] = winprofiledir;
-
-      status = wrap_mr_query("update_user_account", 16, argv, NULL, NULL);
+      if (sponsor)
+       {
+         argv[17] = sponsor->name;
+         switch (sponsor->type)
+           {
+           case M_ANY:
+           case M_USER:
+             argv[16] = "USER";
+             status = wrap_mr_query("update_user_account", 18, argv, NULL, 
+                                    NULL);
+             if (sponsor->type != M_ANY || status != MR_USER)
+               break;
+
+           case M_LIST:
+             argv[16] = "LIST";
+             status = wrap_mr_query("update_user_account", 18, argv, NULL,
+                                    NULL);
+             break;
+
+           case M_KERBEROS:
+             argv[16] = "KERBEROS";
+             status = mrcl_validate_kerberos_member(argv[17], &argv[17]);
+             if (mrcl_get_message())
+               mrcl_com_err(whoami);
+             if (status == MRCL_REJECT)
+               exit(1);
+             status = wrap_mr_query("update_user_account", 18, argv, NULL,
+                                    NULL);
+             break;
+
+           case M_NONE:
+             argv[16] = "NONE";
+             status = wrap_mr_query("update_user_account", 18, argv, NULL,
+                                    NULL);
+             break;
+           }
+       }
+      else
+       status = wrap_mr_query("update_user_account", 18, argv, NULL, NULL);
 
       if (status)
        com_err(whoami, status, "while updating user.");
@@ -656,6 +758,9 @@ void show_user_info(char **argv)
   printf("User id: %-23s Login shell: %-10s\n", argv[U_UID], argv[U_SHELL]);
   printf("Class: %-25s Windows Console Shell: %-10s\n", argv[U_CLASS],
         argv[U_WINCONSOLESHELL]);
+  sprintf(tbuf, "%s %s", argv[U_SPONSOR_TYPE],
+         strcmp(argv[U_SPONSOR_TYPE], "NONE") ? argv[U_SPONSOR_NAME] : "");
+  printf("Sponsor: %-25s\n", tbuf);
   printf("Account is: %-20s MIT ID number: %s\n",
         UserState(atoi(argv[U_STATE])), argv[U_MITID]);
   printf("Windows Home Directory: %s\n", argv[U_WINHOMEDIR]);
@@ -674,6 +779,7 @@ void show_user_info(char **argv)
 
 void show_user_info_unformatted(char **argv)
 {
+  char tbuf[BUFSIZ];
   int status;
 
   printf("Login name:                %s\n", argv[U_NAME]);
@@ -681,6 +787,9 @@ void show_user_info_unformatted(char **argv)
         argv[U_MIDDLE]);
   printf("User id:                   %s\n", argv[U_UID]);
   printf("Class:                     %s\n", argv[U_CLASS]);
+  sprintf(tbuf, "%s %s", argv[U_SPONSOR_TYPE],
+         strcmp(argv[U_SPONSOR_TYPE], "NONE") ? argv[U_SPONSOR_NAME] : "");
+  printf("Sponsor:                   %s\n", tbuf);
   printf("Login shell:               %s\n", argv[U_SHELL]);
   printf("Windows Console Shell:     %s\n", argv[U_WINCONSOLESHELL]);
   printf("Account is:                %s\n", UserState(atoi(argv[U_STATE])));
@@ -725,10 +834,65 @@ void usage(char **argv)
          "-dr  | -deletereservation reservation");
   fprintf(stderr, USAGE_OPTIONS_FORMAT, "-wh  | -winhomedir winhomedir",
          "-wp  | -winprofiledir winprofiledir");
-  fprintf(stderr, USAGE_OPTIONS_FORMAT, "-u   | -unformatted",
-         "-n   | -noauth");
-  fprintf(stderr, USAGE_OPTIONS_FORMAT, "-v   | -verbose",
-         "-db  | -database host[:port]");
+  fprintf(stderr, USAGE_OPTIONS_FORMAT, "-sp  | -sponsor sponsor",
+         "-u   | -unformatted");
+  fprintf(stderr, USAGE_OPTIONS_FORMAT, "-n   | -noauth",
+         "-v   | -verbose");
+  fprintf(stderr, "  %-39s\n", "-db  | -database host[:port]");
 
   exit(1);
 }
+
+/* Parse a line of input, fetching a member.  NULL is returned if a member
+ * is not found.  ';' is a comment character.
+ */
+struct owner_type *parse_member(char *s)
+{
+  struct owner_type *m;
+  char *p, *lastchar;
+
+  while (*s && isspace(*s))
+    s++;
+  lastchar = p = s;
+  while (*p && *p != '\n' && *p != ';')
+    {
+      if (isprint(*p) && !isspace(*p))
+       lastchar = p++;
+      else
+       p++;
+    }
+  lastchar++;
+  *lastchar = '\0';
+  if (p == s || strlen(s) == 0)
+    return NULL;
+
+  if (!(m = malloc(sizeof(struct owner_type))))
+    return NULL;
+
+  if ((p = strchr(s, ':')))
+    {
+      *p = '\0';
+      m->name = ++p;
+      if (!strcasecmp("user", s))
+       m->type = M_USER;
+      else if (!strcasecmp("list", s))
+       m->type = M_LIST;
+      else if (!strcasecmp("kerberos", s))
+       m->type = M_KERBEROS;
+      else if (!strcasecmp("none", s))
+       m->type = M_NONE;
+      else
+       {
+         m->type = M_ANY;
+         *(--p) = ':';
+         m->name = s;
+       }
+      m->name = strdup(m->name);
+    }
+  else
+    {
+      m->name = strdup(s);
+      m->type = strcasecmp(s, "none") ? M_ANY : M_NONE;
+    }
+  return m;
+}
index 763f05d7d1725a2ccbd62d8daeeeb27225b93e62..27c02557201805b81801c49956ae0ed1ac5664ba 100644 (file)
@@ -50,7 +50,9 @@ create table users
        created         DATE            DEFAULT SYSDATE NOT NULL,
        creator         INTEGER         DEFAULT 0       NOT NULL,
        winhomedir      VARCHAR(260)    DEFAULT '[DFS]' NOT NULL,
-       winprofiledir   VARCHAR(260)    DEFAULT '[DFS]' NOT NULL
+       winprofiledir   VARCHAR(260)    DEFAULT '[DFS]' NOT NULL,
+       sponsor_type    VARCHAR(8)      DEFAULT 'NONE'  NOT NULL,
+       sponsor_id      INTEGER         DEFAULT 0       NOT NULL
 );
 
 create table krbmap
index 1d99c2d9214066b5d37f468f1c9ee8cb896e0115..e2fa764dd0084a175550414680e8111dedb5436a 100644 (file)
 #define U_SECURE  12
 #define U_WINHOMEDIR 13
 #define U_WINPROFILEDIR 14
-#define U_MODTIME 15
-#define U_MODBY   16
-#define U_MODWITH 17
-#define U_CREATED 18
-#define U_CREATOR 19
-#define U_END     20
+#define U_SPONSOR_TYPE 15
+#define U_SPONSOR_NAME 16
+#define U_MODTIME 17
+#define U_MODBY   18
+#define U_MODWITH 19
+#define U_CREATED 20
+#define U_CREATOR 21
+#define U_END     22
 
 /* User states (the value of argv[U_STATE] from a user query) */
 
index 5e6d5e1ac06629f9e636e3ab932c4b6b6cf99d39..5aef0509e8676d95157413af53c4726c5b06f45b 100644 (file)
@@ -68,7 +68,7 @@ void process_entry(struct entry *e, int secure)
   char ophone[USERS_OFFICE_PHONE_SIZE], dept[USERS_DEPARTMENT_SIZE];
   char haddr[USERS_HOME_ADDR_SIZE], hphone[USERS_HOME_PHONE_SIZE];
   char dfirst[USERS_FIRST_SIZE], dlast[USERS_LAST_SIZE];
-  char dmiddle[USERS_MIDDLE_SIZE];
+  char dmiddle[USERS_MIDDLE_SIZE], fullname[USERS_FULLNAME_SIZE];
   int id, status, fmodby, xnlen = USERS_XNAME_SIZE - 1;
   EXEC SQL END DECLARE SECTION;
 
@@ -86,9 +86,9 @@ void process_entry(struct entry *e, int secure)
 
   /* Get user info */
   EXEC SQL SELECT users_id, first, last, middle, type, office_addr,
-    office_phone, home_addr, home_phone, department, status, fmodby
+    office_phone, home_addr, home_phone, fullname, department, status, fmodby
     INTO :id, :dfirst, :dlast, :dmiddle, :type, :oaddr,
-    :ophone, :haddr, :hphone, :dept, :status, :fmodby
+    :ophone, :haddr, :hphone, :fullname, :dept, :status, :fmodby
     FROM users
     WHERE clearid = :sid AND status != 3;
   if (sqlfail())
@@ -203,6 +203,15 @@ void process_entry(struct entry *e, int secure)
       strlcpy(dept, e->dept, USERS_DEPARTMENT_SIZE);
     }
 
+  if (strncmp(strtrim(fullname), e->name, USERS_FULLNAME_SIZE - 1) &&
+      (*fullname || fmodby != id))
+    {
+      changed++;
+      com_err(whoami, 0, "Fullname for %s %s changed from \"%s\" to \"%s\"",
+             first, last, fullname, e->name);
+      strlcpy(fullname, e->name, USERS_FULLNAME_SIZE);
+    }
+
   if (changed)
     {
       com_err(whoami, 0, "updating finger for %s %s", first, last);
@@ -210,8 +219,8 @@ void process_entry(struct entry *e, int secure)
        SET office_addr = NVL(:oaddr, CHR(0)),
        office_phone = NVL(:ophone, CHR(0)), home_addr = NVL(:haddr, CHR(0)),
        home_phone = NVL(:hphone, CHR(0)), department = NVL(:dept, CHR(0)),
-       fmodtime = SYSDATE, fmodby = :who, fmodwith = :prog,
-       xname = NVL(SUBSTR(:name, 0, :xnlen), CHR(0)),
+       fullname = NVL(:fullname, CHR(0)), fmodtime = SYSDATE, fmodby = :who,
+       fmodwith = :prog, xname = NVL(SUBSTR(:name, 0, :xnlen), CHR(0)),
        xdept = NVL(:dept, CHR(0)), xtitle = NVL(:xtitle, CHR(0)),
        xaddress = NVL(:xaddr, CHR(0)), xphone1 = NVL(:xphone1, CHR(0)),
        xphone2 = NVL(:xphone2, CHR(0)), xmodtime = SYSDATE
@@ -281,7 +290,7 @@ void newuser(struct entry *e, int secure)
      department, home_addr, home_phone, office_addr, office_phone, fmodtime,
      fmodby, fmodwith, potype, pmodtime, pmodby, pmodwith,
      xname, xdept, xtitle, xaddress, xphone1, xphone2, xmodtime, secure,
-     created, creator, winhomedir, winprofiledir)
+     created, creator, winhomedir, winprofiledir, sponsor_type, sponsor_id)
     VALUES (:login, :users_id, :uid, '/bin/athena/tcsh', 'cmd',
            NVL(:last, CHR(0)), NVL(:first, CHR(0)), NVL(:middle, CHR(0)),
            :st, NVL(:id, CHR(0)), NVL(:type, CHR(0)), SYSDATE, :who, :prog,
@@ -292,7 +301,7 @@ void newuser(struct entry *e, int secure)
            NVL(SUBSTR(:name, 0, :xnlen), CHR(0)), NVL(:dept, CHR(0)),
            NVL(:xtitle, CHR(0)), NVL(:xaddress, CHR(0)),
            NVL(:xphone1, CHR(0)), NVL(:xphone2, CHR(0)), SYSDATE, :issecure,
-           SYSDATE, :who, '[DFS]', '[DFS]');
+           SYSDATE, :who, '[DFS]', '[DFS]', 'NONE', 0);
   if (sqlca.sqlcode)
     {
       dbmserr("adding user", sqlca.sqlcode);
index b4637c3e746f23daac15fb15dd3f8820108326cf..c70bd84bb4cc668c37d668271b8d5e5329b13e3f 100644 (file)
@@ -262,6 +262,9 @@ int get_ace_use(struct query *q, char **argv, client *cl,
                int (*action)(int, char *[], void *), void *actarg);
 int get_host_by_owner(struct query *q, char **argv, client *cl,
                int (*action)(int, char *[], void *), void *actarg);
+int get_user_account_by_sponsor(struct query *q, char **argv, client *cl,
+                               int (*action)(int, char *[], void *),
+                               void *actarg);
 int qualified_get_lists(struct query *q, char **argv, client *cl,
                        int (*action)(int, char *[], void *), void *actarg);
 int get_members_of_list(struct query *q, char **argv, client *cl,
index 46ea2da9db9fa554907731ab1757c23dc91d7d5d..5a84ba349d6300f5c965ecd84fe17a168cc83a29 100644 (file)
@@ -1045,6 +1045,13 @@ int followup_get_user(struct query *q, struct save_queue *sq, struct
       if (status && status != MR_NO_MATCH)
        return status;
 
+      if (q->version > 11)
+       {
+         status = fix_ace(argv[15], &argv[16]);
+         if (status && status != MR_NO_MATCH)
+           return status;
+       }
+
       (*action)(q->vcnt, argv, actarg);
       for (k = 0; k < q->vcnt; k++)
        free(argv[k]);
@@ -1053,7 +1060,3 @@ int followup_get_user(struct query *q, struct save_queue *sq, struct
   sq_destroy(sq);
   return MR_SUCCESS;
 }
-
-
-
-
index 33c6163cd9b4b62ecbd8a89c268285b23ee77007..72870059d761089c6df7d58ebcf23bd11d607ffb 100644 (file)
@@ -1074,6 +1074,152 @@ int get_host_by_owner(struct query *q, char *argv[], client *cl,
   return MR_SUCCESS;
 }
 
+int guas_internal(char *atype, int aid,
+                 int (*action)(int, char *[], void *), void *actarg)
+{
+  char *rargv[1];
+  int found = 0;
+  EXEC SQL BEGIN DECLARE SECTION;
+  char login[USERS_LOGIN_SIZE], *type = atype;
+  int id = aid;
+  EXEC SQL END DECLARE SECTION;
+
+  rargv[0] = login;
+  EXEC SQL DECLARE csr115sp CURSOR FOR
+    SELECT login FROM users u
+    WHERE u.sponsor_type = :type
+    AND u.sponsor_id = :id;
+  if (dbms_errno)
+    return mr_errcode;
+  EXEC SQL OPEN csr115sp;
+  if (dbms_errno)
+    return mr_errcode;
+  while (1)
+    {
+      EXEC SQL FETCH csr115sp INTO :login;
+      if (sqlca.sqlcode)
+       break;
+      (*action)(1, rargv, actarg);
+      found++;
+    }
+  EXEC SQL CLOSE csr115sp;
+  
+  if (!found)
+    return MR_NO_MATCH;
+  return MR_SUCCESS;
+}
+
+/* get_user_account_by_sponsor - like gaus but limited to user accounts */
+int get_user_account_by_sponsor(struct query *q, char *argv[], client *cl,
+                               int (*action)(int, char *[], void *),
+                               void *actarg)
+{
+  int found = 0;
+  EXEC SQL BEGIN DECLARE SECTION;
+  char *atype;
+  int aid, listid, id;
+  EXEC SQL END DECLARE SECTION;
+  struct save_queue *sq;
+
+  atype = argv[0];
+  aid = *(int *)argv[1];
+  if (!strcmp(atype, "LIST") || !strcmp(atype, "USER") ||
+      !strcmp(atype, "KERBEROS"))
+    return guas_internal(atype, aid, action, actarg);
+
+  sq = sq_create();
+  if (!strcmp(atype, "RLIST"))
+    {
+      sq_save_data(sq, (void *)aid);
+      /* get all the list_id's of containing lists */
+      EXEC SQL DECLARE csr107sp CURSOR FOR
+       SELECT list_id FROM imembers
+       WHERE member_type = 'LIST' AND member_id = :aid;
+      if (dbms_errno)
+       return mr_errcode;
+      EXEC SQL OPEN csr107sp;
+      if (dbms_errno)
+       return mr_errcode;
+      while (1)
+       {
+         EXEC SQL FETCH csr107sp INTO :listid;
+         if (sqlca.sqlcode)
+           break;
+         sq_save_unique_data(sq, (void *)listid);
+       }
+      EXEC SQL CLOSE csr107sp;
+      /* now process each one */
+      while (sq_get_data(sq, &id))
+       {
+         if (guas_internal("LIST", id, action, actarg) == MR_SUCCESS)
+           found++;
+       }
+    }
+
+  if (!strcmp(atype, "RUSER"))
+    {
+      EXEC SQL DECLARE csr108sp CURSOR FOR
+       SELECT list_id FROM imembers
+       WHERE member_type = 'USER' AND member_id = :aid;
+      if (dbms_errno)
+       return mr_errcode;
+      EXEC SQL OPEN csr108sp;
+      if (dbms_errno)
+       return mr_errcode;
+      while (1)
+       {
+         EXEC SQL FETCH csr108sp INTO :listid;
+         if (sqlca.sqlcode)
+           break;
+         sq_save_data(sq, (void *)listid);
+       }
+      EXEC SQL CLOSE csr108sp;
+      /* now process each one */
+      while (sq_get_data(sq, &id))
+       {
+         if (guas_internal("LIST", id, action, actarg) == MR_SUCCESS)
+           found++;
+       }
+      if (guas_internal("USER", aid, action, actarg) == MR_SUCCESS)
+       found++;
+    }
+
+  if (!strcmp(atype, "RKERBEROS"))
+    {
+      EXEC SQL DECLARE csr109sp CURSOR FOR
+       SELECT list_id FROM imembers
+       WHERE member_type = 'KERBEROS' AND member_id = :aid;
+      if (dbms_errno)
+       return mr_errcode;
+      EXEC SQL OPEN csr109sp;
+      if (dbms_errno)
+       return mr_errcode;
+      while (1)
+       {
+         EXEC SQL FETCH csr109sp INTO :listid;
+         if (sqlca.sqlcode)
+           break;
+         sq_save_data(sq, (void *)listid);
+       }
+      EXEC SQL CLOSE csr109sp;
+      /* now process each one */
+      while (sq_get_data(sq, &id))
+       {
+         if (guas_internal("LIST", id, action, actarg) == MR_SUCCESS)
+           found++;
+       }
+      if (guas_internal("KERBEROS", aid, action, actarg) == MR_SUCCESS)
+       found++;
+    }
+
+  sq_destroy(sq);
+  if (dbms_errno)
+    return mr_errcode;
+  if (!found)
+    return MR_NO_MATCH;
+  return MR_SUCCESS;
+}
+
 /* get_lists_of_member - given a type and a name, return the name and flags
  * of all of the lists of the given member.  The member_type is one of
  * "LIST", "USER", "STRING", "KERBEROS", "MACHINE", "RLIST", "RUSER", 
index f0f58061c1d6d88e2c01182f7a10c3de86d7d5e4..1a26a7bd8871f791be9e8fea48bb4ce159bf0d0c 100644 (file)
@@ -93,7 +93,7 @@ static char *gual3_fields[] = {
   "modby", "modwith", "created", "creator",
 };
 
-static char *gual_fields[] = {
+static char *gual11_fields[] = {
   "login",
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure",
@@ -101,6 +101,14 @@ static char *gual_fields[] = {
   "creator",
 };
 
+static char *gual_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "modtime",
+  "modby", "modwith", "created", "creator",
+};
+
 static char *gubl2_fields[] = {
   "login",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
@@ -154,7 +162,7 @@ static char *guau3_fields[] = {
   "modtime", "modby", "modwith", "created", "creator",
 };
 
-static char *guau_fields[] = {
+static char *guau11_fields[] = {
   "unix_uid",
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure", 
@@ -162,6 +170,14 @@ static char *guau_fields[] = {
   "creator",
 };
 
+static char *guau_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure", 
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "modtime",
+  "modby", "modwith", "created", "creator",
+};
+
 static char *guan2_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
@@ -176,7 +192,7 @@ static char *guan3_fields[] = {
   "modtime", "modby", "modwith", "created", "creator",
 };
 
-static char *guan_fields[] = {
+static char *guan11_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure",
@@ -184,6 +200,14 @@ static char *guan_fields[] = {
   "creator",
 };
 
+static char *guan_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "modtime",
+  "modby", "modwith", "created", "creator",
+};
+
 static struct validate guan2_validate =
 {
   0,
@@ -224,7 +248,7 @@ static char *guac3_fields[] = {
   "modtime", "modby", "modwith", "created", "creator",
 };
 
-static char *guac_fields[] = {
+static char *guac11_fields[] = {
   "class",
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure",
@@ -232,6 +256,14 @@ static char *guac_fields[] = {
   "creator",
 };
 
+static char *guac_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "modtime",
+  "modby", "modwith", "created", "creator",
+};
+
 static char *guam2_fields[] = {
   "clearid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
@@ -246,7 +278,7 @@ static char *guam3_fields[] = {
   "modtime", "modby", "modwith", "created", "creator", 
 };
 
-static char *guam_fields[] = {
+static char *guam11_fields[] = {
   "clearid",
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure",
@@ -254,6 +286,36 @@ static char *guam_fields[] = {
   "creator", 
 };
 
+static char *guam_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "modtime", 
+  "modby", "modwith", "created", "creator", 
+};
+
+static char *guas_fields[] = {
+  "sponsor_type", "sponsor_name",
+  "login",
+};
+
+static struct valobj guas_valobj[] = {
+  {V_TYPE, 0, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 1, 0, "list_id", 0, MR_ACE},
+};
+
+static struct validate guas_validate = {
+  guas_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  access_member,
+  0,
+  get_user_account_by_sponsor,
+};
+
 static char *gubu2_fields[] = {
   "unix_uid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
@@ -368,12 +430,18 @@ static char *auac3_fields[] = {
   "middle", "status", "clearid", "class", "comments", "signature", "secure",
 };
 
-static char *auac_fields[] = {
+static char *auac11_fields[] = {
   "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
   "status", "clearid", "class", "comments", "signature", "secure",
   "winhomedir", "winprofiledir",
 };
 
+static char *auac_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name",
+};
+
 static struct valobj auac2_valobj[] = {
   {V_CHAR, 0, USERS_TABLE, "login"},
   {V_NUM, 1},
@@ -403,6 +471,23 @@ static struct valobj auac3_valobj[] = {
   {V_NUM, 12},
 };
 
+static struct valobj auac11_valobj[] = {
+  {V_CHAR, 0, USERS_TABLE, "login"},
+  {V_NUM, 1},
+  {V_CHAR, 2, USERS_TABLE, "shell"},
+  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 4, USERS_TABLE, "last"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "middle"},
+  {V_NUM, 7},
+  {V_CHAR, 8, USERS_TABLE, "clearid"},
+  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 12},
+  {V_LEN, 13, USERS_TABLE, "winhomedir"},
+  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
+};
+
 static struct valobj auac_valobj[] = {
   {V_CHAR, 0, USERS_TABLE, "login"},
   {V_NUM, 1},
@@ -418,6 +503,8 @@ static struct valobj auac_valobj[] = {
   {V_NUM, 12},
   {V_LEN, 13, USERS_TABLE, "winhomedir"},
   {V_LEN, 14, USERS_TABLE, "winprofiledir"},
+  {V_TYPE, 15, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 16, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate auac2_validate = {
@@ -444,9 +531,21 @@ static struct validate auac3_validate = {
   followup_ausr,
 };
 
+static struct validate auac11_validate = {
+  auac11_valobj,
+  14,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
 static struct validate auac_validate = {
   auac_valobj,
-  14,
+  16,
   "login",
   "login = '%s'",
   1,
@@ -480,9 +579,21 @@ static struct validate ausr3_validate = {
   followup_ausr,
 };
 
+static struct validate ausr11_validate = {
+  auac11_valobj,
+  12,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
 static struct validate ausr_validate = {
   auac_valobj,
-  12,
+  14,
   "login",
   "login = '%s'",
   1,
@@ -525,13 +636,20 @@ static char *uuac3_fields[] = {
   "middle", "status", "clearid", "class", "comments", "signature", "secure",
 };
 
-static char *uuac_fields[] = {
+static char *uuac11_fields[] = {
   "login",
   "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
   "middle", "status", "clearid", "class", "comments", "signature", "secure",
   "winhomedir", "winprofiledir",
 };
 
+static char *uuac_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir, sponsor_type, sponsor_name",
+};
+
 static struct valobj uuac2_valobj[] = {
   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
   {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
@@ -563,6 +681,24 @@ static struct valobj uuac3_valobj[] = {
   {V_NUM, 13},
 };
 
+static struct valobj uuac11_valobj[] = {
+  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
+  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_CHAR, 3, USERS_TABLE, "shell"},
+  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "last"},
+  {V_CHAR, 7, USERS_TABLE, "middle"},
+  {V_NUM, 8},
+  {V_CHAR, 9, USERS_TABLE, "clearid"},
+  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 13},
+  {V_LEN, 14, USERS_TABLE, "winhomedir"},
+  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
+};
+
 static struct valobj uuac_valobj[] = {
   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
   {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
@@ -579,6 +715,8 @@ static struct valobj uuac_valobj[] = {
   {V_NUM, 13},
   {V_LEN, 14, USERS_TABLE, "winhomedir"},
   {V_LEN, 15, USERS_TABLE, "winprofiledir"},
+  {V_TYPE, 16, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 17, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate uuac2_validate = {
@@ -605,9 +743,21 @@ static struct validate uuac3_validate = {
   set_modtime_by_id,
 };
 
+static struct validate uuac11_validate = {
+  uuac11_valobj,
+  15,
+  0,
+  0,
+  0,
+  "users_id",
+  access_update_user,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
 static struct validate uuac_validate = {
   uuac_valobj,
-  15,
+  17,
   0,
   0,
   0,
@@ -641,9 +791,21 @@ static struct validate uusr3_validate = {
   set_modtime_by_id,
 };
 
+static struct validate uusr11_validate = {
+  uuac11_valobj,
+  13,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
 static struct validate uusr_validate = {
   uuac_valobj,
-  13,
+  15,
   0,
   0,
   0,
@@ -3900,7 +4062,7 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
-    gual_fields,
+    gual11_fields,
     20,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -3908,6 +4070,23 @@ struct query Queries[] = {
     &gubl_validate,
   },
 
+  {
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v12 */
+    "get_user_account_by_login",
+    "gual",
+    12,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    gual_fields,
+    22,
+    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubl_validate,
+  },
+
   {
     /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v2 */
     "get_user_account_by_uid",
@@ -3951,7 +4130,7 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
-    guau_fields,
+    guau3_fields,
     20,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -3959,6 +4138,23 @@ struct query Queries[] = {
     &gubu_validate,
   }, 
 
+  {
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v12 */
+    "get_user_account_by_uid",
+    "guau",
+    12,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guau_fields,
+    22,
+    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubu_validate,
+  }, 
+
   {
     /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v2 */
     "get_user_account_by_name",
@@ -4002,7 +4198,7 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
-    guan_fields,
+    guan11_fields,
     20,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4010,6 +4206,23 @@ struct query Queries[] = {
     &guan_validate,
   },
 
+  {
+    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v12 */
+    "get_user_account_by_name",
+    "guan",
+    12,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guan_fields,
+    22,
+    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
+    2,
+    "u.login",
+    &guan_validate,
+  },
+
   {
     /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v2 */
     "get_user_account_by_class",
@@ -4053,7 +4266,7 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
-    guac_fields,
+    guac11_fields,
     20,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4061,6 +4274,23 @@ struct query Queries[] = {
     &guan_validate,
   },
 
+  {
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v12 */
+    "get_user_account_by_class",
+    "guac",
+    12,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guac_fields,
+    22,
+    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
   {
     /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v2 */
     "get_user_account_by_id",
@@ -4104,7 +4334,7 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
-    guam_fields,
+    guam11_fields,
     20,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4112,6 +4342,40 @@ struct query Queries[] = {
     &guan_validate,
   },
 
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v12 */
+    "get_user_account_by_id",
+    "guai",
+    12,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guam_fields,
+    22,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAS - GET_USER_ACCOUNT_BY_SPONSOR, v12 */
+    "get_user_account_by_sponsor",
+    "guas",
+    12,
+    RETRIEVE,
+    0,
+    0,
+    0,
+    guas_fields,
+    1,
+    0,
+    2,
+    NULL,
+    &guas_validate,
+  },
+
   {
     /* Q_GUBL - GET_USER_BY_LOGIN, v2 */
     "get_user_by_login",
@@ -4334,11 +4598,31 @@ struct query Queries[] = {
      * but using up one argv element.
      */
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
-    auac_fields,
+    auac11_fields,
     15,
     NULL,
     0,
     NULL,
+    &auac11_validate,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v12 */  /* uses prefetch_value() for users_id */
+    "add_user_account",
+    "auac",
+    12,
+    APPEND,
+    "u",
+    USERS_TABLE,
+    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
+     * but using up one argv element.
+     */
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, %s, SYSDATE, %s)",
+    auac_fields,
+    17,
+    NULL,
+    0,
+    NULL,
     &auac_validate,
   },
 
@@ -4385,11 +4669,28 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
-    auac_fields,
+    auac11_fields,
     12,
     0,
     0,
     NULL,
+    &ausr11_validate,
+  },
+
+  {
+    /* Q_AUSR - ADD_USER, v12 */  /* uses prefetch_value() for users_id */
+    "add_user",
+    "ausr",
+    12,
+    APPEND,
+    "u",
+    USERS_TABLE,
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, %s, SYSDATE, %s)",
+    auac_fields,
+    14,
+    0,
+    0,
+    NULL,
     &ausr_validate,
   },
 
@@ -4456,11 +4757,29 @@ struct query Queries[] = {
     USERS_TABLE,
     /* See comment in auac about signature. */
     "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s, winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0))",
-    uuac_fields,
+    uuac11_fields,
     15,
     "users_id = %d",
     1,
     NULL,
+    &uuac11_validate,
+  },
+
+  {
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v12 */
+    "update_user_account",
+    "uuac",
+    12,
+    UPDATE,
+    "u",
+    USERS_TABLE,
+    /* See comment in auac about signature. */
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s, winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d",
+    uuac_fields,
+    17,
+    "users_id = %d",
+    1,
+    NULL,
     &uuac_validate,
   },
 
@@ -4507,8 +4826,25 @@ struct query Queries[] = {
     "u",
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)) ",
-    uuac_fields,
+    uuac11_fields,
+    12,
+    "users_id = %d",
+    1,
+    NULL,
+    &uusr11_validate,
+  },
+
+  {
+    /* Q_UUSR - UPDATE_USER, v12 */
+    "update_user",
+    "uusr",
     12,
+    UPDATE,
+    "u",
+    USERS_TABLE,
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d ",
+    uuac_fields,
+    14,
     "users_id = %d",
     1,
     NULL,
This page took 0.976815 seconds and 5 git commands to generate.