]> andersk Git - moira.git/blobdiff - server/queries2.c
Make gtlc version 7; it didn't change any interfaces so we don't need
[moira.git] / server / queries2.c
index 306124ad750d38c6e1cc9cd9c8c82c7d182dcdf3..31644d218f3d4ed9d978c3908a8eb36db5e5dd56 100644 (file)
@@ -1,6 +1,6 @@
 /* $Id$
  *
- * This file defines the query dispatch table for version 2 of the protocol
+ * This file defines the query dispatch table
  *
  * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology.
  * For copying and distribution information, please see the file
@@ -42,6 +42,10 @@ static struct valobj VOfilesys0[] = {
   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
 };
 
+static struct valobj VOcon0[] = {
+       {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+};
+
 static struct valobj VOnum0[] = {
   {V_NUM, 0},
 };
@@ -67,23 +71,40 @@ static struct validate VDfix_modby = {
 
 /* Query data */
 
-static char *galo_fields[] = {
+static char *galo2_fields[] = {
   "login", "unix_uid", "shell", "last", "first", "middle",
 };
 
-static char *gual_fields[] = {
+static char *galo_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+};
+
+static char *gual2_fields[] = {
   "login",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
-static char *gubl_fields[] = {
+static char *gual_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith",
+};
+
+static char *gubl2_fields[] = {
   "login",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
+static char *gubl_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith",
+};
+
 static struct validate gubl_validate =
 {
   0,
@@ -94,23 +115,37 @@ static struct validate gubl_validate =
   0,
   access_login,
   0,
-  followup_guax,
+  followup_fix_modby,
 };
 
-static char *guau_fields[] = {
+static char *guau2_fields[] = {
   "unix_uid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
-static char *guan_fields[] = {
+static char *guau_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith",
+};
+
+static char *guan2_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
+static char *guan_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith",
+};
+
 static struct validate guan_validate =
 {
   0,
@@ -121,29 +156,49 @@ static struct validate guan_validate =
   0,
   0,
   0,
-  followup_guax,
+  followup_fix_modby,
 };
 
-static char *guac_fields[] = {
+static char *guac2_fields[] = {
   "class",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
-static char *guam_fields[] = {
+static char *guac_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith",
+};
+
+static char *guam2_fields[] = {
   "clearid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
-static char *gubu_fields[] = {
+static char *guam_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith",
+};
+
+static char *gubu2_fields[] = {
   "unix_uid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
+static char *gubu_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith",
+};
+
 static struct validate gubu_validate =
 {
   VOnum0,
@@ -157,12 +212,18 @@ static struct validate gubu_validate =
   followup_fix_modby,
 };
 
-static char *gubn_fields[] = {
+static char *gubn2_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
+static char *gubn_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith",
+};
+
 static struct validate gubn_validate =
 {
   0,
@@ -176,24 +237,41 @@ static struct validate gubn_validate =
   followup_fix_modby,
 };
 
-static char *gubc_fields[] = {
+static char *gubc2_fields[] = {
   "class",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
-static char *gubm_fields[] = {
+static char *gubc_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith",
+};
+
+static char *gubm2_fields[] = {
   "clearid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
-static char *auac_fields[] = {
+static char *gubm_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", 
+  "middle", "status", "clearid", "class", "modtime", "modby", "modwith",
+};
+
+static char *auac2_fields[] = {
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
 };
 
-static struct valobj auac_valobj[] = {
+static char *auac_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", 
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+};
+
+static struct valobj auac2_valobj[] = {
   {V_CHAR, 0, USERS_TABLE, "login"},
   {V_NUM, 1},
   {V_CHAR, 2, USERS_TABLE, "shell"},
@@ -207,9 +285,48 @@ static struct valobj auac_valobj[] = {
   {V_NUM, 11},
 };
 
+static struct valobj auac_valobj[] = {
+  {V_CHAR, 0, USERS_TABLE, "login"},
+  {V_NUM, 1},
+  {V_CHAR, 2, USERS_TABLE, "shell"},
+  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 4, USERS_TABLE, "last"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "middle"},
+  {V_NUM, 7},
+  {V_CHAR, 8, USERS_TABLE, "clearid"},
+  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 12},
+};
+
+static struct validate auac2_validate = {
+  auac2_valobj,
+  11,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
 static struct validate auac_validate = {
   auac_valobj,
-  11,
+  12,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
+static struct validate ausr2_validate = {
+  auac2_valobj,
+  9,
   "login",
   "login = '%s'",
   1,
@@ -221,7 +338,7 @@ static struct validate auac_validate = {
 
 static struct validate ausr_validate = {
   auac_valobj,
-  9,
+  10,
   "login",
   "login = '%s'",
   1,
@@ -232,18 +349,17 @@ static struct validate ausr_validate = {
 };
 
 static char *rusr_fields[] = {
-  "unix_uid", "login", "fs_type"
+  "unix_uid", "login", "pobox_type"
 };
 
 static struct valobj rusr_valobj[] = {
   {V_NUM, 0},
   {V_CHAR, 1, USERS_TABLE, "login"},
-  {V_NUM, 2},
 };
 
 static struct validate rusr_validate = {
   rusr_valobj,
-  3,
+  2,
   0,
   0,
   0,
@@ -253,13 +369,19 @@ static struct validate rusr_validate = {
   0,
 };
 
-static char *uuac_fields[] = {
+static char *uuac2_fields[] = {
   "login",
   "newlogin", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
 };
 
-static struct valobj uuac_valobj[] = {
+static char *uuac_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first", 
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+};
+
+static struct valobj uuac2_valobj[] = {
   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
   {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
   {V_NUM, 2},
@@ -273,17 +395,57 @@ static struct valobj uuac_valobj[] = {
   {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
   {V_NUM, 12},
 };
+  
+static struct valobj uuac_valobj[] = {
+  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
+  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_CHAR, 3, USERS_TABLE, "shell"},
+  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "last"},
+  {V_CHAR, 7, USERS_TABLE, "middle"},
+  {V_NUM, 8},
+  {V_CHAR, 9, USERS_TABLE, "clearid"},
+  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 13},
+};
+
+static struct validate uuac2_validate = {
+  uuac2_valobj,
+  12,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
 
 static struct validate uuac_validate = {
   uuac_valobj,
-  12,
+  13,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uusr2_validate = {
+  uuac2_valobj,
+  10,
   0,
   0,
   0,
   "users_id",
   0,
   setup_ausr,
-  followup_uuac,
+  set_modtime_by_id,
 };
 
 static struct validate uusr_validate = {
@@ -320,6 +482,28 @@ static struct validate uush_validate = {
   set_finger_modtime,
 };
 
+static char *uuws_fields[] = {
+  "login",
+  "winconsoleshell",
+};
+
+static struct valobj uuws_valobj[] = {
+  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
+  {V_CHAR, 1, USERS_TABLE, "winconsoleshell"},
+};
+
+static struct validate uuws_validate = {
+  uuws_valobj,
+  2,
+  0,
+  0,
+  0,
+  "users_id",
+  access_user,
+  0,
+  set_finger_modtime,
+};
+
 static char *uust_fields[] = {
   "login",
   "status",
@@ -364,6 +548,56 @@ static struct validate dusr_validate = {
   0,
 };
 
+static char *aurv_fields[] = {
+  "login", "reservation",
+};
+
+static struct validate aurv_validate = {
+  VOuser0,
+  1,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  0,
+  do_user_reservation,
+};
+
+static char *gurv_fields[] = {
+  "login",
+  "reservation",
+};
+
+static struct validate gurv_validate = {
+  VOuser0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  get_user_reservations,
+};
+
+static char *gubr_fields[] = {
+  "reservation",
+  "login",
+};
+
+static struct validate gubr_validate = {
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  get_user_by_reservation,
+};
+
 static char *gkum_fields[] = { "login", "kerberos",
                                   "login", "kerberos" };
 
@@ -453,7 +687,7 @@ static struct validate ufbl_validate = {
 
 static char *gpob_fields[] = {
   "login",
-  "login", "type", "box", "modtime", "modby", "modwith",
+  "login", "type", "box", "address", "modtime", "modby", "modwith",
 };
 
 static struct validate gpob_validate = {
@@ -501,7 +735,7 @@ static struct validate spob_validate =      /* SET_POBOX */
   0,
   0,
   0,
-  access_user,
+  access_spob,
   0,
   set_pobox,
 };
@@ -515,8 +749,8 @@ static struct validate spop_validate =      /* SET_POBOX_POP */
   0,
   0,
   access_user,
-  setup_spop,
-  set_pobox_modtime,
+  0,
+  set_pobox_pop,
 };
 
 static struct validate dpob_validate = /* DELETE_POBOX */
@@ -537,7 +771,7 @@ static char *gmac_fields[] = {
   "name", "type", "modtime", "modby", "modwith",
 };
 
-static char *ghst_fields[] = {
+static char *ghst2_fields[] = {
   "name", "address", "location", "network",
   "name", "vendor", "model", "os", "location", "contact", "use",
   "status", "status_change", "network", "address", "ace_type",
@@ -545,6 +779,30 @@ static char *ghst_fields[] = {
   "inuse", "modtime", "modby", "modwith",
 };
 
+static char *ghbh2_fields[] = {
+  "hwaddr",
+  "name", "vendor", "model", "os", "location", "contact", "use",
+  "status", "status_change", "network", "address", "ace_type",
+  "ace_name", "admin_comment", "ops_comment", "created", "creator",
+  "inuse", "modtime", "modby", "modwith",
+};
+
+static char *ghst_fields[] = {
+  "name", "address", "location", "network",
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "use", "status", "status_change", "network", "address", "ace_type",
+  "ace_name", "admin_comment", "ops_comment", "created", "creator",
+  "inuse", "modtime", "modby", "modwith",
+};
+
+static char *ghbh_fields[] = {
+  "hwaddr",
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "use", "status", "status_change", "network", "address", "ace_type",
+  "ace_name", "admin_comment", "ops_comment", "created", "creator",
+  "inuse", "modtime", "modby", "modwith",
+};
+
 static struct validate ghst_validate = {
   0,
   0,
@@ -562,13 +820,13 @@ static char *ghha_fields[] = {
   "hwaddr",
 };
 
-static char *ahst_fields[] = {
+static char *ahst2_fields[] = {
   "name", "vendor", "model", "os", "location", "contact", "use",
   "status", "subnet", "address", "ace_type", "ace_name",
   "admin_comment", "ops_comment",
 };
 
-static struct valobj ahst_valobj[] = {
+static struct valobj ahst2_valobj[] = {
   {V_CHAR, 0, MACHINE_TABLE, "name"},
   {V_CHAR, 1, MACHINE_TABLE, "vendor"},
   {V_CHAR, 2, MACHINE_TABLE, "model"},
@@ -584,9 +842,44 @@ static struct valobj ahst_valobj[] = {
   {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
 };
 
+static struct validate ahst2_validate = {
+  ahst2_valobj,
+  13,
+  "name",
+  "name = UPPER('%s')",
+  1,
+  "mach_id",
+  access_host,
+  setup_ahst,
+  set_uppercase_modtime,
+};
+
+static char *ahst_fields[] = {
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "use", "status", "subnet", "address", "ace_type", "ace_name",
+  "admin_comment", "ops_comment",
+};
+
+static struct valobj ahst_valobj[] = {
+  {V_CHAR, 0, MACHINE_TABLE, "name"},
+  {V_CHAR, 1, MACHINE_TABLE, "vendor"},
+  {V_CHAR, 2, MACHINE_TABLE, "model"},
+  {V_CHAR, 3, MACHINE_TABLE, "os"},
+  {V_CHAR, 4, MACHINE_TABLE, "location"},
+  {V_CHAR, 5, MACHINE_TABLE, "contact"},
+  {V_CHAR, 6, MACHINE_TABLE, "billing_contact"},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_ID, 9, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
+  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
+  {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+};
+
 static struct validate ahst_validate = {
   ahst_valobj,
-  13,
+  14,
   "name",
   "name = UPPER('%s')",
   1,
@@ -596,14 +889,14 @@ static struct validate ahst_validate = {
   set_uppercase_modtime,
 };
 
-static char *uhst_fields[] = {
+static char *uhst2_fields[] = {
   "name",
   "newname", "vendor", "model", "os", "location", "contact", "use",
   "status", "subnet", "address", "ace_type", "ace_name",
   "admin_comment", "ops_comment",
 };
 
-static struct valobj uhst_valobj[] = {
+static struct valobj uhst2_valobj[] = {
   {V_CHAR, 0, MACHINE_TABLE, "name"},
   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
   {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
@@ -621,8 +914,8 @@ static struct valobj uhst_valobj[] = {
   {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
 };
 
-static struct validate uhst_validate = {
-  uhst_valobj,
+static struct validate uhst2_validate = {
+  uhst2_valobj,
   15,
   0,
   0,
@@ -633,6 +926,44 @@ static struct validate uhst_validate = {
   set_modtime_by_id,
 };
 
+static char *uhst_fields[] = {
+  "name",
+  "newname", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "use", "status", "subnet", "address", "ace_type", "ace_name",
+  "admin_comment", "ops_comment",
+};
+
+static struct valobj uhst_valobj[] = {
+  {V_CHAR, 0, MACHINE_TABLE, "name"},
+  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
+  {V_CHAR, 2, MACHINE_TABLE, "vendor"},
+  {V_CHAR, 3, MACHINE_TABLE, "model"},
+  {V_CHAR, 4, MACHINE_TABLE, "os"},
+  {V_CHAR, 5, MACHINE_TABLE, "location"},
+  {V_CHAR, 6, MACHINE_TABLE, "contact"},
+  {V_CHAR, 7, MACHINE_TABLE, "billing_contact"},
+  {V_NUM, 8},
+  {V_NUM, 9},
+  {V_ID, 10, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
+  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 13, 0, 0, 0, MR_ACE},
+  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_ID, 15, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+};
+
+static struct validate uhst_validate = {
+  uhst_valobj,
+  16,
+  0,
+  0,
+  0,
+  "mach_id",
+  access_host,
+  setup_ahst,
+  set_modtime_by_id,
+};
+
 static char *uhha_fields[] = {
   "name",
   "hwaddr"
@@ -951,12 +1282,26 @@ static struct validate dcld_validate =
   set_cluster_modtime_by_id,
 };
 
-static char *glin_fields[] = {
+static char *glin2_fields[] = {
   "name",
   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "ace_type", "ace_name", "description", "modtime", "modby", "modwith",
 };
 
+static char *glin3_fields[] = {
+  "name",
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "description", "modtime", "modby", 
+  "modwith",
+};
+
+static char *glin_fields[] = {
+  "name",
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
+  "description", "modtime", "modby", "modwith",
+};
+
 static struct validate glin_validate = {
   0,
   0,
@@ -969,12 +1314,12 @@ static struct validate glin_validate = {
   followup_glin,
 };
 
-static char *alis_fields[] = {
+static char *alis2_fields[] = {
   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "ace_type", "ace_name", "description",
 };
 
-static struct valobj alis_valobj[] = {
+static struct valobj alis2_valobj[] = {
   {V_CHAR, 0, LIST_TABLE, "name"},
   {V_NUM, 1},
   {V_NUM, 2},
@@ -987,9 +1332,74 @@ static struct valobj alis_valobj[] = {
   {V_LEN, 9, LIST_TABLE, "description"},
 };
 
+static struct validate alis2_validate = {
+  alis2_valobj,
+  10,
+  "name",
+  "name = '%s'",
+  1,
+  "list_id",
+  0,
+  setup_alis,
+  set_modtime,
+};
+
+static char *alis3_fields[] = {
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "description",
+};
+
+static struct valobj alis3_valobj[] = {
+  {V_CHAR, 0, LIST_TABLE, "name"},
+  {V_NUM, 1},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 10, LIST_TABLE, "description"},
+};
+
+static struct validate alis3_validate = {
+  alis3_valobj,
+  11,
+  "name",
+  "name = '%s'",
+  1,
+  "list_id",
+  0,
+  setup_alis,
+  set_modtime,
+};
+
+static char *alis_fields[] = {
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
+  "description",
+};
+
+static struct valobj alis_valobj[] = {
+  {V_CHAR, 0, LIST_TABLE, "name"},
+  {V_NUM, 1},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 12, LIST_TABLE, "description"},
+};
+
 static struct validate alis_validate = {
   alis_valobj,
-  10,
+  13,
   "name",
   "name = '%s'",
   1,
@@ -999,13 +1409,13 @@ static struct validate alis_validate = {
   set_modtime,
 };
 
-static char *ulis_fields[] = {
+static char *ulis2_fields[] = {
   "name",
   "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
   "ace_type", "ace_name", "description",
 };
 
-static struct valobj ulis_valobj[] = {
+static struct valobj ulis2_valobj[] = {
   {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
   {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
   {V_NUM, 2},
@@ -1019,9 +1429,78 @@ static struct valobj ulis_valobj[] = {
   {V_LEN, 10, LIST_TABLE, "description"},
 };
 
+static struct validate ulis2_validate = {
+  ulis2_valobj,
+  11,
+  "name",
+  "list_id = %d",
+  1,
+  "list_id",
+  access_list,
+  setup_alis,
+  set_modtime_by_id,
+};
+
+static char *ulis3_fields[] = {
+  "name",
+  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid", 
+  "nfsgroup", "ace_type", "ace_name", "description",
+};
+
+static struct valobj ulis3_valobj[] = {
+  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
+  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 11, LIST_TABLE, "description"},
+};
+
+static struct validate ulis3_validate = {
+  ulis3_valobj,
+  12,
+  "name", 
+  "list_id = %d",
+  1,
+  "list_id",
+  access_list,
+  setup_alis,
+  set_modtime_by_id,
+};
+
+static char *ulis_fields[] = {
+  "name",
+  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
+  "description",
+};
+
+static struct valobj ulis_valobj[] = {
+  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
+  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_NUM, 3},
+  {V_NUM, 4},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 12, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 13, LIST_TABLE, "description"},
+};
+
 static struct validate ulis_validate = {
   ulis_valobj,
-  11,
+  14,
   "name",
   "list_id = %d",
   1,
@@ -1092,13 +1571,13 @@ static struct validate tmol_validate =
 {
   amtl_valobj,
   4,
-  "tag",
-  "list_id = %d AND member_type = '%s' AND member_id = %d",
-  3,
   0,
-  access_list,
   0,
   0,
+  0,
+  access_list,
+  0,
+  tag_member_of_list,
 };
 
 static struct validate dmfl_validate =
@@ -1136,6 +1615,28 @@ static struct validate gaus_validate = {
   get_ace_use,
 };
 
+static char *ghbo_fields[] = {
+  "ace_type", "ace_name",
+  "name",
+};
+
+static struct valobj ghbo_valobj[] = {
+  {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
+  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
+};
+
+static struct validate ghbo_validate = {
+  ghbo_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  access_member,
+  0,
+  get_host_by_owner,
+};
+
 static char *qgli_fields[] = {
   "active", "publicflg", "hidden", "maillist", "grouplist",
   "list",
@@ -1239,7 +1740,7 @@ static struct validate gsin_validate =
   0,
   access_service,
   0,
-  followup_glin,
+  followup_gsin,
 };
 
 static char *qgsv_fields[] = {
@@ -1501,6 +2002,18 @@ static char *gfsl_fields[] = {
   "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
 };
 
+static struct validate gfsl_validate = {
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  access_filesys,
+  0,
+  followup_fix_modby,
+};
+
 static char *gfsm_fields[] = {
   "machine",
   "label", "type", "machine", "name", "mount", "access", "comments",
@@ -1520,7 +2033,7 @@ static struct validate gfsm_validate = {
 };
 
 static char *gfsn_fields[] = {
-  "machine", "parition",
+  "machine", "partition",
   "label", "type", "machine", "name", "mount", "access", "comments",
   "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
 };
@@ -1925,13 +2438,20 @@ static struct validate dnfq_validate = {
   followup_dqot,
 };
 
-static char *gzcl_fields[] = {
+static char *gzcl2_fields[] = {
   "class",
   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
   "modtime", "modby", "modwith",
 };
 
+static char *gzcl_fields[] = {
+  "class",
+  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type",
+  "owner_id", "modtime", "modby", "modwith",
+};
+
 static struct validate gzcl_validate = {
   0,
   0,
@@ -1939,14 +2459,44 @@ static struct validate gzcl_validate = {
   0,
   0,
   0,
-  0,
+  access_zephyr,
   0,
   followup_gzcl,
 };
 
-static char *azcl_fields[] = {
+static char *azcl2_fields[] = {
   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
+};  
+
+static struct valobj azcl2_valobj[] = {
+  {V_CHAR, 0, ZEPHYR_TABLE, "class"},
+  {V_TYPE, 1, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 2, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 3, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 4, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 5, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
+};
+
+static struct validate azcl2_validate = {
+  azcl2_valobj,
+  9,
+  "class",
+  "class = '%s'",
+  1,
+  0,
+  0,
+  0,
+  set_zephyr_modtime,
+};
+
+static char *azcl_fields[] = {
+  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type", 
+  "owner_id",
 };
 
 static struct valobj azcl_valobj[] = {
@@ -1959,11 +2509,13 @@ static struct valobj azcl_valobj[] = {
   {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
   {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
   {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate azcl_validate = {
   azcl_valobj,
-  9,
+  11,
   "class",
   "class = '%s'",
   1,
@@ -1973,11 +2525,41 @@ static struct validate azcl_validate = {
   set_zephyr_modtime,
 };
 
-static char *uzcl_fields[] = {
+static char *uzcl2_fields[] = {
   "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
   "iws_type", "iws_name", "iui_type", "iui_name",
 };
 
+static struct valobj uzcl2_valobj[] = {
+  {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
+  {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
+  {V_TYPE, 2, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 3, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 4, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 5, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 6, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+};
+
+static struct validate uzcl2_validate = {
+  uzcl2_valobj,
+  10,
+  "class",
+  "class = '%s'",
+  1,
+  0,
+  access_zephyr,
+  0,
+  set_zephyr_modtime,
+};
+
+static char *uzcl_fields[] = {
+  "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
+  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type", "owner_id",
+};
+
 static struct valobj uzcl_valobj[] = {
   {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
   {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
@@ -1989,16 +2571,18 @@ static struct valobj uzcl_valobj[] = {
   {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
   {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
   {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
 };
 
 static struct validate uzcl_validate = {
   uzcl_valobj,
-  10,
+  12,
   "class",
   "class = '%s'",
   1,
   0,
-  0,
+  access_zephyr,
   0,
   set_zephyr_modtime,
 };
@@ -2103,7 +2687,7 @@ static struct validate aacl_validate =
 };
 
 static char *gsvc_fields[] = {
-  "service",
+  "service", "protocol",
   "service", "protocol", "port", "description", "modtime", "modby", "modwith",
 };
 
@@ -2111,6 +2695,10 @@ static char *asvc_fields[] = {
   "service", "protocol", "port", "description",
 };
 
+static char *dsvc_fields[] = {
+  "service", "protocol",
+};
+
 static struct valobj asvc_valobj[] = {
   {V_CHAR, 0, SERVICES_TABLE, "name"},
   {V_CHAR, 1, SERVICES_TABLE, "protocol"},
@@ -2122,12 +2710,24 @@ static struct validate asvc_validate = {
   asvc_valobj,
   4,
   "name",
-  "name = '%s'",
-  1,
+  "name = '%s' AND protocol = '%s'",
+  2,
+  0,
+  0,
+  0,
+  set_service_modtime,
+};
+
+static struct validate dsvc_validate = {
+  asvc_valobj,
+  2,
+  "name",
+  "name = '%s' AND protocol = '%s'",
+  2,
+  0,
   0,
   0,
   0,
-  set_modtime,
 };
 
 static char *gprn_fields[] = {
@@ -2438,24 +3038,281 @@ static struct validate _sdl_validate =
   _sdl_followup,
 };
 
+static char *gusl_fields[] = {
+  "login", "domain_sid", 
+  "login", "sid", "created",
+};
+
+static struct validate gusl_validate =
+{
+  VOuser0,
+  1,
+  NULL,
+  NULL,
+  0,
+  0,
+  0,
+  0,
+  0,
+};
+
+static char *glsn_fields[] = {
+  "name", "domain_sid",
+  "name", "sid", "created",
+};
+
+static struct validate glsn_validate = 
+{
+  VOlist0,
+  1,
+  NULL,
+  NULL,
+  0,
+  0,
+  0,
+  0,
+  0,
+};
+
+static char *ausl_fields[] = {
+  "login", "sid",
+};
+
+static struct validate ausl_validate =
+{
+  VOuser0,
+  1,
+  "sid",
+  "users_id = %d AND sid = '%s'",
+  2,
+  0,
+  0,
+  0,
+  0,
+};
+
+static char *alsn_fields[] = {
+  "name", "sid",
+};
+
+static struct validate alsn_validate =
+{
+  VOlist0,
+  1,
+  "sid",
+  "list_id = %d AND sid = '%s'",
+  2,
+  0,
+  0,
+  0,
+  0,
+};
+
+static char *gdds_fields[] = {
+  "sid",
+};
+
+static char *gcon_fields[] = {
+  "name",
+  "name", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
+};
+
+static struct validate gcon_validate = {
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  followup_gcon,
+};
+
+static char *acon_fields[] = {
+  "name", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
+
+static struct valobj acon_valobj[] = {
+  {V_CHAR, 0, CONTAINERS_TABLE, "name"},
+  {V_LEN, 1, CONTAINERS_TABLE, "description"},
+  {V_CHAR, 2, CONTAINERS_TABLE, "location"},
+  {V_CHAR, 3, CONTAINERS_TABLE, "contact"},
+  {V_TYPE, 4, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 5, 0, 0, 0, MR_ACE},
+  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
+};
+
+static struct validate acon_validate =
+{
+  acon_valobj,
+  8,
+  "name",
+  "name = '%s'",
+  1,
+  "cnt_id",
+  0,
+  prefetch_value,
+  set_modtime,
+};
+
+static char *ucon_fields[] = {
+  "name",
+  "newname", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
+
+static struct valobj ucon_valobj[] = {
+  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+  {V_RENAME, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_NOT_UNIQUE},
+  {V_LEN, 2, CONTAINERS_TABLE, "description"},
+  {V_CHAR, 3, CONTAINERS_TABLE, "location"},
+  {V_CHAR, 4, CONTAINERS_TABLE, "contact"},
+  {V_TYPE, 5, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 6, 0, 0, 0, MR_ACE},
+  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
+};
+
+static struct validate ucon_validate =
+{
+  ucon_valobj,
+  9,
+  0,
+  0,
+  0,
+  0,
+  access_container,
+  0,
+  update_container,
+};
+
+static char *dcon_fields[] = {
+  "name",
+};
+
+static struct validate dcon_validate =
+{
+  VOcon0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  setup_dcon,
+  0,
+};
+
+static char *amcn_fields[] = {
+  "machine", "container",
+};
+
+static struct valobj amcn_valobj[] =   /* ADD_MACHINE_TO_CONTAINER */
+{                                      /* DELETE_MACHINE_FROM_CONTAINER */
+  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_ID, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+};
+
+static struct validate amcn_validate = /* for amtn and dmfn */
+{
+  amcn_valobj,
+  2,
+  "mach_id",
+  "mach_id = %d",
+  1,
+  0,
+  access_container,
+  0,
+  set_mach_modtime_by_id,
+};
+
+static struct validate dmcn_validate = /* for amtn and dmfn */
+{
+  amcn_valobj,
+  2,
+  "mach_id",
+  "mach_id = %d and cnt_id = %d",
+  2,
+  0,
+  access_container,
+  0,
+  set_mach_modtime_by_id,
+};
+
+static char *gmnm_fields[] = {
+  "machine",
+  "machine", "container",
+};
+
+static char *gmoc_fields[] = {
+  "container",
+  "isrecursive",
+       "machine",
+  "container",
+};
+
+static struct validate gmoc_validate = 
+{
+  VOcon0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  get_machines_of_container,
+};
+
+static char *gsoc_fields[] = {
+  "container",
+  "isrecursive",
+       "subcontainer",
+};
+
+static struct validate gsoc_validate = 
+{
+  VOcon0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  get_subcontainers_of_container,
+};
+
+static char *gtlc_fields[] = {
+  "name",
+};
+
 
-\f
 /* Generalized Query Definitions */
 
+/* Multiple versions of the same query MUST be listed in ascending
+ * order.
+ */
+
 /* Note: For any query which uses prefetch_value, the vcnt should be
  * one less than the number of %-format specifiers in the tlist.
  */
 
-struct query Queries2[] = {
+struct query Queries[] = {
   {
-    /* Q_GALO - GET_ALL_LOGINS */
+    /* Q_GALO - GET_ALL_LOGINS, v2 */
     "get_all_logins",
     "galo",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
-    galo_fields,
+    galo2_fields,
     6,
     "u.users_id != 0",
     0,
@@ -2464,14 +3321,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS */
+    /* Q_GALO - GET_ALL_LOGINS, v3 */
+    "get_all_logins",
+    "galo",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
+    galo_fields,
+    7,
+    "u.users_id != 0",
+    0,
+    "u.login",
+    0,
+  },
+
+  {
+    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v2 */
     "get_all_active_logins",
     "gaal",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
-    galo_fields,
+    galo2_fields,
     6,
     "u.status = 1",
     0,
@@ -2480,14 +3355,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN */
+    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v3 */
+    "get_all_active_logins",
+    "gaal",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
+    galo_fields,
+    7,
+    "u.status = 1",
+    0,
+    "u.login",
+    0,
+  },
+
+  {
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v2 */
     "get_user_account_by_login",
     "gual",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
-    gual_fields,
+    "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,
     15,
     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -2496,14 +3389,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID */
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v3 */
+    "get_user_account_by_login",
+    "gual",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
+    gual_fields,
+    16,
+    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubl_validate,
+  },
+
+  {
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v2 */
     "get_user_account_by_uid",
     "guau",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
-    guau_fields,
+    "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,
     15,
     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -2512,14 +3423,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME */
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v3 */
+    "get_user_account_by_uid",
+    "guau",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
+    guau_fields,
+    16,
+    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubu_validate,
+  },
+
+  {
+    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v2 */
     "get_user_account_by_name",
     "guan",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
-    guan_fields,
+    "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,
     15,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
@@ -2528,14 +3457,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS */
-    "get_user_account_by_class",
-    "guac",
+    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v3 */
+    "get_user_account_by_name",
+    "guan",
+    3,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
-    guac_fields,
+    "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 FROM users u, strings str",
+    guan_fields,
+    16,
+    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
+    2,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v2 */
+    "get_user_account_by_class",
+    "guac",
+    2,
+    RETRIEVE,
+    "u",
+    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,
     15,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -2544,14 +3491,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID */
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v3 */
+    "get_user_account_by_class",
+    "guac",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
+    guac_fields,
+    16,
+    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &VDfix_modby,
+  },
+
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v2 */
     "get_user_account_by_id",
     "guai",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
-    guam_fields,
+    "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,
     15,
     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -2560,14 +3525,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUBL - GET_USER_BY_LOGIN */
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v3 */
+    "get_user_account_by_id",
+    "guai",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
+    guam_fields,
+    16,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &VDfix_modby,
+  },
+
+  {
+    /* Q_GUBL - GET_USER_BY_LOGIN, v2 */
     "get_user_by_login",
     "gubl",
+    2,
     RETRIEVE,
     "u",
     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",
-    gubl_fields,
+    gubl2_fields,
     12,
     "u.login LIKE '%s' AND u.users_id != 0",
     1,
@@ -2576,14 +3559,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUBU - GET_USER_BY_UID */
+    /* Q_GUBL - GET_USER_BY_LOGIN, v3 */
+    "get_user_by_login",
+    "gubl",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
+    gubl_fields,
+    13,
+    "u.login LIKE '%s' AND u.users_id != 0",
+    1,
+    "u.login",
+    &gubl_validate,
+  },
+
+  {
+    /* Q_GUBU - GET_USER_BY_UID, v2 */
     "get_user_by_uid",
     "gubu",
+    2,
     RETRIEVE,
     "u",
     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",
-    gubu_fields,
+    gubu2_fields,
     12,
     "u.unix_uid = %s AND u.users_id != 0",
     1,
@@ -2592,14 +3593,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUBN - GET_USER_BY_NAME */
+    /* Q_GUBU - GET_USER_BY_UID, v3 */
+    "get_user_by_uid",
+    "gubu",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
+    gubu_fields,
+    13,
+    "u.unix_uid = %s AND u.users_id != 0",
+    1,
+    "u.login",
+    &gubu_validate,
+  },
+
+  {
+    /* Q_GUBN - GET_USER_BY_NAME, v2 */
     "get_user_by_name",
     "gubn",
+    2,
     RETRIEVE,
     "u",
     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",
-    gubn_fields,
+    gubn2_fields,
     12,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
     2,
@@ -2608,14 +3627,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUBC - GET_USER_BY_CLASS */
+    /* Q_GUBN - GET_USER_BY_NAME, v3 */
+    "get_user_by_name",
+    "gubn",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
+    gubn_fields,
+    13,
+    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
+    2,
+    "u.login",
+    &gubn_validate,
+  },
+
+  {
+    /* Q_GUBC - GET_USER_BY_CLASS, v2 */
     "get_user_by_class",
     "gubc",
+    2,
     RETRIEVE,
     "u",
     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",
-    gubc_fields,
+    gubc2_fields,
     12,
     "u.type = UPPER('%s') AND u.users_id != 0",
     1,
@@ -2624,14 +3661,32 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GUBM - GET_USER_BY_MITID */
+    /* Q_GUBC - GET_USER_BY_CLASS, v3 */
+    "get_user_by_class",
+    "gubc",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
+    gubc_fields,
+    13,
+    "u.type = UPPER('%s') AND u.users_id != 0",
+    1,
+    "u.login",
+    &VDfix_modby,
+  },
+
+  {
+    /* Q_GUBM - GET_USER_BY_MITID, v2 */
     "get_user_by_mitid",
     "gubm",
+    2,
     RETRIEVE,
     "u",
     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",
-    gubm_fields,
+    gubm2_fields,
     12,
     "u.clearid LIKE '%s' AND u.users_id != 0",
     1,
@@ -2640,34 +3695,93 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_AUAC - ADD_USER_ACCOUNT */  /* uses prefetch_value() for users_id */
+    /* Q_GUBM - GET_USER_BY_MITID, v3 */
+    "get_user_by_mitid",
+    "gubm",
+    3,
+    RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u",
+    gubm_fields,
+    13,
+    "u.clearid LIKE '%s' AND u.users_id != 0",
+    1,
+    "u.login",
+    &VDfix_modby,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v2 */  /* uses prefetch_value() for users_id */
     "add_user_account",
     "auac",
+    2,
     APPEND,
     "u",
     USERS_TABLE,
-    "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, LENGTH(NVL('%s', CHR(0))), %s, %s)", /* followup_ausr fixes signature field */
-    auac_fields,
+    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
+     * but using up one argv element.
+     */
+    "INTO users (login, unix_uid, shell, 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,
     NULL,
     0,
     NULL,
+    &auac2_validate,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v3 */  /* uses prefetch_value() for users_id */
+    "add_user_account",
+    "auac",
+    3,
+    APPEND,
+    "u",
+    USERS_TABLE,
+    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
+     * but using up one argv element.
+     */
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, users_id) 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)",
+    auac_fields,
+    13,
+    NULL,
+    0,
+    NULL,
     &auac_validate,
   },
 
   {
-    /* Q_AUSR - ADD_USER */  /* uses prefetch_value() for users_id */
+    /* Q_AUSR - ADD_USER, v2 */  /* uses prefetch_value() for users_id */
     "add_user",
     "ausr",
+    2,
     APPEND,
     "u",
     USERS_TABLE,
     "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)",
-    auac_fields,
+    auac2_fields,
     9,
     0,
     0,
     NULL,
+    &ausr2_validate,
+  },
+
+  {
+    /* Q_AUSR - ADD_USER, v3 */  /* uses prefetch_value() for users_id */
+    "add_user",
+    "ausr",
+    3,
+    APPEND,
+    "u",
+    USERS_TABLE,
+    "INTO users (login, unix_uid, shell, winconsoleshell, 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)",
+    auac_fields,
+    10,
+    0,
+    0,
+    NULL,
     &ausr_validate,
   },
 
@@ -2675,6 +3789,7 @@ struct query Queries2[] = {
     /* Q_RUSR - REGISTER_USER */
     "register_user",
     "rusr",
+    2,
     APPEND,
     0,
     0,
@@ -2688,34 +3803,72 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_UUAC - UPDATE_USER_ACCOUNT */
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v2 */
     "update_user_account",
     "uuac",
+    2,
     UPDATE,
     "u",
     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', comments = %d, signature = LENGTH(NVL('%s', CHR(0))), secure = %s", /* followup_uuac fixes signature */
-    uuac_fields,
+    /* See comment in auac about signature. */
+    "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,
     "users_id = %d",
     1,
     NULL,
+    &uuac2_validate,
+  },
+
+  {
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v3 */
+    "update_user_account",
+    "uuac",
+    3,
+    UPDATE,
+    "u",
+    USERS_TABLE,
+    /* See comment in auac about signature. */
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s",
+    uuac_fields,
+    13,
+    "users_id = %d",
+    1,
+    NULL,
     &uuac_validate,
   },
 
   {
-    /* Q_UUSR - UPDATE_USER */
+    /* Q_UUSR - UPDATE_USER, v2 */
     "update_user",
     "uusr",
+    2,
     UPDATE,
     "u",
     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'",
-    uuac_fields,
+    uuac2_fields,
     9,
     "users_id = %d",
     1,
     NULL,
+    &uusr2_validate,
+  },
+
+  {
+    /* Q_UUSR - UPDATE_USER, v3 */
+    "update_user",
+    "uusr",
+    3,
+    UPDATE,
+    "u",
+    USERS_TABLE,
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s'",
+    uuac_fields,
+    10,
+    "users_id = %d",
+    1,
+    NULL,
     &uusr_validate,
   },
 
@@ -2723,6 +3876,7 @@ struct query Queries2[] = {
     /* Q_UUSH - UPDATE_USER_SHELL */
     "update_user_shell",
     "uush",
+    2,
     UPDATE,
     "u",
     USERS_TABLE,
@@ -2735,10 +3889,28 @@ struct query Queries2[] = {
     &uush_validate,
   },
 
+  {
+    /* Q_UUWS - UPDATE_USER_WINDOWS_SHELL */
+    "update_user_windows_shell",
+    "uuws",
+    2,
+    UPDATE,
+    "u",
+    USERS_TABLE,
+    "users SET winconsoleshell = '%s'",
+    uuws_fields,
+    1,
+    "users_id = %d",
+    1,
+    NULL,
+    &uuws_validate,
+  },
+
   {
     /* Q_UUST - UPDATE_USER_STATUS */
     "update_user_status",
     "uust",
+    2,
     UPDATE,
     "u",
     USERS_TABLE,
@@ -2755,6 +3927,7 @@ struct query Queries2[] = {
     /* Q_UUSS - UPDATE_USER_SECURITY_STATUS */
     "update_user_security_status",
     "uuss",
+    2,
     UPDATE,
     "u",
     USERS_TABLE,
@@ -2771,22 +3944,92 @@ struct query Queries2[] = {
     /* Q_DUSR - DELETE_USER */
     "delete_user",
     "dusr",
+    2,
     DELETE,
     "u",
     USERS_TABLE,
     NULL,
     dusr_fields,
     0,
-    "users_id = %d",
-    1,
+    "users_id = %d",
+    1,
+    NULL,
+    &dusr_validate,
+  },
+
+  {
+    /* Q_AURV - ADD_USER_RESERVATION */
+    "add_user_reservation",
+    "aurv",
+    2,
+    UPDATE,
+    0,
+    USERS_TABLE,
+    0,
+    aurv_fields,
+    2,
+    0,
+    0,
+    NULL,
+    &aurv_validate,
+  },
+
+  {
+    /* Q_GURV - GET_USER_RESERVATIONS */
+    "get_user_reservations",
+    "gurv",
+    2,
+    RETRIEVE,
+    0,
+    USERS_TABLE,
+    0,
+    gurv_fields,
+    2,
+    0,
+    1,
+    NULL,
+    &gurv_validate,
+  },
+
+  {
+    /* Q_GUBR - GET_USER_BY_RESERVATION */
+    "get_user_by_reservation",
+    "gubr",
+    2,
+    RETRIEVE,
+    0,
+    USERS_TABLE,
+    0,
+    gubr_fields,
+    1,
+    0,
+    1,
+    NULL,
+    &gubr_validate,
+  },
+
+  {
+    /* Q_DURV - DELETE_USER_RESERVATION */
+    "delete_user_reservation",
+    "durv",
+    2,
+    UPDATE,
+    0,
+    USERS_TABLE,
+    0,
+    aurv_fields,
+    2,
+    0,
+    0,
     NULL,
-    &dusr_validate,
+    &aurv_validate,
   },
 
   {
     /* Q_GKUM - GET_KERBEROS_USER_MAP */
     "get_kerberos_user_map",
     "gkum",
+    2,
     RETRIEVE,
     "k",
     KRBMAP_TABLE,
@@ -2803,6 +4046,7 @@ struct query Queries2[] = {
     /* Q_AKUM - ADD_KERBEROS_USER_MAP */
     "add_kerberos_user_map",
     "akum",
+    2,
     APPEND,
     "k",
     KRBMAP_TABLE,
@@ -2819,6 +4063,7 @@ struct query Queries2[] = {
     /* Q_DKUM - DELETE_KERBEROS_USER_MAP */
     "delete_kerberos_user_map",
     "dkum",
+    2,
     DELETE,
     "k",
     KRBMAP_TABLE,
@@ -2835,6 +4080,7 @@ struct query Queries2[] = {
     /* Q_GFBL - GET_FINGER_BY_LOGIN */
     "get_finger_by_login",
     "gfbl",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
@@ -2851,6 +4097,7 @@ struct query Queries2[] = {
     /* Q_UFBL - UPDATE_FINGER_BY_LOGIN */
     "update_finger_by_login",
     "ufbl",
+    2,
     UPDATE,
     "u",
     USERS_TABLE,
@@ -2867,12 +4114,13 @@ struct query Queries2[] = {
     /* Q_GPOB - GET_POBOX */
     "get_pobox",
     "gpob",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "login, potype, pop_id || ':' || box_id, TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
+    "login, potype, users_id, CHR(0), TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
     gpob_fields,
-    6,
+    7,
     "users_id = %d",
     1,
     "login",
@@ -2883,6 +4131,7 @@ struct query Queries2[] = {
     /* Q_GAPO - GET_ALL_POBOXES */
     "get_all_poboxes",
     "gapo",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
@@ -2899,10 +4148,11 @@ struct query Queries2[] = {
     /* Q_GPOP - GET_POBOXES_POP */
     "get_poboxes_pop",
     "gpop",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "login, potype, pop_id || ':' || box_id FROM users",
+    "login, potype, users_id FROM users",
     gpox_fields,
     3,
     "potype = 'POP'",
@@ -2915,10 +4165,11 @@ struct query Queries2[] = {
     /* Q_GPOF - GET_POBOXES_SMTP */
     "get_poboxes_smtp",
     "gpos",
+    2,
     RETRIEVE,
     "u",
     USERS_TABLE,
-    "login, potype, pop_id || ':' || box_id FROM users",
+    "login, potype, users_id FROM users",
     gpox_fields,
     3,
     "potype = 'SMTP'",
@@ -2931,6 +4182,7 @@ struct query Queries2[] = {
     /* Q_SPOB - SET_POBOX */
     "set_pobox",
     "spob",
+    2,
     UPDATE,
     0,
     USERS_TABLE,
@@ -2947,15 +4199,16 @@ struct query Queries2[] = {
     /* Q_SPOP - SET_POBOX_POP */
     "set_pobox_pop",
     "spop",
+    2,
     UPDATE,
-    "u",
+    0,
     USERS_TABLE,
-    "users SET potype = 'POP'",
-    spob_fields,
     0,
-    "users_id = %d",
+    spob_fields,
     1,
     NULL,
+    0,
+    NULL,
     &spop_validate,
   },
 
@@ -2963,6 +4216,7 @@ struct query Queries2[] = {
     /* Q_DPOB - DELETE_POBOX */
     "delete_pobox",
     "dpob",
+    2,
     UPDATE,
     "u",
     USERS_TABLE,
@@ -2976,14 +4230,15 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GHST - GET_HOST */
+    /* Q_GHST - GET_HOST, v2 */
     "get_host",
     "ghst",
+    2,
     RETRIEVE,
     "m",
     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",
-    ghst_fields,
+    ghst2_fields,
     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,
@@ -2992,25 +4247,61 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GHBH - GET_HOST_BY_HWADDR */
+    /* Q_GHST - GET_HOST, v6 */
+    "get_host",
+    "ghst",
+    6,
+    RETRIEVE,
+    "m",
+    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",
+    ghst_fields,
+    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,
+    "m.name",
+    &ghst_validate,
+  },
+
+  {
+    /* Q_GHBH - GET_HOST_BY_HWADDR, v2 */
     "get_host_by_hwaddr",
     "ghbh",
+    2,
     RETRIEVE,
     "m",
     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",
-    ghst_fields,
+    ghbh2_fields,
     21,
     "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     1,
     "m.name",
-    NULL,
+    &ghst_validate,
+  },
+
+  {
+    /* Q_GHBH - GET_HOST_BY_HWADDR, v6 */
+    "get_host_by_hwaddr",
+    "ghbh",
+    6,
+    RETRIEVE,
+    "m",
+    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",
+    ghbh_fields,
+    22,
+    "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
+    1,
+    "m.name",
+    &ghst_validate,
   },
 
   {
     /* Q_GHHA - GET_HOST_HWADDR */
     "get_host_hwaddr",
     "ghha",
+    2,
     RETRIEVE,
     "m",
     MACHINE_TABLE,
@@ -3024,34 +4315,70 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_AHST - ADD_HOST */ /* uses prefetch_value() for mach_id */
+    /* Q_AHST - ADD_HOST, v2 */ /* uses prefetch_value() for mach_id */
     "add_host",
     "ahst",
+    2,
     APPEND,
     "m",
     MACHINE_TABLE,
     "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)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
-    ahst_fields,
+    ahst2_fields,
     14,
     0,
     0,
     NULL,
+    &ahst2_validate,
+  },
+
+  {
+    /* Q_AHST - ADD_HOST, v6 */ /* uses prefetch_value() for mach_id */
+    "add_host",
+    "ahst",
+    6,
+    APPEND,
+    "m",
+    MACHINE_TABLE,
+    "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)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
+    ahst_fields,
+    15,
+    0,
+    0,
+    NULL,
     &ahst_validate,
   },
 
   {
-    /* Q_UHST - UPDATE_HOST */
+    /* Q_UHST - UPDATE_HOST, v2 */
     "update_host",
     "uhst",
+    2,
     UPDATE,
     "m",
     MACHINE_TABLE,
     "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 = %s, status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
-    uhst_fields,
+    uhst2_fields,
     14,
     "mach_id = %d",
     1,
     NULL,
+    &uhst2_validate,
+  },
+
+  {
+    /* Q_UHST - UPDATE_HOST, v6 */
+    "update_host",
+    "uhst",
+    6,
+    UPDATE,
+    "m",
+    MACHINE_TABLE,
+    "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 = %s, status = %s, snet_id = %d, address = '%s', owner_type = '%s', owner_id = %d, acomment = %d, ocomment = %d",
+    uhst_fields,
+    15,
+    "mach_id = %d",
+    1,
+    NULL,
     &uhst_validate,
   },
 
@@ -3059,6 +4386,7 @@ struct query Queries2[] = {
     /* Q_UHHA - UPDATE_HOST_HWADDR */
     "update_host_hwaddr",
     "uhha",
+    2,
     UPDATE,
     "m",
     MACHINE_TABLE,
@@ -3075,6 +4403,7 @@ struct query Queries2[] = {
     /* Q_DHST - DELETE_HOST */
     "delete_host",
     "dhst",
+    2,
     DELETE,
     "m",
     MACHINE_TABLE,
@@ -3091,6 +4420,7 @@ struct query Queries2[] = {
     /* Q_GMAC - GET_MACHINE */
     "get_machine",
     "gmac",
+    2,
     RETRIEVE,
     "m",
     MACHINE_TABLE,
@@ -3107,6 +4437,7 @@ struct query Queries2[] = {
     /* Q_GHAL - GET_HOSTALIAS */
     "get_hostalias",
     "ghal",
+    2,
     RETRIEVE,
     "a",
     HOSTALIAS_TABLE,
@@ -3123,6 +4454,7 @@ struct query Queries2[] = {
     /* Q_AHAL - ADD_HOSTALIAS */
     "add_hostalias",
     "ahal",
+    2,
     APPEND,
     "a",
     HOSTALIAS_TABLE,
@@ -3139,6 +4471,7 @@ struct query Queries2[] = {
     /* Q_DHAL - DELETE_HOSTALIAS */
     "delete_hostalias",
     "dhal",
+    2,
     DELETE,
     "a",
     HOSTALIAS_TABLE,
@@ -3155,6 +4488,7 @@ struct query Queries2[] = {
     /* Q_GSNT - GET_SUBNET */
     "get_subnet",
     "gsnt",
+    2,
     RETRIEVE,
     "s",
     SUBNET_TABLE,
@@ -3171,6 +4505,7 @@ struct query Queries2[] = {
     /* Q_ASNT - ADD_SUBNET */
     "add_subnet",
     "asnt",
+    2,
     APPEND,
     "s",
     SUBNET_TABLE,
@@ -3187,6 +4522,7 @@ struct query Queries2[] = {
     /* Q_USNT - UPDATE_SUBNET */
     "update_subnet",
     "usnt",
+    2,
     UPDATE,
     "s",
     SUBNET_TABLE,
@@ -3203,6 +4539,7 @@ struct query Queries2[] = {
     /* Q_DSNT - DELETE_SUBNET */
     "delete_subnet",
     "dsnt",
+    2,
     DELETE,
     "s",
     SUBNET_TABLE,
@@ -3219,6 +4556,7 @@ struct query Queries2[] = {
     /* Q_GCLU - GET_CLUSTER */
     "get_cluster",
     "gclu",
+    2,
     RETRIEVE,
     "c",
     CLUSTERS_TABLE,
@@ -3235,6 +4573,7 @@ struct query Queries2[] = {
     /* Q_ACLU - ADD_CLUSTER */ /* uses prefetch_value() for clu_id */
     "add_cluster",
     "aclu",
+    2,
     APPEND,
     "c",
     CLUSTERS_TABLE,
@@ -3251,6 +4590,7 @@ struct query Queries2[] = {
     /* Q_UCLU - UPDATE_CLUSTER */
     "update_cluster",
     "uclu",
+    2,
     UPDATE,
     "c",
     CLUSTERS_TABLE,
@@ -3267,6 +4607,7 @@ struct query Queries2[] = {
     /* Q_DCLU - DELETE_CLUSTER */
     "delete_cluster",
     "dclu",
+    2,
     DELETE,
     "c",
     CLUSTERS_TABLE,
@@ -3283,6 +4624,7 @@ struct query Queries2[] = {
     /* Q_GMCM - GET_MACHINE_TO_CLUSTER_MAP */
     "get_machine_to_cluster_map",
     "gmcm",
+    2,
     RETRIEVE,
     "mcm",
     MCMAP_TABLE,
@@ -3299,6 +4641,7 @@ struct query Queries2[] = {
     /* Q_AMTC - ADD_MACHINE_TO_CLUSTER */
     "add_machine_to_cluster",
     "amtc",
+    2,
     APPEND,
     "mcm",
     MCMAP_TABLE,
@@ -3315,6 +4658,7 @@ struct query Queries2[] = {
     /* Q_DMFC - DELETE_MACHINE_FROM_CLUSTER */
     "delete_machine_from_cluster",
     "dmfc",
+    2,
     DELETE,
     "mcm",
     MCMAP_TABLE,
@@ -3331,6 +4675,7 @@ struct query Queries2[] = {
     /* Q_GCLD - GET_CLUSTER_DATA */
     "get_cluster_data",
     "gcld",
+    2,
     RETRIEVE,
     "svc",
     SVC_TABLE,
@@ -3347,6 +4692,7 @@ struct query Queries2[] = {
     /* Q_ACLD - ADD_CLUSTER_DATA */
     "add_cluster_data",
     "acld",
+    2,
     APPEND,
     "svc",
     SVC_TABLE,
@@ -3363,6 +4709,7 @@ struct query Queries2[] = {
     /* Q_DCLD - DELETE_CLUSTER_DATA */
     "delete_cluster_data",
     "dcld",
+    2,
     DELETE,
     "svc",
     SVC_TABLE,
@@ -3376,14 +4723,15 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GLIN - GET_LIST_INFO */
+    /* Q_GLIN - GET_LIST_INFO, v2 */
     "get_list_info",
     "glin",
+    2,
     RETRIEVE,
     "l",
     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",
-    glin_fields,
+    glin2_fields,
     13,
     "name LIKE '%s'",
     1,
@@ -3391,10 +4739,45 @@ struct query Queries2[] = {
     &glin_validate,
   },
 
+  {
+    /* Q_GLIN - GET_LIST_INFO, v3 */
+    "get_list_info",
+    "glin",
+    3,
+    RETRIEVE,
+    "l",
+    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,
+    14,
+    "name LIKE '%s'",
+    1,
+    "name",
+    &glin_validate,
+  },
+
+  {
+    /* Q_GLIN - GET_LIST_INFO, v4 */
+    "get_list_info",
+    "glin",
+    4,
+    RETRIEVE,
+    "l",
+    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",
+    glin_fields,
+    16,
+    "name LIKE '%s'",
+    1,
+    "name",
+    &glin_validate,
+  },
+
   {
     /* Q_EXLN - EXPAND_LIST_NAMES */
     "expand_list_names",
     "exln",
+    2,
     RETRIEVE,
     "l",
     LIST_TABLE,
@@ -3408,34 +4791,104 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_ALIS - ADD_LIST */ /* uses prefetch_value() for list_id */
+    /* Q_ALIS - ADD_LIST, v2 */ /* uses prefetch_value() for list_id */
     "add_list",
     "alis",
+    2,
     APPEND,
     "l",
     LIST_TABLE,
     "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)",
-    alis_fields,
+    alis2_fields,
     10,
     0,
     0,
     NULL,
+    &alis2_validate,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v3 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    3,
+    APPEND,
+    "l",
+    LIST_TABLE,
+    "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,
+    0,
+    0,
+    NULL,
+    &alis3_validate,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v4 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    4,
+    APPEND,
+    "l",
+    LIST_TABLE,
+    "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)",
+    alis_fields,
+    13,
+    0,
+    0,
+    NULL,
     &alis_validate,
   },
 
   {
-    /* Q_ULIS - UPDATE_LIST */
+    /* Q_ULIS - UPDATE_LIST, v2 */
     "update_list",
     "ulis",
+    2,
     UPDATE,
     "l",
     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))",
-    ulis_fields,
+    ulis2_fields,
     10,
     "list_id = %d",
     1,
     NULL,
+    &ulis2_validate,
+  },
+
+  {
+    /* Q_ULIS - UPDATE_LIST, v3 */
+    "update_list",
+    "ulis",
+    3,
+    UPDATE,
+    "l",
+    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,
+    11,
+    "list_id = %d",
+    1,
+    NULL,
+    &ulis3_validate,
+  },
+
+  {
+    /* Q_ULIS, UPDATE_LIST, v4 */
+    "update_list",
+    "ulis",
+    4,
+    UPDATE,
+    "l",
+    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))",
+    ulis_fields,
+    13,
+    "list_id = %d",
+    1,
+    NULL,
     &ulis_validate,
   },
 
@@ -3443,6 +4896,7 @@ struct query Queries2[] = {
     /* Q_DLIS - DELETE_LIST */
     "delete_list",
     "dlis",
+    2,
     DELETE,
     "l",
     LIST_TABLE,
@@ -3459,6 +4913,7 @@ struct query Queries2[] = {
     /* Q_AMTL - ADD_MEMBER_TO_LIST */
     "add_member_to_list",
     "amtl",
+    2,
     APPEND,
     0,
     IMEMBERS_TABLE,
@@ -3475,6 +4930,7 @@ struct query Queries2[] = {
     /* Q_ATML - ADD_TAGGED_MEMBER_TO_LIST */
     "add_tagged_member_to_list",
     "atml",
+    2,
     APPEND,
     0,
     IMEMBERS_TABLE,
@@ -3491,13 +4947,14 @@ struct query Queries2[] = {
     /* Q_TMOL - TAG_MEMBER_OF_LIST */
     "tag_member_of_list",
     "tmol",
+    2,
     UPDATE,
-    "im",
+    0,
     IMEMBERS_TABLE,
-    "imembers SET tag = %d",
+    0,
     atml_fields,
     1,
-    "list_id = %d AND member_type = '%s' and member_id = %d",
+    0,
     3,
     NULL,
     &tmol_validate,
@@ -3507,6 +4964,7 @@ struct query Queries2[] = {
     /* Q_DMFL - DELETE_MEMBER_FROM_LIST */
     "delete_member_from_list",
     "dmfl",
+    2,
     DELETE,
     0,
     IMEMBERS_TABLE,
@@ -3523,6 +4981,7 @@ struct query Queries2[] = {
     /* Q_GAUS - GET_ACE_USE */
     "get_ace_use",
     "gaus",
+    2,
     RETRIEVE,
     0,
     0,
@@ -3535,10 +4994,28 @@ struct query Queries2[] = {
     &gaus_validate,
   },
 
+  {
+    /* Q_GHBO - GET_HOST_BY_OWNER */
+    "get_host_by_owner",
+    "ghbo",
+    2,
+    RETRIEVE,
+    0,
+    0,
+    0,
+    ghbo_fields,
+    1,
+    0,
+    2,
+    NULL,
+    &ghbo_validate,
+  },
+
   {
     /* Q_QGLI - QUALIFIED_GET_LISTS */
     "qualified_get_lists",
     "qgli",
+    2,
     RETRIEVE,
     0,
     LIST_TABLE,
@@ -3555,6 +5032,7 @@ struct query Queries2[] = {
     /* Q_GMOL - GET_MEMBERS_OF_LIST */
     "get_members_of_list",
     "gmol",
+    2,
     RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
@@ -3571,6 +5049,7 @@ struct query Queries2[] = {
     /* Q_GEML - GET_END_MEMBERS_OF_LIST */
     "get_end_members_of_list",
     "geml",
+    2,
     RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
@@ -3587,6 +5066,7 @@ struct query Queries2[] = {
     /* Q_GTML - GET_TAGGED_MEMBERS_OF_LIST */
     "get_tagged_members_of_list",
     "gtml",
+    2,
     RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
@@ -3603,6 +5083,7 @@ struct query Queries2[] = {
     /* Q_GLOM - GET_LISTS_OF_MEMBER */
     "get_lists_of_member",
     "glom",
+    2,
     RETRIEVE,
     0,
     IMEMBERS_TABLE,
@@ -3619,6 +5100,7 @@ struct query Queries2[] = {
     /* Q_CMOL - COUNT_MEMBERS_OF_LIST */
     "count_members_of_list",
     "cmol",
+    2,
     RETRIEVE,
     0,
     IMEMBERS_TABLE,
@@ -3635,6 +5117,7 @@ struct query Queries2[] = {
     /* Q_GSIN - GET_SERVER_INFO */
     "get_server_info",
     "gsin",
+    2,
     RETRIEVE,
     "s",
     SERVERS_TABLE,
@@ -3651,6 +5134,7 @@ struct query Queries2[] = {
     /* Q_QGSV - QUALIFIED_GET_SERVER */
     "qualified_get_server",
     "qgsv",
+    2,
     RETRIEVE,
     0,
     SERVERS_TABLE,
@@ -3667,6 +5151,7 @@ struct query Queries2[] = {
     /* Q_ASIN - ADD_SERVER_INFO */
     "add_server_info",
     "asin",
+    2,
     APPEND,
     "s",
     SERVERS_TABLE,
@@ -3683,6 +5168,7 @@ struct query Queries2[] = {
     /* Q_USIN - UPDATE_SERVER_INFO */
     "update_server_info",
     "usin",
+    2,
     UPDATE,
     "s",
     SERVERS_TABLE,
@@ -3699,6 +5185,7 @@ struct query Queries2[] = {
     /* Q_RSVE - RESET_SERVER_ERROR */
     "reset_server_error",
     "rsve",
+    2,
     UPDATE,
     "s",
     SERVERS_TABLE,
@@ -3715,6 +5202,7 @@ struct query Queries2[] = {
     /* Q_SSIF - SET_SERVER_INTERNAL_FLAGS */
     "set_server_internal_flags",
     "ssif",
+    2,
     UPDATE,
     "s",
     SERVERS_TABLE,
@@ -3731,6 +5219,7 @@ struct query Queries2[] = {
     /* Q_DSIN - DELETE_SERVER_INFO */
     "delete_server_info",
     "dsin",
+    2,
     DELETE,
     "s",
     SERVERS_TABLE,
@@ -3747,6 +5236,7 @@ struct query Queries2[] = {
     /* Q_GSHI - GET_SERVER_HOST_INFO */
     "get_server_host_info",
     "gshi",
+    2,
     RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3763,6 +5253,7 @@ struct query Queries2[] = {
     /* Q_QGSH - QUALIFIED_GET_SERVER_HOST */
     "qualified_get_server_host",
     "qgsh",
+    2,
     RETRIEVE,
     0,
     SERVERHOSTS_TABLE,
@@ -3779,6 +5270,7 @@ struct query Queries2[] = {
     /* Q_ASHI - ADD_SERVER_HOST_INFO */
     "add_server_host_info",
     "ashi",
+    2,
     APPEND,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3795,6 +5287,7 @@ struct query Queries2[] = {
     /* Q_USHI - UPDATE_SERVER_HOST_INFO */
     "update_server_host_info",
     "ushi",
+    2,
     UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3811,6 +5304,7 @@ struct query Queries2[] = {
     /* Q_RSHE - RESET_SERVER_HOST_ERROR */
     "reset_server_host_error",
     "rshe",
+    2,
     UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3827,6 +5321,7 @@ struct query Queries2[] = {
     /* Q_SSHO - SET_SERVER_HOST_OVERRIDE */
     "set_server_host_override",
     "ssho",
+    2,
     UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3843,6 +5338,7 @@ struct query Queries2[] = {
     /* Q_SSHI - SET_SERVER_HOST_INTERNAL */
     "set_server_host_internal",
     "sshi",
+    2,
     UPDATE,
     "s",
     SERVERHOSTS_TABLE,
@@ -3859,6 +5355,7 @@ struct query Queries2[] = {
     /* Q_DSHI - DELETE_SERVER_HOST_INFO */
     "delete_server_host_info",
     "dshi",
+    2,
     DELETE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3875,6 +5372,7 @@ struct query Queries2[] = {
     /* Q_GSLO - GET_SERVER_LOCATIONS */
     "get_server_locations",
     "gslo",
+    2,
     RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
@@ -3891,6 +5389,7 @@ struct query Queries2[] = {
     /* Q_GFSL - GET_FILESYS_BY_LABEL */
     "get_filesys_by_label",
     "gfsl",
+    2,
     RETRIEVE,
     "fs",
     FILESYS_TABLE,
@@ -3900,13 +5399,14 @@ struct query Queries2[] = {
     "fs.label LIKE '%s' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
     1,
     "fs.label",
-    &VDfix_modby,
+    &gfsl_validate,
   },
 
   {
     /* Q_GFSM - GET_FILESYS_BY_MACHINE */
     "get_filesys_by_machine",
     "gfsm",
+    2,
     RETRIEVE,
     "fs",
     FILESYS_TABLE,
@@ -3923,13 +5423,14 @@ struct query Queries2[] = {
     /* Q_GFSN - GET_FILESYS_BY_NFSPHYS */
     "get_filesys_by_nfsphys",
     "gfsn",
+    2,
     RETRIEVE,
     "fs",
     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,
     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' AND fs.type = 'NFS'",
+    "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,
     "fs.label",
     &gfsn_validate,
@@ -3939,6 +5440,7 @@ struct query Queries2[] = {
     /* Q_GFSG - GET_FILESYS_BY_GROUP */
     "get_filesys_by_group",
     "gfsg",
+    2,
     RETRIEVE,
     "fs",
     FILESYS_TABLE,
@@ -3955,6 +5457,7 @@ struct query Queries2[] = {
     /* Q_GFSP - GET_FILESYS_BY_PATH */
     "get_filesys_by_path",
     "gfsp",
+    2,
     RETRIEVE,
     "fs",
     FILESYS_TABLE,
@@ -3971,6 +5474,7 @@ struct query Queries2[] = {
     /* Q_AFIL - ADD_FILESYS */ /* uses prefetch_value() for filsys_id */
     "add_filesys",
     "afil",
+    2,
     APPEND,
     "fs",
     FILESYS_TABLE,
@@ -3987,6 +5491,7 @@ struct query Queries2[] = {
     /* Q_UFIL - UPDATE_FILESYS */
     "update_filesys",
     "ufil",
+    2,
     UPDATE,
     "fs",
     FILESYS_TABLE,
@@ -4003,6 +5508,7 @@ struct query Queries2[] = {
     /* Q_DFIL - DELETE_FILESYS */
     "delete_filesys",
     "dfil",
+    2,
     DELETE,
     "fs",
     FILESYS_TABLE,
@@ -4019,6 +5525,7 @@ struct query Queries2[] = {
     /* Q_GFGM - GET_FSGROUP_MEMBERS */
     "get_fsgroup_members",
     "gfgm",
+    2,
     RETRIEVE,
     "fg",
     FSGROUP_TABLE,
@@ -4035,6 +5542,7 @@ struct query Queries2[] = {
     /* Q_AFTG - ADD_FILESYS_TO_FSGROUP */
     "add_filesys_to_fsgroup",
     "aftg",
+    2,
     APPEND,
     "fg",
     FSGROUP_TABLE,
@@ -4051,6 +5559,7 @@ struct query Queries2[] = {
     /* Q_RFFG - REMOVE_FILESYS_FROM_FSGROUP */
     "remove_filesys_from_fsgroup",
     "rffg",
+    2,
     DELETE,
     "fg",
     FSGROUP_TABLE,
@@ -4067,6 +5576,7 @@ struct query Queries2[] = {
     /* Q_GANF - GET_ALL_NFSPHYS */
     "get_all_nfsphys",
     "ganf",
+    2,
     RETRIEVE,
     "np",
     NFSPHYS_TABLE,
@@ -4083,6 +5593,7 @@ struct query Queries2[] = {
     /* Q_GNFP - GET_NFSPHYS */
     "get_nfsphys",
     "gnfp",
+    2,
     RETRIEVE,
     "np",
     NFSPHYS_TABLE,
@@ -4099,6 +5610,7 @@ struct query Queries2[] = {
     /* Q_ANFP - ADD_NFSPHYS */ /* uses prefetch_value() for nfsphys_id */
     "add_nfsphys",
     "anfp",
+    2,
     APPEND,
     "np",
     NFSPHYS_TABLE,
@@ -4115,6 +5627,7 @@ struct query Queries2[] = {
     /* Q_UNFP - UPDATE_NFSPHYS */
     "update_nfsphys",
     "unfp",
+    2,
     UPDATE,
     "np",
     NFSPHYS_TABLE,
@@ -4131,6 +5644,7 @@ struct query Queries2[] = {
     /* Q_AJNF - ADJUST_NFSPHYS_ALLOCATION */
     "adjust_nfsphys_allocation",
     "ajnf",
+    2,
     UPDATE,
     "np",
     NFSPHYS_TABLE,
@@ -4147,6 +5661,7 @@ struct query Queries2[] = {
     /* Q_DNFP - DELETE_NFSPHYS */
     "delete_nfsphys",
     "dnfp",
+    2,
     DELETE,
     "np",
     NFSPHYS_TABLE,
@@ -4163,6 +5678,7 @@ struct query Queries2[] = {
     /* Q_GQOT - GET_QUOTA */
     "get_quota",
     "gqot",
+    2,
     RETRIEVE,
     "q",
     QUOTA_TABLE,
@@ -4179,6 +5695,7 @@ struct query Queries2[] = {
     /* Q_GQBF - GET_QUOTA_BY_FILESYS */
     "get_quota_by_filesys",
     "gqbf",
+    2,
     RETRIEVE,
     "q",
     QUOTA_TABLE,
@@ -4195,6 +5712,7 @@ struct query Queries2[] = {
     /* Q_AQOT - ADD_QUOTA */ /* prefetch_filsys() gets last 1 value */
     "add_quota",
     "aqot",
+    2,
     APPEND,
     0,
     QUOTA_TABLE,
@@ -4211,6 +5729,7 @@ struct query Queries2[] = {
     /* Q_UQOT - UPDATE_QUOTA */
     "update_quota",
     "uqot",
+    2,
     UPDATE,
     0,
     QUOTA_TABLE,
@@ -4227,6 +5746,7 @@ struct query Queries2[] = {
     /* Q_DQOT - DELETE_QUOTA */
     "delete_quota",
     "dqot",
+    2,
     DELETE,
     0,
     QUOTA_TABLE,
@@ -4243,6 +5763,7 @@ struct query Queries2[] = {
     /* Q_GNFQ - GET_NFS_QUOTAS */
     "get_nfs_quota",
     "gnfq",
+    2,
     RETRIEVE,
     "q",
     QUOTA_TABLE,
@@ -4259,6 +5780,7 @@ struct query Queries2[] = {
     /* Q_GNQP - GET_NFS_QUOTAS_BY_PARTITION */
     "get_nfs_quotas_by_partition",
     "gnqp",
+    2,
     RETRIEVE,
     "q",
     QUOTA_TABLE,
@@ -4275,6 +5797,7 @@ struct query Queries2[] = {
     /* Q_ANFQ - ADD_NFS_QUOTA */ /* prefetch_filsys() gets last 1 value */
     "add_nfs_quota",
     "anfq",
+    2,
     APPEND,
     0,
     QUOTA_TABLE,
@@ -4291,6 +5814,7 @@ struct query Queries2[] = {
     /* Q_UNFQ - UPDATE_NFS_QUOTA */
     "update_nfs_quota",
     "unfq",
+    2,
     UPDATE,
     0,
     QUOTA_TABLE,
@@ -4307,6 +5831,7 @@ struct query Queries2[] = {
     /* Q_DNFQ - DELETE_NFS_QUOTA */
     "delete_nfs_quota",
     "dnfq",
+    2,
     DELETE,
     0,
     QUOTA_TABLE,
@@ -4320,14 +5845,15 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_GZCL - GET_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v2 */
     "get_zephyr_class",
     "gzcl",
+    2,
     RETRIEVE,
     "z",
     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",
-    gzcl_fields,
+    gzcl2_fields,
     12,
     "class LIKE '%s'",
     1,
@@ -4336,34 +5862,87 @@ struct query Queries2[] = {
   },
 
   {
-    /* Q_AZCL - ADD_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v5 */
+    "get_zephyr_class",
+    "gzcl",
+    5,
+    RETRIEVE,
+    "z",
+    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,
+    14,
+    "class LIKE '%s'",
+    1,
+    "class",
+    &gzcl_validate,
+  },
+
+  {
+    /* Q_AZCL - ADD_ZEPHYR_CLASS, v2 */
     "add_zephyr_class",
     "azcl",
+    2,
     APPEND,
     "z",
     ZEPHYR_TABLE,
     "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)",
-    azcl_fields,
+    azcl2_fields,
     9,
     0,
     0,
     NULL,
+    &azcl2_validate,
+  },
+
+  {
+    /* Q_AZCL - ADD_ZEPHYR_CLASS, v5 */
+    "add_zephyr_class",
+    "azcl",
+    5,
+    APPEND,
+    "z",
+    ZEPHYR_TABLE,
+    "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,
+    0,
+    0,
+    NULL,
     &azcl_validate,
   },
 
   {
-    /* Q_UZCL - UPDATE_ZEPHYR_CLASS */
+    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v2 */
     "update_zephyr_class",
     "uzcl",
+    2,
     UPDATE,
     "z",
     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",
-    uzcl_fields,
+    uzcl2_fields,
     9,
     "class = '%s'",
     1,
     NULL,
+    &uzcl2_validate,
+  },
+
+  {
+    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v5 */
+    "update_zephyr_class",
+    "uzcl",
+    5,
+    UPDATE,
+    "z",
+    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,
+    11,
+    "class = '%s'",
+    1,
+    NULL,
     &uzcl_validate,
   },
 
@@ -4371,6 +5950,7 @@ struct query Queries2[] = {
     /* Q_DZCL - DELETE_ZEPHYR_CLASS */
     "delete_zephyr_class",
     "dzcl",
+    2,
     DELETE,
     "z",
     ZEPHYR_TABLE,
@@ -4387,6 +5967,7 @@ struct query Queries2[] = {
     /* Q_GSHA - GET_SERVER_HOST_ACCESS */
     "get_server_host_access",
     "gsha",
+    2,
     RETRIEVE,
     "ha",
     HOSTACCESS_TABLE,
@@ -4403,6 +5984,7 @@ struct query Queries2[] = {
     /* Q_ASHA - ADD_SERVER_HOST_ACCESS */
     "add_server_host_access",
     "asha",
+    2,
     APPEND,
     "ha",
     HOSTACCESS_TABLE,
@@ -4419,6 +6001,7 @@ struct query Queries2[] = {
     /* Q_USHA - UPDATE_SERVER_HOST_ACCESS */
     "update_server_host_access",
     "usha",
+    2,
     UPDATE,
     "ha",
     HOSTACCESS_TABLE,
@@ -4435,6 +6018,7 @@ struct query Queries2[] = {
     /* Q_DSHA - DELETE_SERVER_HOST_ACCESS */
     "delete_server_host_access",
     "dsha",
+    2,
     DELETE,
     "ha",
     HOSTACCESS_TABLE,
@@ -4451,6 +6035,7 @@ struct query Queries2[] = {
     /* Q_GACL - GET_ACL */
     "get_acl",
     "gacl",
+    2,
     RETRIEVE,
     "ac",
     ACL_TABLE,
@@ -4467,6 +6052,7 @@ struct query Queries2[] = {
     /* Q_AACL - ADD_ACL */
     "add_acl",
     "aacl",
+    2,
     APPEND,
     "ac",
     ACL_TABLE,
@@ -4483,6 +6069,7 @@ struct query Queries2[] = {
     /* Q_DACL - DELETE_ACL */
     "delete_acl",
     "dacl",
+    2,
     DELETE,
     "ac",
     ACL_TABLE,
@@ -4499,14 +6086,15 @@ struct query Queries2[] = {
     /* Q_GSVC - GET_SERVICE */
     "get_service",
     "gsvc",
+    2,
     RETRIEVE,
     "ss",
     SERVICES_TABLE,
     "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
     gsvc_fields,
     7,
-    "name LIKE '%s'",
-    1,
+    "name LIKE '%s' AND protocol LIKE '%s'",
+    2,
     "name",
     &VDfix_modby,
   },
@@ -4515,6 +6103,7 @@ struct query Queries2[] = {
     /* Q_ASVC - ADD_SERVICE */
     "add_service",
     "asvc",
+    2,
     APPEND,
     "ss",
     SERVICES_TABLE,
@@ -4531,22 +6120,24 @@ struct query Queries2[] = {
     /* Q_DSVC - DELETE_SERVICE */
     "delete_service",
     "dsvc",
+    2,
     DELETE,
     "ss",
     SERVICES_TABLE,
     0,
-    asvc_fields,
+    dsvc_fields,
     0,
-    "name = '%s'",
-    1,
+    "name = '%s' AND protocol = '%s'",
+    2,
     NULL,
-    &asvc_validate,
+    &dsvc_validate,
   },
 
   {
     /* Q_GPRN - GET_PRINTER */
     "get_printer",
     "gprn",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4563,6 +6154,7 @@ struct query Queries2[] = {
     /* Q_GPBD - GET_PRINTER_BY_DUPLEXNAME */
     "get_printer_by_duplexname",
     "gpbd",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4579,6 +6171,7 @@ struct query Queries2[] = {
     /* Q_GPBE - GET_PRINTER_BY_ETHERNET */
     "get_printer_by_ethernet",
     "gpbe",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4595,6 +6188,7 @@ struct query Queries2[] = {
     /* Q_GPBH - GET_PRINTER_BY_HOSTNAME */
     "get_printer_by_hostname",
     "gpbh",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4611,6 +6205,7 @@ struct query Queries2[] = {
     /* Q_GPBR - GET_PRINTER_BY_RM */
     "get_printer_by_rm",
     "gpbr",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4627,6 +6222,7 @@ struct query Queries2[] = {
     /* Q_GPBL - GET_PRINTER_BY_LOCATION */
     "get_printer_by_location",
     "gpbl",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4643,6 +6239,7 @@ struct query Queries2[] = {
     /* Q_GPBC - GET_PRINTER_BY_CONTACT */
     "get_printer_by_contact",
     "gpbc",
+    2,
     RETRIEVE,
     "pr",
     PRINTERS_TABLE,
@@ -4659,6 +6256,7 @@ struct query Queries2[] = {
     /* Q_APRN - ADD_PRINTER */
     "add_printer",
     "aprn",
+    2,
     APPEND,
     "pr",
     PRINTERS_TABLE,
@@ -4675,6 +6273,7 @@ struct query Queries2[] = {
     /* Q_UPRN - UPDATE_PRINTER */
     "update_printer",
     "uprn",
+    2,
     UPDATE,
     "pr",
     PRINTERS_TABLE,
@@ -4691,6 +6290,7 @@ struct query Queries2[] = {
     /* Q_DPRN - DELETE_PRINTER */
     "delete_printer",
     "dprn",
+    2,
     DELETE,
     "pr",
     PRINTERS_TABLE,
@@ -4707,6 +6307,7 @@ struct query Queries2[] = {
     /* Q_GPSV - GET_PRINT_SERVER */
     "get_print_server",
     "gpsv",
+    2,
     RETRIEVE,
     "ps",
     PRINTSERVERS_TABLE,
@@ -4723,6 +6324,7 @@ struct query Queries2[] = {
     /* Q_APSV - ADD_PRINT_SERVER */
     "add_print_server",
     "apsv",
+    2,
     APPEND,
     "ps",
     PRINTSERVERS_TABLE,
@@ -4739,6 +6341,7 @@ struct query Queries2[] = {
     /* Q_UPSV - UPDATE_PRINT_SERVER */
     "update_print_server",
     "upsv",
+    2,
     UPDATE,
     "ps",
     PRINTSERVERS_TABLE,
@@ -4755,6 +6358,7 @@ struct query Queries2[] = {
     /* Q_DPSV - DELETE_PRINT_SERVER */
     "delete_print_server",
     "dpsv",
+    2,
     DELETE,
     "ps",
     PRINTSERVERS_TABLE,
@@ -4771,6 +6375,7 @@ struct query Queries2[] = {
     /* Q_GALI - GET_ALIAS */
     "get_alias",
     "gali",
+    2,
     RETRIEVE,
     "a",
     ALIAS_TABLE,
@@ -4787,6 +6392,7 @@ struct query Queries2[] = {
     /* Q_AALI - ADD_ALIAS */
     "add_alias",
     "aali",
+    2,
     APPEND,
     "a",
     ALIAS_TABLE,
@@ -4803,6 +6409,7 @@ struct query Queries2[] = {
     /* Q_DALI - DELETE_ALIAS */
     "delete_alias",
     "dali",
+    2,
     DELETE,
     "a",
     ALIAS_TABLE,
@@ -4819,6 +6426,7 @@ struct query Queries2[] = {
     /* Q_GVAL - GET_VALUE */
     "get_value",
     "gval",
+    2,
     RETRIEVE,
     "val",
     NUMVALUES_TABLE,
@@ -4835,6 +6443,7 @@ struct query Queries2[] = {
     /* Q_AVAL - ADD_VALUE */
     "add_value",
     "aval",
+    2,
     APPEND,
     "val",
     NUMVALUES_TABLE,
@@ -4851,6 +6460,7 @@ struct query Queries2[] = {
     /* Q_UVAL - UPDATE_VALUE */
     "update_value",
     "uval",
+    2,
     UPDATE,
     "val",
     NUMVALUES_TABLE,
@@ -4867,6 +6477,7 @@ struct query Queries2[] = {
     /* Q_DVAL - DELETE_VALUE */
     "delete_value",
     "dval",
+    2,
     DELETE,
     "val",
     NUMVALUES_TABLE,
@@ -4883,6 +6494,7 @@ struct query Queries2[] = {
     /* Q_GATS - GET_ALL_TABLE_STATS */
     "get_all_table_stats",
     "gats",
+    2,
     RETRIEVE,
     "tbs",
     TBLSTATS_TABLE,
@@ -4899,6 +6511,7 @@ struct query Queries2[] = {
     /* Q__SDL - _SET_DEBUG_LEVEL */
     "_set_debug_level",
     "_sdl",
+    2,
     UPDATE,
     NULL,
     0,
@@ -4911,6 +6524,261 @@ struct query Queries2[] = {
     &_sdl_validate,
   },
 
+  {
+    /* Q_GUSL - GET_USER_SIDS_BY_LOGIN, v4 */
+    "get_user_sids_by_login",
+    "gusl",
+    4,
+    RETRIEVE,
+    "s",
+    USERSIDS_TABLE,
+    "u.login, us.sid, TO_CHAR(us.created, 'YYYY-MM-DD HH24:MI:SS') FROM users u, usersids us",
+    gusl_fields,
+    3,
+    "us.users_id = %d AND u.users_id = us.users_id AND SUBSTR(us.sid, 1, LENGTH(us.sid)-8) = '%s'",
+    2,
+    NULL,
+    &gusl_validate,
+  },
+
+  {
+    /* Q_AUSL - ADD_USER_SID_BY_LOGIN, v4 */
+    "add_user_sid_by_login",
+    "ausl",
+    4,
+    APPEND,
+    "s",
+    USERSIDS_TABLE,
+    "INTO usersids (users_id, sid) VALUES (%d, '%s')",
+    ausl_fields,
+    2,
+    NULL,
+    0,
+    NULL,
+    &ausl_validate,
+  },
+  
+  {
+    /* Q_GLSN - GET_LIST_SIDS_BY_NAME, v4 */
+    "get_list_sids_by_name",
+    "glsn",
+    4,
+    RETRIEVE,
+    "s",
+    LISTSIDS_TABLE,
+    "l.name, ls.sid, TO_CHAR(ls.created, 'YYYY-MM-DD HH24:MI:SS') FROM list l, listsids ls",
+    glsn_fields,
+    3,
+    "ls.list_id = %d AND l.list_id = ls.list_id AND SUBSTR(ls.sid, 1, LENGTH(ls.sid)-8) = '%s'",
+    2,
+    NULL,
+    &glsn_validate,
+  },
+
+  {
+    /* Q_ALSN - ADD_LIST_SID_BY_NAME, v4 */
+    "add_list_sid_by_name",
+    "alsn",
+    4,
+    APPEND,
+    "s",
+    LISTSIDS_TABLE,
+    "INTO listsids (list_id, sid) VALUES (%d, '%s')",
+    alsn_fields,
+    2,
+    NULL,
+    0,
+    NULL,
+    &alsn_validate,
+  },
+
+  {
+    /* Q_GDDS - GET_DISTINCT_DOMAIN_SIDS, v4 */
+    "get_distinct_domain_sids",
+    "gdds",
+    4,
+    RETRIEVE,
+    "s",
+    USERSIDS_TABLE,
+    "DISTINCT SUBSTR(sid, 1, LENGTH(sid)-8) FROM usersids",
+    gdds_fields,
+    1,
+    NULL,
+    0,
+    NULL,
+    NULL,
+  },
+
+  {
+    /* Q_GCON - GET_CONTAINER, v7 */
+    "get_container",
+    "gcon",
+    7,
+    RETRIEVE,
+    "c",
+    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",
+    gcon_fields,
+    11,
+    "name = '%s' AND cnt_id != 0",
+    1,
+    NULL,
+    &gcon_validate,
+  },
+
+  {
+    /* Q_ACON - ADD_CONTAINER, v7 */ /* uses prefetch_value() for cnt_id */
+    "add_container",
+    "acon",
+    7,
+    APPEND,
+    "c",
+    CONTAINERS_TABLE,
+    "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)",
+    acon_fields,
+    8,
+    0,
+    0,
+    NULL,
+    &acon_validate,
+  },
+
+  {
+    /* Q_UCON - UPDATE_CONTAINER, v7 */
+    "update_container",
+    "ucon",
+    7,
+    UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    ucon_fields,
+    8,
+    0,
+    1,
+    NULL,
+    &ucon_validate,
+  },
+
+  {
+    /* Q_DCON - DELETE_CONTAINER, v7 */
+    "delete_container",
+    "dcon",
+    7,
+    DELETE,
+    "c",
+    CONTAINERS_TABLE,
+    NULL,
+    dcon_fields,
+    0,
+    "cnt_id = %d",
+    1,
+    NULL,
+    &dcon_validate,
+  },
+
+  {
+    /* Q_AMCN - ADD_MACHINE_TO_CONTAINER, v7 */
+    "add_machine_to_container",
+    "amcn",
+    7,
+    APPEND,
+    "mcn",
+    MCNTMAP_TABLE,
+    "INTO mcntmap (mach_id, cnt_id) VALUES (%d, %d)",
+    amcn_fields,
+    2,
+    0,
+    0,
+    NULL,
+    &amcn_validate,
+  },
+
+  {
+    /* Q_DMCN - DELETE_MACHINE_FROM_CONTAINER, v7 */
+    "delete_machine_from_container",
+    "dmcn",
+    7,
+    DELETE,
+    "mcn",
+    MCNTMAP_TABLE,
+    0,
+    amcn_fields,
+    0,
+    "mach_id = %d AND cnt_id = %d",
+    2,
+    NULL,
+    &dmcn_validate,
+  },
+
+  {
+    /* Q_GMNM - GET_MACHINE_TO_CONTAINER_MAP, v7 */
+    "get_machine_to_container_map",
+    "gmnm",
+    7,
+    RETRIEVE,
+    "mcn",
+    MCNTMAP_TABLE,
+    "m.name, c.name FROM machine m, containers c, mcntmap mcn",
+    gmnm_fields,
+    2,
+    "m.name = UPPER('%s') AND mcn.cnt_id = c.cnt_id AND mcn.mach_id = m.mach_id",
+    1,
+    NULL,
+    NULL,
+  },
+
+  {
+    /* Q_GMOC - GET_MACHINES_OF_CONTAINER, v7 */
+    "get_machines_of_container",
+    "gmoc",
+    7,
+    RETRIEVE,
+    NULL,
+    MCNTMAP_TABLE,
+    NULL,
+    gmoc_fields,
+    2,
+    NULL,
+    2,
+    NULL,
+    &gmoc_validate,
+  },
+
+  {
+    /* Q_GSOC - GET_SUBCONTAINERS_OF_CONTAINER, v7 */
+    "get_subcontainers_of_container",
+    "gsoc",
+    7,
+    RETRIEVE,
+    NULL,
+    CONTAINERS_TABLE,
+    NULL,
+    gsoc_fields,
+    1,
+    NULL,
+    2,
+    NULL,
+    &gsoc_validate,
+  },
+
+  {
+    /* Q_GTLC - GET_TOPLEVEL_CONTAINERS, v7 */
+    "get_toplevel_containers",
+    "gtlc",
+    7,
+    RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "name FROM containers",
+    gtlc_fields,
+    1,
+    "name NOT LIKE '%%/%%'",
+    0,
+    "name",
+    NULL,
+  },
+
 };
 
-int QueryCount2 = (sizeof(Queries2) / sizeof(struct query));
+int QueryCount = (sizeof(Queries) / sizeof(struct query));
This page took 0.18788 seconds and 4 git commands to generate.