[2011] in Moira Commits

home help back first fref pref prev next nref lref last post

/svn/moira r4152 - in trunk/moira: clients/moira clients/stella man server

daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Wed Dec 11 09:01:49 2013

Date: Wed, 11 Dec 2013 09:01:40 -0500
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201312111401.rBBE1eo6008956@drugstore.mit.edu>
To: moira-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: zacheiss
Date: 2013-12-11 09:01:40 -0500 (Wed, 11 Dec 2013)
New Revision: 4152

Modified:
   trunk/moira/clients/moira/cluster.c
   trunk/moira/clients/moira/f_defs.h
   trunk/moira/clients/moira/menus.c
   trunk/moira/clients/stella/stella.c
   trunk/moira/man/stella.1
   trunk/moira/server/mr_server.h
   trunk/moira/server/qaccess.pc
   trunk/moira/server/qrtn.pc
   trunk/moira/server/qsubs.c
   trunk/moira/server/qsupport.pc
   trunk/moira/server/queries2.c
   trunk/moira/server/query.h
Log:
New DHCP stuff.

Modified: trunk/moira/clients/moira/cluster.c
===================================================================
--- trunk/moira/clients/moira/cluster.c	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/clients/moira/cluster.c	2013-12-11 14:01:40 UTC (rev 4152)
@@ -253,6 +253,14 @@
     Put_message("");
 }
 
+void PrintDynamicHost(char **info)
+{
+  char buf[256];
+
+  sprintf(buf, "Assigned dynamic hostname: %s\n", info[0]);
+  Put_message(buf);
+}
+
 /*	Function Name: PrintMachInfo
  *	Description: This function Prints out the Machine info in
  *                   a coherent form.
@@ -2756,3 +2764,36 @@
  
   return DM_NORMAL;
 }
+
+int AddDynamicHost(int argc, char **argv)
+{
+  char buf[BUFSIZ], *type, *name, *args[2];
+  struct mqelem *elem = NULL;
+  int status;
+
+  type = strdup("USER");
+  if (GetTypeFromUser("Type of owner", "search_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;
+
+  args[0] = type;
+  args[1] = name;
+
+  if ((status = do_mr_query("add_dynamic_host_record", 2, args, StoreInfo, &elem)))
+    {
+      com_err(program_name, status, " in add_dynamic_host_record");
+      return DM_NORMAL;
+    }
+
+  Loop(QueueTop(elem), (void (*)(char **)) PrintDynamicHost);
+  FreeQueue(elem);
+
+  free(type);
+  free(name);
+
+  return DM_NORMAL;
+}

Modified: trunk/moira/clients/moira/f_defs.h
===================================================================
--- trunk/moira/clients/moira/f_defs.h	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/clients/moira/f_defs.h	2013-12-11 14:01:40 UTC (rev 4152)
@@ -53,6 +53,7 @@
 int DeleteMachine(int argc, char **argv);
 int SetMachineOpt(int argc, char **argv);
 int SetMachineTTL(int argc, char **argv);
+int AddDynamicHost(int argc, char **argv);
 int MachineToClusterMap(int argc, char **argv);
 int AddMachineToCluster(int argc, char **argv);
 int RemoveMachineFromCluster(int argc, char **argv);

Modified: trunk/moira/clients/moira/menus.c
===================================================================
--- trunk/moira/clients/moira/menus.c	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/clients/moira/menus.c	2013-12-11 14:01:40 UTC (rev 4152)
@@ -534,7 +534,7 @@
   NULLFUNC,
   NULLFUNC,
   "Machine Menu",
-  12,
+  13,
   {
     { ShowMachineInfo, NULLMENU, 2, {
       {"show", "Get machine information"},
@@ -573,6 +573,7 @@
       {"setttl", "Set DNS TTL for this machine"},
       {"name", "Machine's Name: "},
     } },
+    SIMPLEFUNC("dynamic", "Assign a dynamic host record", AddDynamicHost),
   }
 };
 

Modified: trunk/moira/clients/stella/stella.c
===================================================================
--- trunk/moira/clients/stella/stella.c	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/clients/stella/stella.c	2013-12-11 14:01:40 UTC (rev 4152)
@@ -65,6 +65,7 @@
 int list_container_flag, update_container_flag, unformatted_flag;
 int list_hwaddr_flag, update_hwaddr_flag;
 int set_host_opt_flag, set_ttl_flag;
+int add_dynamic_host_flag;
 
 struct string_list *alias_add_queue, *alias_remove_queue;
 struct string_list *map_add_queue, *map_remove_queue;
@@ -87,11 +88,13 @@
 int show_machine_in_cluster(int argc, char **argv, void *hint);
 int show_machine_in_container(int argc, char **argv, void *hint);
 int show_host_hwaddrs(int argc, char **argv, void *hint);
+int show_dynamic_hostname(int argc, char **argv, void *hint);
 struct owner_type *parse_member(char *s);
 struct string_list *add_to_string_list(struct string_list *old_list, char *s);
 int wrap_mr_query(char *handle, int argc, char **argv,
 		  int (*callback)(int, char **, void *), void *callarg);
 void print_query(char *query_name, int argc, char **argv);
+char *get_username(void);
 
 int main(int argc, char **argv)
 {
@@ -104,7 +107,7 @@
   update_alias_flag = verbose = noauth = 0;
   list_container_flag = update_container_flag = 0;
   list_hwaddr_flag = update_hwaddr_flag = 0;
-  set_host_opt_flag = set_ttl_flag = 0;
+  set_host_opt_flag = set_ttl_flag = add_dynamic_host_flag = 0;
   newname = address = network = h_status = vendor = model = NULL;
   os = location = contact = billing_contact = account_number = adm_cmt = NULL;
   op_cmt = opt = NULL;
@@ -243,7 +246,9 @@
 	    } else
 	      usage(argv);
 	  }
-          /* This could be for either update_host or set_host_opt                                                                                                                                                                                       * Don't set any flags and take our cues from the other                                                                                                                                                                                       * arguments we're given.                                                                                                                                                                                                                     */
+          /* This could be for either update_host or set_host_opt *
+	     Don't set any flags and take our cues from the other *
+	     arguments we're given.  */
 	  else if (argis("oc", "opcmt")) {
 	    if (arg - argv < argc - 1) {
 	      arg++;
@@ -347,6 +352,15 @@
 	  }
 	  else if (argis("lhw", "listhwaddr"))
 	    list_hwaddr_flag++;
+	  else if (argis("adh", "adddynamic")) {
+	    add_dynamic_host_flag++;
+            if (arg - argv < argc - 1) {
+              arg++;
+              owner = parse_member(*arg);
+            } else {
+	      owner = parse_member(get_username());
+	    }
+	  }
 	  else if (argis("u", "unformatted"))
 	    unformatted_flag++;
 	  else if (argis("n", "noauth"))
@@ -371,7 +385,7 @@
       else
 	usage(argv);
     }
-  if (hostname == NULL)
+  if (hostname == NULL && !add_dynamic_host_flag)
     usage(argv);
 
   if (op_cmt && !set_host_opt_flag)
@@ -382,10 +396,21 @@
        delete_flag || list_map_flag || update_map_flag || \
        update_alias_flag || update_container_flag || \
        list_container_flag || update_hwaddr_flag || \
-       list_hwaddr_flag || set_host_opt_flag || set_ttl_flag)) {
+       list_hwaddr_flag || set_host_opt_flag || set_ttl_flag || \
+       add_dynamic_host_flag)) {
     info_flag++;
   }
 
+  if (add_dynamic_host_flag && (info_flag || update_flag || create_flag || \
+				delete_flag || list_map_flag || update_map_flag || \
+				update_alias_flag || update_container_flag || \
+				list_container_flag || update_hwaddr_flag || \
+				list_hwaddr_flag || set_host_opt_flag || set_ttl_flag))
+    {
+      com_err(whoami, 0, "-adh / -adddynamic option must be the only argument provided.");
+      exit(1);
+    }
+
   /* fire up Moira */
   status = mrcl_connect(server, "stella", 9, !noauth);
   if (status == MRCL_AUTH_ERROR)
@@ -397,20 +422,23 @@
     exit(2);
 
   /* Perform the lookup by IP address if that's what we've been handed */
-  if ((ipaddress=inet_addr(hostname)) != -1) {
-    char *args[5];
-    char *argv[30];
-
-    args[1] = strdup(hostname);
-    args[0] = args[2] = args[3] = "*";
-    status = wrap_mr_query("get_host", 4, args, store_host_info, argv);
-
-    if (status) {
-      com_err(whoami, status, "while looking up IP address.");
-    } else {
-      hostname = argv[0];
+  if (hostname)
+    {
+      if ((ipaddress=inet_addr(hostname)) != -1) {
+	char *args[5];
+	char *argv[30];
+	
+	args[1] = strdup(hostname);
+	args[0] = args[2] = args[3] = "*";
+	status = wrap_mr_query("get_host", 4, args, store_host_info, argv);
+	
+	if (status) {
+	  com_err(whoami, status, "while looking up IP address.");
+	} else {
+	  hostname = argv[0];
+	}
+      }
     }
-  }
 
   /* create if needed */
   if (create_flag)
@@ -908,6 +936,46 @@
     }
   }
 
+  if (add_dynamic_host_flag) {
+    char *argv[2];
+
+    argv[1] = owner->name;
+    switch (owner->type)
+      {
+      case M_ANY:
+      case M_USER:
+	argv[0] = "USER";
+	status = wrap_mr_query("add_dynamic_host_record", 2, argv, show_dynamic_hostname, NULL);
+	if (owner->type != M_ANY || status != MR_USER)
+	  break;
+
+      case M_LIST:
+	argv[0] = "LIST";
+	status = wrap_mr_query("add_dynamic_host_record", 2, argv, show_dynamic_hostname, NULL);
+	break;
+
+      case M_KERBEROS:
+	argv[0] = "KERBEROS";
+	status = mrcl_validate_kerberos_member(argv[2], &argv[2]);
+	if (mrcl_get_message())
+	  mrcl_com_err(whoami);
+	if (status == MRCL_REJECT)
+	  exit(1);
+	status = wrap_mr_query("add_dynamic_host_record", 2, argv, show_dynamic_hostname, NULL);
+	break;
+
+      case M_NONE:
+	argv[0] = "NONE";
+	status = wrap_mr_query("add_dynamic_host_record", 2, argv, show_dynamic_hostname, NULL);
+	break;
+      }
+
+    if (status) {
+      com_err(whoami, status, "while adding dynamic host");
+      exit(1);
+    }
+  }
+
   /* We're done! */
   mr_disconnect();
   exit(success ? 0 : 1);
@@ -952,7 +1020,8 @@
 	  "-oi  | -optin");
   fprintf(stderr,  USAGE_OPTIONS_FORMAT, "-oo  | -optout",
 	  "-ttl | -setttl ttl");
-  fprintf(stderr, "  %-39s\n", "-db  | -database host[:port]");
+  fprintf(stderr, USAGE_OPTIONS_FORMAT, "-adh | -adddynamic owner",
+	  "-db  | -database host[:port]");
   exit(1);
 }
 
@@ -1000,6 +1069,14 @@
   return MR_CONT;
 }
 
+/* Show assigned dynamic hostname */
+int show_dynamic_hostname(int argc, char **argv, void *hint)
+{
+  printf("Assigned dynamic hostname: %s\n", argv[0]);
+
+  return MR_CONT;
+}
+
 static char *states[] = {
   "Reserved (0)",
   "Active (1)",
@@ -1234,3 +1311,20 @@
     printf(" <%s>", argv[cnt]);
   printf("\n");
 }
+
+char *get_username(void)
+{
+  char *username;
+
+  username = getenv("USER");
+  if (!username)
+    {
+      username = mrcl_krb_user();
+      if (!username)
+        {
+          com_err(whoami, 0, "Could not determine username");
+          exit(1);
+        }
+    }
+  return username;
+}

Modified: trunk/moira/man/stella.1
===================================================================
--- trunk/moira/man/stella.1	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/man/stella.1	2013-12-11 14:01:40 UTC (rev 4152)
@@ -102,6 +102,10 @@
 with the reason for the opt-out.
 .IP \fB-ttl\ \fIttl\ \fRor\ \fB-setttl\ \fIttl\fR
 Set the DNS TTL for the specified host to \fIttl\fR.
+.IP \fB-adh\ \fIowner\ \fRor\ \fB-adddynamic\ \fIowner\fR
+Assign a dynamic host record owned by \fIowner\fR.  The name assigned
+will be printed upon successful completion.  This field is mutually exclusive
+with all other operations.
 .IP \fB-unformatted\ \fRor\ \fB-u\fR
 Display host information with each field on a seperate line, in the 
 form "fieldname: value".
@@ -129,7 +133,7 @@
 This will rename the given host to \fInewname\fR.
 
 .SH AUTHORS
-Nickolai Zeldovich.
+Nickolai Zeldovich, Garry Zacheiss.
 .SH SEE ALSO
 moira(1)
 

Modified: trunk/moira/server/mr_server.h
===================================================================
--- trunk/moira/server/mr_server.h	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/mr_server.h	2013-12-11 14:01:40 UTC (rev 4152)
@@ -111,7 +111,7 @@
 char *build_qual(char *fmt, int argc, char *argv[]);
 
 
-/* prototyoes from qsupport.dc */
+/* prototypes from qsupport.dc */
 int set_pop_usage(int id, int cnt);
 
 /* prototypes from qvalidate.dc */
@@ -161,6 +161,7 @@
 int access_filesys(struct query *q, char *argv[], client *cl);
 int access_shot(struct query *q, char *argv[], client *cl);
 int access_host(struct query *q, char *argv[], client *cl);
+int access_adhr(struct query *q, char *argv[], client *cl);
 int access_ahal(struct query *q, char *argv[], client *cl);
 int access_hwaddr(struct query *q, char *argv[], client *cl);
 int access_snt(struct query *q, char *argv[], client *cl);
@@ -310,6 +311,9 @@
 int get_incremental_queue_length(struct query *q, char **argv, client *cl,
 				 int (*action)(int, char *[], void *),
 				 void *actarg);
+int add_dynamic_host_record(struct query *q, char **argv, client *cl,
+                                 int (*action)(int, char *[], void *),
+                                 void *actarg);
 
 /* prototypes from qvalidate.pc */
 int validate_fields(struct query *q, char *argv[], struct valobj *vo, int n);

Modified: trunk/moira/server/qaccess.pc
===================================================================
--- trunk/moira/server/qaccess.pc	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/qaccess.pc	2013-12-11 14:01:40 UTC (rev 4152)
@@ -605,6 +605,99 @@
   return MR_PERM;
 }
 
+#define MAX_DHCP_REGISTRATIONS 100
+
+/* access_adhr */
+int access_adhr(struct query *q, char *argv[], client *cl)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  long listid;
+  int sid, count, id;
+  char stype[SUBNET_OWNER_TYPE_SIZE];
+  char affiliation[USERS_AFFILIATION_BASIC_SIZE];
+  EXEC SQL END DECLARE SECTION;
+  struct save_queue *sq;
+  int total_count = 0;
+
+  EXEC SQL SELECT s.owner_type, s.owner_id INTO :stype, :sid
+    FROM subnet s WHERE s.name = 'DHCP';
+  if (dbms_errno)
+    return mr_errcode;
+
+  /* subnet owner? */
+  if (find_member(stype, sid, cl))
+    return MR_SUCCESS;
+
+  /* Don't allow guest accounts to perform this action. */
+  EXEC SQL SELECT u.affiliation_basic INTO :affiliation
+    FROM USERS u WHERE u.users_id = :cl->users_id;
+  if (dbms_errno)
+    return mr_errcode;
+
+  if (!strcmp(affiliation, "affiliate"))
+    return MR_PERM;
+
+  if (!strcmp("USER", argv[0]) && *(int *)argv[1] != cl->users_id)
+    return MR_PERM;
+
+  if (!strcmp("LIST", argv[0]))
+    {
+      if (!find_member("LIST", *(int *)argv[1], cl))
+	return MR_PERM;
+    }
+
+  if (!strcmp("KERBEROS", argv[0]))
+    return MR_PERM;
+
+  /* Check DHCP registrations  and make sure it doesn't exceed maximum*/
+  EXEC SQL SELECT COUNT(*) INTO :count FROM machine m WHERE
+    m.snet_id = :sid AND m.owner_type = 'USER' AND m.owner_id = :cl->users_id
+    AND m.status = 1;
+  if (dbms_errno)
+    return mr_errcode;
+
+  total_count += count;
+
+  /* Check user's list memberships */
+  sq = sq_create();
+
+  EXEC SQL DECLARE csrl CURSOR FOR
+    SELECT list_id FROM imembers
+    WHERE member_type = 'USER' AND member_id = :cl->users_id;
+  if (dbms_errno)
+    return mr_errcode;
+
+  EXEC SQL OPEN csrl;
+  if (dbms_errno)
+    return mr_errcode;
+
+  while (1)
+    { 
+      EXEC SQL FETCH csrl INTO :listid;
+      if (sqlca.sqlcode)
+	break;
+      sq_save_data(sq, (void *)listid);
+    }
+  EXEC SQL CLOSE csrl;
+
+  while (sq_get_data(sq, &id))
+    {
+      EXEC SQL SELECT COUNT(*) INTO :count FROM machine m WHERE
+	m.snet_id = :sid AND m.owner_type = 'LIST' AND m.owner_id = :id
+	AND m.status = 1;
+      if (dbms_errno)
+	return mr_errcode;
+
+      total_count += count;
+    }
+
+  if (total_count > MAX_DHCP_REGISTRATIONS)
+    return MR_PERM;
+
+  return MR_SUCCESS;
+
+}  
+
 /* access_host - successful if owner of host, or subnet containing host
  */
 
@@ -633,6 +726,9 @@
       if (isdigit(argv[0][0]))
 	return MR_BAD_CHAR;
 
+      if (!strncasecmp(argv[0], "HOSTLESS-", 9))
+	  return MR_RESERVED;
+
       id = *(int *)argv[8 + idx];
       EXEC SQL SELECT s.owner_type, s.owner_id, s.status
 	INTO :stype, :sid, :subnet_status FROM subnet s
@@ -701,6 +797,10 @@
       if (isdigit(argv[1][0]) && strcmp(strtrim(name), argv[1]))
 	return MR_BAD_CHAR;
 
+      /* Or use reserved prefix */
+      if (!strncasecmp(argv[0], "HOSTLESS-", 9) && strcmp(strtrim(name), argv[1]))
+	return MR_RESERVED;
+
       if (find_member(stype, sid, cl))
 	{
 	  /* If moving to a new subnet, make sure user is on acl there */
@@ -798,6 +898,9 @@
   if (q->type == MR_Q_APPEND && isdigit(argv[0][0]))
     return MR_BAD_CHAR;
 
+  if (q->type == MR_Q_APPEND && !strncasecmp(argv[0], "HOSTLESS-", 9))
+    return MR_RESERVED;
+
   EXEC SQL SELECT count(name) INTO :cnt from hostalias WHERE mach_id = :id;
   if (dbms_errno)
     return mr_errcode;

Modified: trunk/moira/server/qrtn.pc
===================================================================
--- trunk/moira/server/qrtn.pc	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/qrtn.pc	2013-12-11 14:01:40 UTC (rev 4152)
@@ -321,7 +321,7 @@
 
       /* execute followup routine */
       if (v->post_rtn)
-	status = (*v->post_rtn)(q, Argv, cl);
+	status = (*v->post_rtn)(q, Argv, cl, action, actarg, cl);
       break;
 
     case MR_Q_DELETE:

Modified: trunk/moira/server/qsubs.c
===================================================================
--- trunk/moira/server/qsubs.c	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/qsubs.c	2013-12-11 14:01:40 UTC (rev 4152)
@@ -142,11 +142,16 @@
       sprintf(argr, "%s => %s", argv[--argcount], q->fields[q->argc]);
       argv[argcount++] = argr;
       if (q->vcnt > 1)
-	{
-	  for (i = q->argc + 1; i < q->vcnt + q->argc; i++)
-	    argv[argcount++] = q->fields[i];
-	}
+        {
+          for (i = q->argc + 1; i < q->vcnt + q->argc; i++)
+            argv[argcount++] = q->fields[i];
+        }
     }
+  else if (q->fields_count > (q->argc + q->vcnt))
+    {
+      sprintf(argr, "%s => %s", argv[--argcount], q->fields[q->argc + q->vcnt]);
+      argv[argcount++] = argr;
+    } 
   (*action)(argcount, argv, actarg);
 }
 

Modified: trunk/moira/server/qsupport.pc
===================================================================
--- trunk/moira/server/qsupport.pc	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/qsupport.pc	2013-12-11 14:01:40 UTC (rev 4152)
@@ -23,6 +23,7 @@
 
 extern char *whoami, *table_name[];
 extern int dbms_errno, mr_errcode;
+extern char *sqlbuffer[QMAXARGS];
 
 EXEC SQL BEGIN DECLARE SECTION;
 extern char stmt_buf[];
@@ -2519,3 +2520,89 @@
   
   return MR_SUCCESS;
 }
+
+int add_dynamic_host_record(struct query *q, char *argv[], client *cl,
+			    int (*action)(int, char *[], void *), void *actarg)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int sid, value, aid, mid;
+  char mname[MACHINE_NAME_SIZE];
+  char *atype;
+  EXEC SQL END DECLARE SECTION;
+  int starting_value;
+  char buffer[256];
+  char *rargv[1];
+
+  atype = argv[0];
+  aid = *(int *)argv[1];
+  mid = atoi(argv[2]);
+
+  EXEC SQL SELECT s.snet_id INTO :sid FROM subnet s WHERE s.name = 'DHCP';
+  if (dbms_errno)
+    return mr_errcode;
+
+  /* Can't use set_next_object_id() here because our incrementing counter is in
+   * the name, not a standalone field.
+   */
+
+  EXEC SQL SELECT value INTO :value FROM numvalues WHERE name = 'dynamic_host_id';
+  if (sqlca.sqlerrd[2] != 1)
+    return MR_NO_ID;
+
+  starting_value = value;
+  while (1)
+    {
+      sprintf(stmt_buf, "SELECT m.name FROM machine m WHERE m.name = 'HOSTLESS-DHCP-%d.MIT.EDU'",
+	      value);
+      dosql(sqlbuffer);
+      if (sqlca.sqlcode < 0)
+        return mr_errcode;
+
+      if (sqlca.sqlerrd[2] > 0)
+	{
+	  value++;
+	  continue;
+	}
+
+      sprintf(stmt_buf, "SELECT ha.name FROM hostalias ha WHERE ha.name = 'HOSTLESS-DHCP-%d.MIT.EDU'",
+	      value);
+      dosql(sqlbuffer);
+      if (sqlca.sqlcode < 0)
+	return mr_errcode;
+      if (sqlca.sqlerrd[2] > 0)
+	{
+	  value++;
+	  continue;
+	}
+      
+      break;
+    }
+
+  com_err(whoami, 0, "setting dynamic_host_id to %d", value);
+  EXEC SQL UPDATE numvalues SET value = :value WHERE name = 'dynamic_host_id';
+
+  sprintf(mname, "HOSTLESS-DHCP-%d.MIT.EDU", value);
+  com_err(whoami, 0, "setting dynamic host name to %s", mname);
+
+  incremental_clear_before();
+  EXEC SQL INSERT INTO machine (name, vendor, model, os, location, contact, billing_contact,
+				account_number, use, status, statuschange, snet_id, address, owner_type,
+				owner_id, acomment, ocomment, created, inuse, mach_id, creator)
+    VALUES (:mname, CHR(0), CHR(0), CHR(0), CHR(0), CHR(0), CHR(0), CHR(0), 0, 1, SYSDATE,
+	    :sid, 'unassigned', :atype, :aid, 0, 0, SYSDATE, TO_DATE('01-JAN-1970', 'DD-mon-YYYY'), :mid, :cl->client_id);
+  if (dbms_errno)
+    return mr_errcode;
+  if (sqlca.sqlerrd[2] != 1)
+    return MR_INTERNAL;
+  sprintf(buffer, "m.mach_id = %d", mid);
+  incremental_after(MACHINE_TABLE, buffer, 0);
+
+  EXEC SQL UPDATE machine SET modtime = SYSDATE, modby = :cl->client_id, modwith = :cl->entity WHERE mach_id = :mid;
+  if (dbms_errno)
+    return mr_errcode;
+
+  rargv[0] = mname;
+  (*action)(1, rargv, actarg);
+
+  return MR_SUCCESS;
+}

Modified: trunk/moira/server/queries2.c
===================================================================
--- trunk/moira/server/queries2.c	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/queries2.c	2013-12-11 14:01:40 UTC (rev 4152)
@@ -1310,6 +1310,10 @@
   set_pobox,
 };
 
+static char *spop_fields[] = {
+  "login",
+};
+
 static struct validate spop_validate =	/* SET_POBOX_POP */
 {
   VOuser0,
@@ -1541,6 +1545,28 @@
   set_uppercase_modtime,
 };
 
+static char *adhr_fields[] = {
+  "ace_type", "ace_name",
+  "name",
+};
+
+static struct valobj adhr_valobj[] = {
+  {V_TYPE, 0, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 1, 0, 0, 0, MR_ACE},
+};
+
+static struct validate adhr_validate = {
+  adhr_valobj,
+  2,
+  0,
+  0,
+  0,
+  "mach_id",
+  access_adhr,
+  prefetch_value,
+  add_dynamic_host_record,
+};
+
 static char *uhst2_fields[] = {
   "name",
   "newname", "vendor", "model", "os", "location", "contact", "use",
@@ -2056,6 +2082,10 @@
   "machine", "cluster",
 };
 
+static char *amcm_fields[] = {
+  "machine", "cluster",
+};
+
 static struct valobj amtc_valobj[] =	/* ADD_MACHINE_TO_CLUSTER */
 {					/* DELETE_MACHINE_FROM_CLUSTER */
   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
@@ -2156,6 +2186,10 @@
   followup_glin,
 };
 
+static char *exln_fields[] = {
+  "name", "name",
+};
+
 static char *alis2_fields[] = {
   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "ace_type", "ace_name", "description",
@@ -3073,6 +3107,10 @@
   "fsgroup", "filesys", "sortkey"
 };
 
+static char *rffg_fields[] = {
+  "fsgroup", "filesys",
+};
+
 static struct validate gfgm_validate = {
   VOfilesys0,
   1,
@@ -3125,6 +3163,10 @@
   followup_fix_modby,
 };
 
+static char *anfp_fields[] = {
+  "machine", "dir", "device", "status", "allocated", "size",
+};
+
 static struct valobj anfp_valobj[] = {
   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
   {V_CHAR, 1, NFSPHYS_TABLE, "dir"},
@@ -3241,6 +3283,10 @@
   "filesys", "type", "name", "quota",
 };
 
+static char *dqot_fields[] = {
+  "filesys", "type", "name", 
+};
+
 static struct valobj aqot_valobj[] = {
   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
   {V_TYPE, 1, 0, "quota_type", 0, MR_TYPE},
@@ -3305,13 +3351,16 @@
 static char *gnqp_fields[] = {
   "machine", "dir",
   "filesys", "login", "quota", "dir", "machine",
-  "modtime", "modby", "modwith",
 };
 
 static char *anfq_fields[] = {
   "filesys", "login", "quota",
 };
 
+static char *dnfq_fields[] = {
+  "filesys", "login",
+};
+
 static struct valobj anfq_valobj[] = {
   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
   {V_ID, 1, USERS_TABLE, "login", "users_id", MR_USER},
@@ -3503,6 +3552,10 @@
   set_zephyr_modtime,
 };
 
+static char *dzcl_fields[] = {
+  "class",
+};
+
 static struct validate dzcl_validate = {
   0,
   0,
@@ -3537,6 +3590,10 @@
   "machine", "ace_type", "ace_name",
 };
 
+static char *dsha_fields[] = {
+  "machine",
+};
+
 static struct valobj asha_valobj[] = {
   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
   {V_TYPE, 1, 0, "ace_type", 0, MR_ACE},
@@ -3914,6 +3971,10 @@
   set_modtime,
 };
 
+static char *dprn_fields[] = {
+  "printer",
+};
+
 static struct validate dprn_validate = {
   0,
   0,
@@ -4076,8 +4137,7 @@
 };
 
 static char *gats_fields[] = {
-  "table_name", "appends", "updates", "deletes",
-  "modtime", "modby", "modwith",
+  "table_name", "appends", "updates", "deletes", "modtime",
 };
 
 static char *_sdl_fields[] = {
@@ -4304,7 +4364,7 @@
 static char *gmoc_fields[] = {
   "container",
   "isrecursive",
-	"machine",
+  "machine",
   "container",
 };
 
@@ -4324,7 +4384,7 @@
 static char *gsoc_fields[] = {
   "container",
   "isrecursive",
-	"subcontainer",
+  "subcontainer",
 };
 
 static struct validate gsoc_validate = 
@@ -4427,6 +4487,7 @@
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
     galo2_fields,
     6,
+    6,
     "u.users_id != 0",
     0,
     "u.login",
@@ -4444,6 +4505,7 @@
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
     galo_fields,
     7,
+    7,
     "u.users_id != 0",
     0,
     "u.login",
@@ -4461,6 +4523,7 @@
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
     galo2_fields,
     6,
+    6,
     "u.status = 1",
     0,
     "u.login",
@@ -4478,6 +4541,7 @@
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
     galo_fields,
     7,
+    7,
     "u.status = 1",
     0,
     "u.login",
@@ -4495,6 +4559,7 @@
     NO_TABLE,
     "LOWER(ra.kerberos_name), ra.function_category, NVL(ra.function_name, CHR(0)), ra.qualifier_code, NVL(ra.do_function, CHR(0)), NVL(ra.grant_and_view, CHR(0)) FROM roles_authorization ra",
     gura_fields,
+    7,
     6,
     "ra.kerberos_name LIKE UPPER('%s') AND ra.effective_date < SYSDATE AND (ra.expiration_date > SYSDATE OR expiration_date is null)",
     1,
@@ -4512,6 +4577,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
     gual2_fields,
+    16,
     15,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4529,6 +4595,7 @@
     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, 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",
     gual3_fields,
+    19,
     18,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4546,6 +4613,7 @@
     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",
     gual11_fields,
+    21,
     20,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4563,6 +4631,7 @@
     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, u.expiration, 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",
     gual12_fields,
+    24,
     23,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4580,6 +4649,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, 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",
     gual14_fields,
+    26,
     25,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4597,6 +4667,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, u.affiliation_basic, u.affiliation_detailed, 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,
+    28,
     27,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4614,6 +4685,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
     guau2_fields,
+    16,
     15,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4631,6 +4703,7 @@
     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, 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",
     guau3_fields,
+    19,
     18,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4648,6 +4721,7 @@
     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",
     guau11_fields,
+    21,
     20,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4665,6 +4739,7 @@
     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, u.expiration, 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",
     guau12_fields,
+    24,
     23,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4682,6 +4757,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, 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",
     guau14_fields,
+    26,
     25,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4699,6 +4775,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, u.affiliation_basic, u.affiliation_detailed, 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,
+    28,
     27,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4716,6 +4793,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
     guan2_fields,
+    17,
     15,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4733,6 +4811,7 @@
     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, 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",
     guan3_fields,
+    20,
     18,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4750,6 +4829,7 @@
     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",
     guan11_fields,
+    22,
     20,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4767,6 +4847,7 @@
     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, u.expiration, 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",
     guan12_fields,
+    25,
     23,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4784,6 +4865,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, 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",
     guan14_fields,
+    27,
     25,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4801,6 +4883,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, u.affiliation_basic, u.affiliation_detailed, 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,
+    29,
     27,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -4818,6 +4901,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
     guac2_fields,
+    16,
     15,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4835,6 +4919,7 @@
     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, 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",
     guac3_fields,
+    19,
     18,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4852,6 +4937,7 @@
     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",
     guac11_fields,
+    21,
     20,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4869,6 +4955,7 @@
     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, u.expiration, 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",
     guac12_fields,
+    24,
     23,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4886,6 +4973,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, 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",
     guac14_fields,
+    26,
     25,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4903,6 +4991,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, u.affiliation_basic, u.affiliation_detailed, 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,
+    28,
     27,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4920,6 +5009,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
     guam2_fields,
+    16,
     15,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4937,6 +5027,7 @@
     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, 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,
+    19,
     18,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4954,6 +5045,7 @@
     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",
     guam11_fields,
+    21,
     20,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4971,6 +5063,7 @@
     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, u.expiration, 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",
     guam12_fields,
+    24,
     23,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -4988,6 +5081,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, 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",
     guam14_fields,
+    26,
     25,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -5005,6 +5099,7 @@
     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, u.expiration, u.alternate_email, u.alternate_phone, u.affiliation_basic, u.affiliation_detailed, 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,
+    28,
     27,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -5022,6 +5117,7 @@
     0,
     0,
     guas_fields,
+    3,
     1,
     0,
     2,
@@ -5039,6 +5135,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
     gubl2_fields,
+    13,
     12,
     "u.login LIKE '%s' AND u.users_id != 0",
     1,
@@ -5056,6 +5153,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, 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",
     gubl_fields,
+    16,
     15,
     "u.login LIKE '%s' AND u.users_id != 0",
     1,
@@ -5073,6 +5171,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
     gubu2_fields,
+    13,
     12,
     "u.unix_uid = %s AND u.users_id != 0",
     1,
@@ -5090,6 +5189,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, 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",
     gubu_fields,
+    16,
     15,
     "u.unix_uid = %s AND u.users_id != 0",
     1,
@@ -5107,6 +5207,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
     gubn2_fields,
+    14,
     12,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
     2,
@@ -5124,6 +5225,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, 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",
     gubn_fields,
+    17,
     15,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
     2,
@@ -5141,6 +5243,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
     gubc2_fields,
+    13,
     12,
     "u.type = UPPER('%s') AND u.users_id != 0",
     1,
@@ -5158,6 +5261,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS') FROM users u",
     gubc_fields,
+    16,
     15,
     "u.type = UPPER('%s') AND u.users_id != 0",
     1,
@@ -5175,6 +5279,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
     gubm2_fields,
+    13,
     12,
     "u.clearid LIKE '%s' AND u.users_id != 0",
     1,
@@ -5192,6 +5297,7 @@
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, 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",
     gubm_fields,
+    16,
     15,
     "u.clearid LIKE '%s' AND u.users_id != 0",
     1,
@@ -5213,6 +5319,7 @@
     "INTO users (login, unix_uid, shell, last, first, middle, status, clearid, type, comments, signature, secure, users_id) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, %s)",
     auac2_fields,
     12,
+    12,
     NULL,
     0,
     NULL,
@@ -5233,6 +5340,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, 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, %s, SYSDATE, %s)",
     auac3_fields,
     13,
+    13,
     NULL,
     0,
     NULL,
@@ -5253,6 +5361,7 @@
     "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)",
     auac11_fields,
     15,
+    15,
     NULL,
     0,
     NULL,
@@ -5273,6 +5382,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, 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, NVL('%s', CHR(0)), %s, SYSDATE, %s)",
     auac12_fields,
     18,
+    18,
     NULL,
     0,
     NULL,
@@ -5293,6 +5403,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, alternate_email, alternate_phone, 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, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
     auac_fields,
     20,
+    20,
     NULL,
     0,
     NULL,
@@ -5310,6 +5421,7 @@
     "INTO users (login, unix_uid, shell, last, first, middle, status, clearid, type, comments, signature, secure, users_id) 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, %s)",
     auac2_fields,
     9,
+    9,
     0,
     0,
     NULL,
@@ -5327,6 +5439,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, 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, %s, SYSDATE, %s)",
     auac3_fields,
     10,
+    10,
     0,
     0,
     NULL,
@@ -5344,6 +5457,7 @@
     "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)",
     auac11_fields,
     12,
+    12,
     0,
     0,
     NULL,
@@ -5361,6 +5475,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, 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, NVL('%s', CHR(0)), %s, SYSDATE, %s)",
     auac12_fields,
     15,
+    15,
     0,
     0,
     NULL,
@@ -5378,6 +5493,7 @@
     "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, alternate_email, alternate_phone, 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, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
     auac_fields,
     17,
+    17,
     0,
     0,
     NULL,
@@ -5395,6 +5511,7 @@
     0,
     rusr_fields,
     3,
+    3,
     0,
     0,
     NULL,
@@ -5413,6 +5530,7 @@
     "users SET login = '%s', unix_uid = %s, shell = '%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",
     uuac2_fields,
     12,
+    12,
     "users_id = %d",
     1,
     NULL,
@@ -5430,6 +5548,7 @@
     /* 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",
     uuac3_fields,
+    14,
     13,
     "users_id = %d",
     1,
@@ -5448,6 +5567,7 @@
     /* 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))",
     uuac11_fields,
+    16,
     15,
     "users_id = %d",
     1,
@@ -5466,6 +5586,7 @@
     /* 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, expiration = NVL('%s', CHR(0))",
     uuac12_fields,
+    19,
     18,
     "users_id = %d",
     1,
@@ -5484,6 +5605,7 @@
     /* 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, expiration = NVL('%s', CHR(0)), alternate_email = NVL('%s', CHR(0)), alternate_phone = NVL('%s', CHR(0))",
     uuac_fields,
+    21,
     20,
     "users_id = %d",
     1,
@@ -5501,6 +5623,7 @@
     USERS_TABLE,
     "users SET login = '%s', unix_uid = %s, shell = '%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'",
     uuac2_fields,
+    10,
     9,
     "users_id = %d",
     1,
@@ -5518,6 +5641,7 @@
     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'",
     uuac3_fields,
+    11,
     10,
     "users_id = %d",
     1,
@@ -5535,6 +5659,7 @@
     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)) ",
     uuac11_fields,
+    13,
     12,
     "users_id = %d",
     1,
@@ -5552,6 +5677,7 @@
     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, expiration = NVL('%s', CHR(0)) ",
     uuac12_fields,
+    16,
     15,
     "users_id = %d",
     1,
@@ -5569,6 +5695,7 @@
     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, expiration = NVL('%s', CHR(0)), alternate_email = NVL('%s', CHR(0)), alternate_phone = NVL('%s', CHR(0)) ",
     uuac_fields,
+    18,
     17,
     "users_id = %d",
     1,
@@ -5586,6 +5713,7 @@
     USERS_TABLE,
     "users SET shell = '%s'",
     uush_fields,
+    2,
     1,
     "users_id = %d",
     1,
@@ -5603,6 +5731,7 @@
     USERS_TABLE,
     "users SET winconsoleshell = '%s'",
     uuws_fields,
+    2,
     1,
     "users_id = %d",
     1,
@@ -5620,6 +5749,7 @@
     USERS_TABLE,
     "users SET status = %s",
     uust_fields,
+    2,
     1,
     "users_id = %d",
     1,
@@ -5637,6 +5767,7 @@
     USERS_TABLE,
     "users SET secure = %s",
     uuss_fields,
+    2,
     1,
     "users_id = %d",
     1,
@@ -5654,6 +5785,7 @@
     USERS_TABLE,
     NULL,
     dusr_fields,
+    1,
     0,
     "users_id = %d",
     1,
@@ -5672,6 +5804,7 @@
     0,
     aurv_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -5688,6 +5821,7 @@
     USERS_TABLE,
     0,
     gurv_fields,
+    2,
     1,
     0,
     1,
@@ -5705,6 +5839,7 @@
     USERS_TABLE,
     0,
     gubr_fields,
+    2,
     1,
     0,
     1,
@@ -5723,6 +5858,7 @@
     0,
     aurv_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -5739,6 +5875,7 @@
     KRBMAP_TABLE,
     "u.login, str.string FROM krbmap km, users u, strings str",
     gkum_fields,
+    4,
     2,
     "u.login LIKE '%s' AND str.string LIKE '%s' AND km.users_id = u.users_id AND km.string_id = str.string_id",
     2,
@@ -5757,6 +5894,7 @@
     "INTO krbmap (users_id, string_id) VALUES (%d, %d)",
     akum_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -5773,6 +5911,7 @@
     KRBMAP_TABLE,
     0,
     akum_fields,
+    2,
     0,
     "users_id = %d AND string_id = %d",
     2,
@@ -5790,6 +5929,7 @@
     USERS_TABLE,
     "login, fullname, nickname, home_addr, home_phone, office_addr, office_phone, department, affiliation, TO_CHAR(fmodtime, 'DD-mon-YYYY HH24:MI:SS'), fmodby, fmodwith FROM users",
     gfbl_fields,
+    13,
     12,
     "users_id = %d",
     1,
@@ -5807,6 +5947,7 @@
     USERS_TABLE,
     "users SET fullname= NVL('%s', CHR(0)), nickname= NVL('%s', CHR(0)), home_addr= NVL('%s', CHR(0)), home_phone= NVL('%s', CHR(0)), office_addr= NVL('%s', CHR(0)), office_phone= NVL('%s', CHR(0)), department= NVL('%s', CHR(0)), affiliation= NVL('%s', CHR(0))",
     ufbl_fields,
+    9,
     8,
     "users_id = %d",
     1,
@@ -5824,6 +5965,7 @@
     USERS_TABLE,
     "login, potype, users_id, CHR(0), TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
     gpob_fields,
+    8,
     7,
     "users_id = %d",
     1,
@@ -5842,6 +5984,7 @@
     "login, potype, pop_id || ':' || box_id FROM users",
     gpox_fields,
     3,
+    3,
     "potype != 'NONE'",
     0,
     "login",
@@ -5859,6 +6002,7 @@
     "login, potype, users_id FROM users",
     gpox_fields,
     3,
+    3,
     "potype = 'POP'",
     0,
     "login",
@@ -5876,6 +6020,7 @@
     "login, potype, users_id FROM users",
     gpox_fields,
     3,
+    3,
     "potype = 'SMTP'",
     0,
     "login",
@@ -5893,6 +6038,7 @@
     0,
     spob_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -5908,8 +6054,9 @@
     0,
     USERS_TABLE,
     0,
-    spob_fields,
+    spop_fields,
     1,
+    1,
     NULL,
     0,
     NULL,
@@ -5925,7 +6072,8 @@
     "u",
     USERS_TABLE,
     "users SET potype = 'NONE'",
-    spob_fields,
+    spop_fields,
+    1,
     0,
     "users_id = %d",
     1,
@@ -5944,6 +6092,7 @@
     0,
     uupe_fields,
     1,
+    1,
     NULL,
     0,
     NULL,
@@ -5960,6 +6109,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
     ghst2_fields,
+    25,
     21,
     "m.name LIKE UPPER('%s') AND m.address LIKE '%s' AND m.location LIKE UPPER('%s') AND s.name LIKE UPPER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     4,
@@ -5977,6 +6127,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
     ghst6_fields,
+    26,
     22,
     "m.name LIKE UPPER('%s') AND m.address LIKE '%s' AND m.location LIKE UPPER('%s') AND s.name LIKE UPPER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     4,
@@ -5994,6 +6145,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
     ghst_fields,
+    27,
     23,
     "m.name LIKE UPPER('%s') AND m.address LIKE '%s' AND m.location LIKE UPPER('%s') AND s.name LIKE UPPER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     4,
@@ -6011,6 +6163,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s, hwaddrmap hw",
     ghbh2_fields,
+    22,
     21,
     "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     1,
@@ -6028,6 +6181,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s, hwaddrmap hw",
     ghbh6_fields,
+    23,
     22,
     "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     1,
@@ -6045,6 +6199,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s, hwaddrmap hw",
     ghbh_fields,
+    24,
     23,
     "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m.mach_id AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     1,
@@ -6062,6 +6217,7 @@
     MACHINE_TABLE,
     "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",    
     ghba_fields,
+    24,
     23,
     "m.account_number LIKE '%s' AND m.mach_id != 0 and s.snet_id = m.snet_id",
     1,
@@ -6079,6 +6235,7 @@
     HWADDRMAP_TABLE,
     "hw.hwaddr FROM machine m, hwaddrmap hw",
     ghha_fields,
+    2,
     1,
     "m.name LIKE UPPER('%s') AND m.mach_id = hw.mach_id AND rownum < 2",
     1,
@@ -6096,6 +6253,7 @@
     HWADDRMAP_TABLE,
     "m.name, hw.hwaddr FROM machine m, hwaddrmap hw",
     ghhm_fields,
+    3,
     2,
     "m.name LIKE UPPER('%s') AND m.mach_id = hw.mach_id",
     1,
@@ -6115,6 +6273,7 @@
     "INTO machine (name, vendor, model, os, location, contact, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('0', '%s'), %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, TO_DATE('01-JAN-1970', 'DD-mon-YYYY'), %s, %s)",
     ahst2_fields,
     14,
+    14,
     0,
     0,
     NULL,
@@ -6133,6 +6292,7 @@
     "INTO machine (name, vendor, model, os, location, contact, billing_contact, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('0', '%s'), %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, TO_DATE('01-JAN-1970', 'DD-mon-YYYY'), %s, %s)",
     ahst6_fields,
     15,
+    15,
     0,
     0,
     NULL,
@@ -6151,6 +6311,7 @@
     "INTO machine (name, vendor, model, os, location, contact, billing_contact, account_number, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('0', '%s'), %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, TO_DATE('01-JAN-1970', 'DD-mon-YYYY'), %s, %s)",
     ahst_fields,
     16,
+    16,
     0,
     0,
     NULL,
@@ -6158,6 +6319,24 @@
   },
 
   {
+    /* Q_ADHR - ADD_DYNAMIC_HOST_RECORD, v9 */ /* Uses prefetch_value for mach_id */
+    "add_dynamic_host_record",
+    "adhr",
+    9,
+    MR_Q_APPEND,
+    0,
+    MACHINE_TABLE,
+    0,
+    adhr_fields,
+    3,
+    2,
+    NULL,
+    0,
+    NULL,
+    &adhr_validate,
+  },
+
+  {
     /* Q_UHST - UPDATE_HOST, v2 */
     "update_host",
     "uhst",
@@ -6168,6 +6347,7 @@
     /* See comment in ahst about use field. */
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), use = NVL(use, '%s'), status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
     uhst2_fields,
+    15,
     14,
     "mach_id = %d",
     1,
@@ -6186,6 +6366,7 @@
     /* See comment in ahst about use field */
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), billing_contact = NVL('%s', CHR(0)), use = NVL(use, '%s'), status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
     uhst6_fields,
+    16,
     15,
     "mach_id = %d",
     1,
@@ -6204,6 +6385,7 @@
     /* See comment in ahst about use field */
     "machine SET name = NVL(UPPER('%s'), CHR(0)), vendor = NVL(UPPER('%s'), CHR(0)), model = NVL(UPPER('%s'), CHR(0)), os = NVL(UPPER('%s'), CHR(0)), location = NVL(UPPER('%s'), CHR(0)), contact = NVL('%s', CHR(0)), billing_contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), use = NVL(use, '%s'), status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
     uhst_fields,
+    17,
     16,
     "mach_id = %d",
     1,
@@ -6221,6 +6403,7 @@
     MACHINE_TABLE,
     "machine SET use = %s, ocomment = %d, inuse = SYSDATE",
     shot_fields,
+    3,
     2,
     "mach_id = %d",
     1,
@@ -6238,6 +6421,7 @@
     MACHINE_TABLE,
     "machine SET ttl = %s",
     sttl_fields,
+    2,
     1,
     "mach_id = %d",
     1,
@@ -6255,6 +6439,7 @@
     MACHINE_TABLE,
     "m.ttl FROM machine m",
     gttl_fields,
+    2,
     1,
     "m.name LIKE UPPER('%s')",
     1,
@@ -6273,6 +6458,7 @@
     "INTO hwaddrmap (mach_id, hwaddr) VALUES (%d, NVL('%s', CHR(0)))",
     ahha_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -6290,6 +6476,7 @@
     "INTO hwaddrmap (mach_id, hwaddr) VALUES (%d, NVL('%s', CHR(0)))",
     ahha_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -6306,6 +6493,7 @@
     HWADDRMAP_TABLE,
     0,
     dhha_fields,
+    2,
     0,
     "mach_id = %d AND hwaddr = LOWER('%s')",
     2,
@@ -6323,6 +6511,7 @@
     MACHINE_TABLE,
     NULL,
     dhst_fields,
+    1,
     0,
     "mach_id = %d",
     1,
@@ -6340,6 +6529,7 @@
     MACHINE_TABLE,
     "name, vendor, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM machine",
     gmac_fields,
+    6,
     5,
     "name LIKE UPPER('%s') AND mach_id != 0",
     1,
@@ -6357,6 +6547,7 @@
     HOSTALIAS_TABLE,
     "a.name, m.name FROM hostalias a, machine m",
     ghal_fields,
+    4,
     2,
     "m.mach_id = a.mach_id and a.name LIKE UPPER('%s') AND m.name LIKE UPPER('%s')",
     2,
@@ -6375,6 +6566,7 @@
     "INTO hostalias (name, mach_id) VALUES (UPPER('%s'), %d)",
     ghal_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -6391,6 +6583,7 @@
     HOSTALIAS_TABLE,
     NULL,
     ghal_fields,
+    2,
     0,
     "name = UPPER('%s') AND mach_id = %d",
     2,
@@ -6408,6 +6601,7 @@
     SUBNET_TABLE,
     "name, description, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
     gsnt2_fields,
+    13,
     12,
     "name LIKE UPPER('%s')",
     1,
@@ -6425,6 +6619,7 @@
     SUBNET_TABLE,
     "name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
     gsnt_fields,
+    16,
     15,
     "name LIKE UPPER('%s')",
     1,
@@ -6443,6 +6638,7 @@
     "INTO subnet (name, description, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
     asnt2_fields,
     9,
+    9,
     0,
     0,
     NULL,
@@ -6460,6 +6656,7 @@
     "INTO subnet (name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
     asnt_fields,
     12,
+    12,
     0,
     0,
     NULL,
@@ -6476,6 +6673,7 @@
     SUBNET_TABLE,
     "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
     usnt2_fields,
+    10,
     9,
     "snet_id = %d",
     1,
@@ -6493,6 +6691,7 @@
     SUBNET_TABLE,
     "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), status = %s, contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
     usnt_fields,
+    13,
     12,
     "snet_id = %d",
     1,
@@ -6510,6 +6709,7 @@
     SUBNET_TABLE,
     NULL,
     dsnt_fields,
+    1,
     0,
     "snet_id = %d",
     1,
@@ -6527,6 +6727,7 @@
     CLUSTERS_TABLE,
     "name, description, location, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM clusters",
     gclu_fields,
+    7,
     6,
     "name LIKE '%s' AND clu_id != 0",
     1,
@@ -6545,6 +6746,7 @@
     "INTO clusters (name, description, location, clu_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s)",
     aclu_fields,
     3,
+    3,
     0,
     0,
     NULL,
@@ -6561,6 +6763,7 @@
     CLUSTERS_TABLE,
     "clusters SET name = '%s', description = NVL('%s', CHR(0)), location = NVL('%s', CHR(0))",
     uclu_fields,
+    4,
     3,
     "clu_id = %d",
     1,
@@ -6578,6 +6781,7 @@
     CLUSTERS_TABLE,
     NULL,
     dclu_fields,
+    1,
     0,
     "clu_id = %d",
     1,
@@ -6595,6 +6799,7 @@
     MCMAP_TABLE,
     "m.name, c.name FROM machine m, clusters c, mcmap mcm",
     gmcm_fields,
+    4,
     2,
     "m.name LIKE UPPER('%s') AND c.name LIKE '%s' AND mcm.clu_id = c.clu_id AND mcm.mach_id = m.mach_id",
     2,
@@ -6611,8 +6816,9 @@
     "mcm",
     MCMAP_TABLE,
     "INTO mcmap (mach_id, clu_id) VALUES (%d, %d)",
-    gmcm_fields,
+    amcm_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -6628,7 +6834,8 @@
     "mcm",
     MCMAP_TABLE,
     0,
-    gmcm_fields,
+    amcm_fields,
+    2,
     0,
     "mach_id = %d AND clu_id = %d",
     2,
@@ -6646,6 +6853,7 @@
     SVC_TABLE,
     "c.name, svc.serv_label, svc.serv_cluster FROM svc svc, clusters c",
     gcld_fields,
+    5,
     3,
     "c.clu_id = svc.clu_id AND c.name LIKE '%s' AND svc.serv_label LIKE '%s'",
     2,
@@ -6664,6 +6872,7 @@
     "INTO svc (clu_id, serv_label, serv_cluster) VALUES (%d, '%s', '%s')",
     acld_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -6680,6 +6889,7 @@
     SVC_TABLE,
     NULL,
     acld_fields,
+    3,
     0,
     "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
     3,
@@ -6697,6 +6907,7 @@
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
     glin2_fields,
+    14,
     13,
     "name LIKE '%s'",
     1,
@@ -6714,6 +6925,7 @@
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
     glin3_fields,
+    15,
     14,
     "name LIKE '%s'",
     1,
@@ -6731,6 +6943,7 @@
     LIST_TABLE,
     "name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM list",
     glin4_fields,
+    17,
     16,
     "name LIKE '%s'",
     1,
@@ -6748,6 +6961,7 @@
     LIST_TABLE,
     "l.name, l.active, l.publicflg, l.hidden, l.maillist, l.grouplist, l.gid, l.nfsgroup, l.mailman, m.name, l.acl_type, l.acl_id, l.memacl_type, l.memacl_id, l.description, TO_CHAR(l.modtime, 'DD-mon-YYYY HH24:MI:SS'), l.modby, l.modwith FROM list l, machine m",
     glin_fields,
+    19,
     18,
     "l.name LIKE '%s' AND m.mach_id = l.mailman_id",
     1,
@@ -6764,7 +6978,8 @@
     "l",
     LIST_TABLE,
     "name FROM list",
-    glin_fields,
+    exln_fields,
+    2,
     1,
     "name LIKE '%s' AND list_id != 0",
     1,
@@ -6783,6 +6998,7 @@
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, acl_type, acl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, '%s', %d, NVL('%s', CHR(0)), %s)",
     alis2_fields,
     10,
+    10,
     0,
     0,
     NULL,
@@ -6800,6 +7016,7 @@
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, '%s', %d, NVL('%s', CHR(0)), %s)", 
     alis3_fields,
     11,
+    11,
     0,
     0,
     NULL,
@@ -6817,6 +7034,7 @@
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
     alis4_fields,
     13,
+    13,
     0,
     0,
     NULL,
@@ -6834,6 +7052,7 @@
     "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, mailman, mailman_id, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, %s, %d, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
     alis_fields,
     15,
+    15,
     0,
     0,
     NULL,
@@ -6850,6 +7069,7 @@
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, acl_type = '%s', acl_id = %d, description = NVL('%s', CHR(0))",
     ulis2_fields,
+    11,
     10,
     "list_id = %d",
     1,
@@ -6867,6 +7087,7 @@
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, description = NVL('%s', CHR(0))",
     ulis3_fields,
+    12,
     11,
     "list_id = %d",
     1,
@@ -6884,6 +7105,7 @@
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
     ulis4_fields,
+    14,
     13,
     "list_id = %d",
     1,
@@ -6901,6 +7123,7 @@
     LIST_TABLE,
     "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, mailman = %s, mailman_id = %d, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
     ulis_fields,
+    16,
     15,
     "list_id = %d",
     1,
@@ -6918,6 +7141,7 @@
     LIST_TABLE,
     NULL,
     dlis_fields,
+    1,
     0,
     "list_id = %d",
     1,
@@ -6936,6 +7160,7 @@
     0,
     amtl_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -6953,6 +7178,7 @@
     0,
     atml_fields,
     4,
+    4,
     NULL,
     0,
     NULL,
@@ -6969,6 +7195,7 @@
     IMEMBERS_TABLE,
     0,
     atml_fields,
+    4,
     1,
     0,
     3,
@@ -6986,6 +7213,7 @@
     IMEMBERS_TABLE,
     NULL,
     amtl_fields,
+    3,
     0,
     0,
     3,
@@ -7003,6 +7231,7 @@
     0,
     0,
     gaus_fields,
+    4,
     2,
     0,
     2,
@@ -7020,6 +7249,7 @@
     0,
     0,
     ghbo_fields,
+    3,
     1,
     0,
     2,
@@ -7037,6 +7267,7 @@
     LIST_TABLE,
     0,
     qgli_fields,
+    6,
     1,
     0,
     5,
@@ -7054,6 +7285,7 @@
     IMEMBERS_TABLE,
     NULL,
     gmol_fields,
+    3,
     2,
     NULL,
     1,
@@ -7071,6 +7303,7 @@
     IMEMBERS_TABLE,
     NULL,
     gmol_fields,
+    3,
     2,
     NULL,
     1,
@@ -7088,6 +7321,7 @@
     IMEMBERS_TABLE,
     NULL,
     gtml_fields,
+    4,
     3,
     NULL,
     1,
@@ -7105,6 +7339,7 @@
     IMEMBERS_TABLE,
     0,
     glom_fields,
+    8,
     6,
     0,
     2,
@@ -7122,6 +7357,7 @@
     IMEMBERS_TABLE,
     0,
     cmol_fields,
+    2,
     1,
     0,
     1,
@@ -7139,6 +7375,7 @@
     SERVERS_TABLE,
     "name, update_int, target_file, script, dfgen, dfcheck, type, enable, inprogress, harderror, errmsg, acl_type, acl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM servers",
     gsin_fields,
+    17,
     16,
     "name LIKE UPPER('%s')",
     1,
@@ -7156,6 +7393,7 @@
     SERVERS_TABLE,
     0,
     qgsv_fields,
+    4,
     1,
     0,
     3,
@@ -7174,6 +7412,7 @@
     "INTO servers (name, update_int, target_file, script, type, enable, acl_type, acl_id) VALUES (UPPER('%s'), %s, '%s', '%s', '%s', %s, '%s', %d)",
     asin_fields,
     8,
+    8,
     NULL,
     0,
     NULL,
@@ -7190,6 +7429,7 @@
     SERVERS_TABLE,
     "servers SET update_int = %s, target_file = '%s', script = '%s', type = '%s', enable = %s, acl_type = '%s', acl_id = %d",
     asin_fields,
+    8,
     7,
     "name = UPPER('%s')",
     1,
@@ -7207,6 +7447,7 @@
     SERVERS_TABLE,
     "servers SET harderror = 0, dfcheck = dfgen",
     dsin_fields,
+    1,
     0,
     "name = UPPER('%s')",
     1,
@@ -7224,6 +7465,7 @@
     SERVERS_TABLE,
     "servers SET dfgen = %s, dfcheck = %s, inprogress = %s, harderror = %s, errmsg = NVL('%s', CHR(0))",
     ssif_fields,
+    6,
     5,
     "name = UPPER('%s')",
     1,
@@ -7241,6 +7483,7 @@
     SERVERS_TABLE,
     NULL,
     dsin_fields,
+    1,
     0,
     "name = UPPER('%s')",
     1,
@@ -7258,6 +7501,7 @@
     SERVERHOSTS_TABLE,
     "sh.service, m.name, sh.enable, sh.override, sh.success, sh.inprogress, sh.hosterror, sh.hosterrmsg, sh.ltt, sh.lts, sh.value1, sh.value2, sh.value3, TO_CHAR(sh.modtime, 'DD-mon-YYYY HH24:MI:SS'), sh.modby, sh.modwith FROM serverhosts sh, machine m",
     gshi_fields,
+    18,
     16,
     "sh.service LIKE UPPER('%s') AND m.name LIKE UPPER('%s') AND m.mach_id = sh.mach_id",
     2,
@@ -7275,6 +7519,7 @@
     SERVERHOSTS_TABLE,
     0,
     qgsh_fields,
+    8,
     2,
     0,
     6,
@@ -7293,6 +7538,7 @@
     "INTO serverhosts (service, mach_id, enable, value1, value2, value3) VALUES (UPPER('%s'), %d, %s, %s, %s, NVL('%s', CHR(0)))",
     ashi_fields,
     6,
+    6,
     NULL,
     0,
     NULL,
@@ -7309,6 +7555,7 @@
     SERVERHOSTS_TABLE,
     "serverhosts SET enable = %s, value1 = %s, value2 = %s, value3 = NVL('%s', CHR(0))",
     ashi_fields,
+    6,
     4,
     "service = UPPER('%s') AND mach_id = %d",
     2,
@@ -7326,6 +7573,7 @@
     SERVERHOSTS_TABLE,
     "serverhosts SET hosterror = 0",
     dshi_fields,
+    2,
     0,
     "service = UPPER('%s') AND mach_id = %d",
     2,
@@ -7343,6 +7591,7 @@
     SERVERHOSTS_TABLE,
     "serverhosts SET override = 1",
     dshi_fields,
+    2,
     0,
     "service = UPPER('%s') AND mach_id = %d",
     2,
@@ -7360,6 +7609,7 @@
     SERVERHOSTS_TABLE,
     "serverhosts SET override = %s, success = %s, inprogress = %s, hosterror = %s, hosterrmsg = NVL('%s', CHR(0)), ltt = %s, lts = %s",
     sshi_fields,
+    9,
     7,
     "service = UPPER('%s') AND mach_id = %d",
     2,
@@ -7377,6 +7627,7 @@
     SERVERHOSTS_TABLE,
     NULL,
     dshi_fields,
+    2,
     0,
     "service = UPPER('%s') AND mach_id = %d",
     2,
@@ -7394,6 +7645,7 @@
     SERVERHOSTS_TABLE,
     "sh.service, m.name FROM serverhosts sh, machine m",
     gslo_fields,
+    3,
     2,
     "sh.service LIKE UPPER('%s') AND sh.mach_id = m.mach_id",
     1,
@@ -7411,6 +7663,7 @@
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsl_fields,
+    15,
     14,
     "fs.label LIKE '%s' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
     1,
@@ -7428,6 +7681,7 @@
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsm_fields,
+    15,
     14,
     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
     1,
@@ -7445,6 +7699,7 @@
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l, nfsphys np",
     gfsn_fields,
+    16,
     14,
     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id AND np.nfsphys_id = fs.phys_id AND np.dir LIKE '%s'",
     2,
@@ -7462,6 +7717,7 @@
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsg_fields,
+    15,
     14,
     "fs.owners = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
     1,
@@ -7479,6 +7735,7 @@
     FILESYS_TABLE,
     "fs.label, fs.type, m.name, fs.name, fs.mount, fs.rwaccess, fs.comments, u.login, l.name, fs.createflg, fs.lockertype, TO_CHAR(fs.modtime, 'DD-mon-YYYY HH24:MI:SS'), fs.modby, fs.modwith FROM filesys fs, machine m, users u, list l",
     gfsp_fields,
+    15,
     14,
     "fs.name LIKE '%s' AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = list_id",
     1,
@@ -7497,6 +7754,7 @@
     "INTO filesys (label, type, mach_id, name, mount, rwaccess, comments, owner, owners, createflg, lockertype, filsys_id) VALUES ('%s', '%s', %d, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', NVL('%s', CHR(0)), %d, %d, %s, '%s', %s)",
     afil_fields,
     11,
+    11,
     0,
     0,
     NULL,
@@ -7513,6 +7771,7 @@
     FILESYS_TABLE,
     "filesys SET label = '%s', type = '%s', mach_id = %d, name = NVL('%s', CHR(0)), mount = NVL('%s', CHR(0)), rwaccess = '%s', comments = NVL('%s', CHR(0)), owner = %d, owners = %d, createflg = %s, lockertype = '%s'",
     ufil_fields,
+    12,
     11,
     "filsys_id = %d",
     1,
@@ -7530,6 +7789,7 @@
     FILESYS_TABLE,
     NULL,
     dfil_fields,
+    1,
     0,
     "filsys_id = %d",
     1,
@@ -7547,6 +7807,7 @@
     FSGROUP_TABLE,
     "fs.label, fg.key FROM fsgroup fg, filesys fs",
     gfgm_fields,
+    3,
     2,
     "fg.group_id = %d AND fs.filsys_id = fg.filsys_id",
     1,
@@ -7565,6 +7826,7 @@
     "INTO fsgroup (group_id, filsys_id, key) VALUES (%d, %d, '%s')",
     gfgm_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -7580,7 +7842,8 @@
     "fg",
     FSGROUP_TABLE,
     NULL,
-    gfgm_fields,
+    rffg_fields,
+    2,
     0,
     "group_id = %d AND filsys_id = %d",
     2,
@@ -7599,6 +7862,7 @@
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
     ganf_fields,
     9,
+    9,
     "m.mach_id = np.mach_id",
     0,
     "m.name, np.dir",
@@ -7615,6 +7879,7 @@
     NFSPHYS_TABLE,
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
     gnfp_fields,
+    11,
     9,
     "np.mach_id = %d AND np.dir LIKE '%s' AND m.mach_id = np.mach_id",
     2,
@@ -7631,8 +7896,9 @@
     "np",
     NFSPHYS_TABLE,
     "INTO nfsphys (mach_id, dir, device, status, allocated, partsize, nfsphys_id) VALUES (%d, '%s', NVL('%s', CHR(0)), %s, %s, %s, %s)",
-    ganf_fields,
+    anfp_fields,
     6,
+    6,
     0,
     0,
     NULL,
@@ -7648,7 +7914,8 @@
     "np",
     NFSPHYS_TABLE,
     "nfsphys SET device = NVL('%s', CHR(0)), status = %s, allocated = %s, partsize = %s",
-    ganf_fields,
+    anfp_fields,
+    6,
     4,
     "mach_id = %d AND dir = '%s'",
     2,
@@ -7666,6 +7933,7 @@
     NFSPHYS_TABLE,
     "nfsphys SET allocated = allocated + %s",
     ajnf_fields,
+    3,
     1,
     "mach_id = %d AND dir = '%s'",
     2,
@@ -7683,6 +7951,7 @@
     NFSPHYS_TABLE,
     NULL,
     dnfp_fields,
+    2,
     0,
     "mach_id = %d AND dir = '%s'",
     2,
@@ -7700,6 +7969,7 @@
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
     gqot_fields,
+    12,
     9,
     "fs.label LIKE '%s' AND q.type = '%s' AND q.entity_id = %d AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
     3,
@@ -7717,6 +7987,7 @@
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
     gqbf_fields,
+    10,
     9,
     "fs.label LIKE '%s' AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
     1,
@@ -7735,6 +8006,7 @@
     "INTO quota (filsys_id, type, entity_id, quota, phys_id) VALUES ('%s', %d, %d, %s, %s)",
     aqot_fields,
     4,
+    4,
     NULL,
     0,
     NULL,
@@ -7751,6 +8023,7 @@
     QUOTA_TABLE,
     "quota SET quota = %s",
     aqot_fields,
+    4,
     1,
     0,
     3,
@@ -7767,7 +8040,8 @@
     0,
     QUOTA_TABLE,
     NULL,
-    aqot_fields,
+    dqot_fields,
+    3,
     0,
     0,
     3,
@@ -7785,6 +8059,7 @@
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, users u, machine m",
     gnfq_fields,
+    10,
     8,
     "fs.label LIKE '%s' AND q.type = 'USER' AND q.entity_id = u.users_id AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id AND u.login = '%s'",
     2,
@@ -7802,6 +8077,7 @@
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
     gnqp_fields,
+    7,
     5,
     "np.mach_id = %d AND np.dir LIKE '%s' AND q.phys_id = np.nfsphys_id AND fs.filsys_id = q.filsys_id AND q.type = 'USER' AND u.users_id = q.entity_id AND m.mach_id = np.mach_id",
     2,
@@ -7820,6 +8096,7 @@
     "INTO quota (type, filsys_id, entity_id, quota, phys_id ) VALUES ('USER', %d, %d, %s, %s)",
     anfq_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -7836,6 +8113,7 @@
     QUOTA_TABLE,
     "quota SET quota = %s",
     anfq_fields,
+    3,
     1,
     0,
     2,
@@ -7852,7 +8130,8 @@
     0,
     QUOTA_TABLE,
     NULL,
-    anfq_fields,
+    dnfq_fields,
+    2,
     0,
     0,
     2,
@@ -7870,6 +8149,7 @@
     ZEPHYR_TABLE,
     "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
     gzcl2_fields,
+    13,
     12,
     "class LIKE '%s'",
     1,
@@ -7887,6 +8167,7 @@
     ZEPHYR_TABLE,
     "class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM zephyr",
     gzcl_fields,
+    15,
     14,
     "class LIKE '%s'",
     1,
@@ -7905,6 +8186,7 @@
     "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
     azcl2_fields,
     9,
+    9,
     0,
     0,
     NULL,
@@ -7922,6 +8204,7 @@
     "INTO zephyr (class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, iui_type, iui_id, owner_type, owner_id) VALUES ('%s', '%s', %d, '%s', %d, '%s', %d, '%s', %d, '%s', %d)",
     azcl_fields,
     11,
+    11,
     0,
     0,
     NULL,
@@ -7938,6 +8221,7 @@
     ZEPHYR_TABLE,
     "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d",
     uzcl2_fields,
+    10,
     9,
     "class = '%s'",
     1,
@@ -7955,6 +8239,7 @@
     ZEPHYR_TABLE,
     "zephyr SET class = '%s', xmt_type = '%s', xmt_id = %d, sub_type = '%s', sub_id = %d, iws_type = '%s', iws_id = %d, iui_type = '%s', iui_id = %d, owner_type = '%s', owner_id = %d",
     uzcl_fields,
+    12,
     11,
     "class = '%s'",
     1,
@@ -7971,7 +8256,8 @@
     "z",
     ZEPHYR_TABLE,
     0,
-    uzcl_fields,
+    dzcl_fields,
+    1,
     0,
     "class = '%s'",
     1,
@@ -7989,6 +8275,7 @@
     HOSTACCESS_TABLE,
     "m.name, ha.acl_type, ha.acl_id, TO_CHAR(ha.modtime, 'DD-mon-YYYY HH24:MI:SS'), ha.modby, ha.modwith FROM hostaccess ha, machine m",
     gsha_fields,
+    7,
     6,
     "m.name LIKE UPPER('%s') AND ha.mach_id = m.mach_id",
     1,
@@ -8007,6 +8294,7 @@
     "INTO hostaccess (mach_id, acl_type, acl_id) VALUES (%d, '%s', %d)",
     asha_fields,
     3,
+    3,
     0,
     0,
     NULL,
@@ -8023,6 +8311,7 @@
     HOSTACCESS_TABLE,
     "hostaccess SET acl_type = '%s', acl_id = %d",
     asha_fields,
+    3,
     2,
     "mach_id = %d",
     1,
@@ -8039,7 +8328,8 @@
     "ha",
     HOSTACCESS_TABLE,
     0,
-    asha_fields,
+    dsha_fields,
+    1,
     0,
     "mach_id = %d",
     1,
@@ -8057,6 +8347,7 @@
     ACL_TABLE,
     "m.name, ac.target, ac.kind, l.name FROM acl ac, machine m, list l",
     gacl_fields,
+    6,
     4,
     "m.mach_id = %d AND m.mach_id = ac.mach_id AND ac.target LIKE '%s' AND l.list_id = ac.list_id",
     2,
@@ -8075,6 +8366,7 @@
     "INTO acl (mach_id, target, kind, list_id) VALUES (%d, '%s', '%s', %d)",
     aacl_fields,
     4,
+    4,
     0,
     0,
     NULL,
@@ -8091,6 +8383,7 @@
     ACL_TABLE,
     0,
     dacl_fields,
+    2,
     0,
     "mach_id = %d AND target = '%s'",
     2,
@@ -8108,6 +8401,7 @@
     SERVICES_TABLE,
     "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
     gsvc_fields,
+    9,
     7,
     "name LIKE '%s' AND protocol LIKE '%s'",
     2,
@@ -8126,6 +8420,7 @@
     "INTO services (name, protocol, port, description) VALUES ('%s', '%s', %s, NVL('%s', CHR(0)))",
     asvc_fields,
     4,
+    4,
     NULL,
     0,
     NULL,
@@ -8142,6 +8437,7 @@
     SERVICES_TABLE,
     0,
     dsvc_fields,
+    2,
     0,
     "name = '%s' AND protocol = '%s'",
     2,
@@ -8159,6 +8455,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gprn2_fields,
+    20,
     19,
     "pr.name LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8176,6 +8473,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gprn_fields,
+    24,
     23,
     "pr.name LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8193,6 +8491,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gpbd2_fields,
+    20,
     19,
     "pr.duplexname LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8210,7 +8509,8 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gpbd_fields,
-   23,
+    24,
+    23,
     "pr.duplexname LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
     "pr.name",
@@ -8227,6 +8527,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, hwaddrmap hw",
     gpbd2_fields,
+    20,
     19,
     "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m1.mach_id AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8244,6 +8545,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3, hwaddrmap hw",
     gpbd_fields,
+    24,
     23,
     "hw.hwaddr LIKE LOWER('%s') AND hw.mach_id = m1.mach_id AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8261,6 +8563,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gpbh2_fields,
+    20,
     19,
     "m1.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8278,6 +8581,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gpbh_fields,
+    24,
     23,
     "m1.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8295,6 +8599,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gpbr2_fields,
+    20,
     19,
     "m3.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8312,6 +8617,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gpbr_fields,
+    24,
     23,
     "m3.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8329,6 +8635,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gpbl2_fields,
+    20,
     19,
     "UPPER(pr.location) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8346,6 +8653,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gpbl_fields,
+    24,
     23,
     "UPPER(pr.location) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8363,6 +8671,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
     gpbc2_fields,
+    20,
     19,
     "UPPER(pr.contact) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
     1,
@@ -8380,6 +8689,7 @@
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
     gpbc_fields,
+    24,
     23,
     "UPPER(pr.contact) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
     1,
@@ -8398,6 +8708,7 @@
     "INTO printers (name, type, hwtype, duplexname, mach_id, loghost, rm, rp, rq, ka, pc, ac, lpc_acl, banner, location, contact) VALUES ('%s', '%s', '%s', NVL('%s', CHR(0)), %d, %d, %d, NVL('%s', CHR(0)), %d, %s, %s, %d, %d, %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)))",
     aprn2_fields,
     16,
+    16,
     0,
     0,
     NULL,
@@ -8415,6 +8726,7 @@
     "INTO printers (name, type, hwtype, duplexname, duplexdefault, holddefault, status, mach_id, loghost, rm, rp, rq, ka, pc, ac, lpc_acl, report_list, banner, location, contact) VALUES ('%s', '%s', '%s', NVL('%s', CHR(0)), %s, %s, %s, %d, %d, %d, NVL('%s', CHR(0)), %d, %s, %s, %d, %d, %d, %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)))",
     aprn_fields,
     20,
+    20,
     0,
     0,
     NULL,
@@ -8431,6 +8743,7 @@
     PRINTERS_TABLE,
     "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %s, pc = %s, ac = %d, lpc_acl = %d, banner = %s, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
     uprn2_fields,
+    17,
     16,
     "name = '%s'",
     1,
@@ -8448,6 +8761,7 @@
     PRINTERS_TABLE,
     "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), duplexdefault = %s, holddefault = %s, status = %s, mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %s, pc = %s, ac = %d, lpc_acl = %d, report_list = %d, banner = %s, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
     uprn_fields,
+    21,
     20,
     "name = '%s'",
     1,
@@ -8464,7 +8778,8 @@
     "pr",
     PRINTERS_TABLE,
     0,
-    aprn_fields,
+    dprn_fields,
+    1,
     0,
     "name = '%s'",
     1,
@@ -8482,6 +8797,7 @@
     PRINTSERVERS_TABLE,
     "m.name, ps.kind, s.string, ps.owner_type, ps.owner_id, l.name, TO_CHAR(ps.modtime, 'DD-mon-YYYY HH24:MI:SS'), ps.modby, ps.modwith FROM printservers ps, machine m, strings s, list l",
     gpsv_fields,
+    10,
     9,
     "ps.mach_id = %d AND m.mach_id = ps.mach_id AND s.string_id = ps.printer_types AND l.list_id = ps.lpc_acl",
     1,
@@ -8500,6 +8816,7 @@
     "INTO printservers (mach_id, kind, printer_types, owner_type, owner_id, lpc_acl) VALUES (%d, '%s', %d, '%s', %d, %d)",
     apsv_fields,
     6,
+    6,
     0,
     0,
     NULL,
@@ -8516,6 +8833,7 @@
     PRINTSERVERS_TABLE,
     "printservers SET kind = '%s', printer_types = %d, owner_type = '%s', owner_id = %d, lpc_acl = %d",
     apsv_fields,
+    6,
     5,
     "mach_id = %d",
     1,
@@ -8533,6 +8851,7 @@
     PRINTSERVERS_TABLE,
     0,
     dpsv_fields,
+    1,
     0,
     "mach_id = %d",
     1,
@@ -8550,6 +8869,7 @@
     ALIAS_TABLE,
     "name, type, trans FROM alias",
     gali_fields,
+    6,
     3,
     "name LIKE '%s' AND type LIKE '%s' AND trans LIKE '%s'",
     3,
@@ -8568,6 +8888,7 @@
     "INTO alias (name, type, trans) VALUES ('%s', '%s', '%s')",
     aali_fields,
     3,
+    3,
     NULL,
     0,
     NULL,
@@ -8584,6 +8905,7 @@
     ALIAS_TABLE,
     NULL,
     aali_fields,
+    3,
     0,
     "name = '%s' AND type = '%s' AND  trans = '%s'",
     3,
@@ -8601,6 +8923,7 @@
     NUMVALUES_TABLE,
     "value FROM numvalues",
     gval_fields,
+    2,
     1,
     "name = '%s'",
     1,
@@ -8619,6 +8942,7 @@
     "INTO numvalues (name, value) VALUES ('%s', %s)",
     aval_fields,
     2,
+    2,
     NULL,
     0,
     NULL,
@@ -8635,6 +8959,7 @@
     NUMVALUES_TABLE,
     "numvalues SET value = %s",
     aval_fields,
+    2,
     1,
     "name = '%s'",
     1,
@@ -8652,6 +8977,7 @@
     NUMVALUES_TABLE,
     NULL,
     dval_fields,
+    1,
     0,
     "name = '%s'",
     1,
@@ -8670,6 +8996,7 @@
     "table_name, appends, updates, deletes, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS') FROM tblstats",
     gats_fields,
     5,
+    5,
     NULL,
     0,
     "table_name",
@@ -8687,6 +9014,7 @@
     NULL,
     _sdl_fields,
     1,
+    1,
     NULL,
     0,
     NULL,
@@ -8703,6 +9031,7 @@
     CONTAINERS_TABLE,
     "name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
     gcon7_fields,
+    12,
     11,
     "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
     1,
@@ -8720,6 +9049,7 @@
     CONTAINERS_TABLE,
     "name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
     gcon_fields,
+    13,
     12,
     "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
     1,
@@ -8738,6 +9068,7 @@
     "INTO containers (name, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
     acon7_fields,
     8,
+    8,
     0,
     0,
     NULL,
@@ -8755,6 +9086,7 @@
     "INTO containers (name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
     acon_fields,
     9,
+    9,
     0,
     0,
     NULL,
@@ -8771,6 +9103,7 @@
     CONTAINERS_TABLE,
     0,
     ucon7_fields,
+    9,
     8,
     0,
     1,
@@ -8788,6 +9121,7 @@
     CONTAINERS_TABLE,
     0,
     ucon_fields,
+    10,
     9,
     0,
     1,
@@ -8805,6 +9139,7 @@
     CONTAINERS_TABLE,
     NULL,
     dcon_fields,
+    1,
     0,
     "cnt_id = %d",
     1,
@@ -8823,6 +9158,7 @@
     "INTO mcntmap (mach_id, cnt_id) VALUES (%d, %d)",
     amcn_fields,
     2,
+    2,
     0,
     0,
     NULL,
@@ -8839,6 +9175,7 @@
     MCNTMAP_TABLE,
     0,
     amcn_fields,
+    2,
     0,
     "mach_id = %d AND cnt_id = %d",
     2,
@@ -8856,6 +9193,7 @@
     MCNTMAP_TABLE,
     "m.name, c.name FROM machine m, containers c, mcntmap mcn",
     gmnm_fields,
+    3,
     2,
     "m.name LIKE UPPER('%s') AND mcn.cnt_id = c.cnt_id AND mcn.mach_id = m.mach_id",
     1,
@@ -8873,6 +9211,7 @@
     MCNTMAP_TABLE,
     NULL,
     gmoc_fields,
+    4,
     2,
     NULL,
     2,
@@ -8890,6 +9229,7 @@
     CONTAINERS_TABLE,
     NULL,
     gsoc_fields,
+    3,
     1,
     NULL,
     2,
@@ -8908,6 +9248,7 @@
     "name FROM containers",
     gtlc_fields,
     1,
+    1,
     "name NOT LIKE '%%/%%'",
     0,
     "name",
@@ -8924,6 +9265,7 @@
     CONTAINERS_TABLE,
     0,
     scli_fields,
+    2,
     1,
     0,
     1,
@@ -8941,6 +9283,7 @@
     CONTAINERS_TABLE,
     "c.name, l.name FROM containers c, list l",
     gcli_fields,
+    3,
     2,
     "LOWER(c.name) = LOWER('%s') AND c.list_id = l.list_id AND c.list_id != 0",
     1,
@@ -8958,6 +9301,7 @@
     CONTAINERS_TABLE,
     "c.name, l.name FROM containers c, list l",
     glic_fields,
+    3,
     2,
     "l.list_id = %d AND l.list_id = c.list_id and c.list_id != 0",
     1,
@@ -8976,6 +9320,7 @@
     0,
     giql_fields,
     2,
+    2,
     0,
     0,
     NULL,

Modified: trunk/moira/server/query.h
===================================================================
--- trunk/moira/server/query.h	2013-12-04 14:32:04 UTC (rev 4151)
+++ trunk/moira/server/query.h	2013-12-11 14:01:40 UTC (rev 4152)
@@ -21,6 +21,7 @@
   enum tables rtable;		/* range table */
   char *tlist;			/* target list */
   char **fields;		/* input and output variable names (for help) */
+  int fields_count;		/* length of fields array */
   int  vcnt;			/* variable count */
   char *qual;			/* format string for "where" clause */
   int  argc;			/* number of args for qualifier */


home help back first fref pref prev next nref lref last post