]> andersk Git - moira.git/blobdiff - server/queries2.c
Make update_printer work.
[moira.git] / server / queries2.c
index a8970126dd0bb079238937960f849b7796f96759..43c6d97aad9dfdc3db6c113714c98007cb203c67 100644 (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,24 +71,58 @@ 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 *gual3_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure", "modtime",
+  "modby", "modwith", "created", "creator",
+};
+
+static char *gual11_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static char *gual_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static char *gubl2_fields[] = {
   "login",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
-static struct validate gubl_validate =
+static char *gubl_fields[] = {
+  "login",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
+  "creator", 
+};
+
+static struct validate gubl2_validate =
 {
   0,
   0,
@@ -97,21 +135,80 @@ static struct validate gubl_validate =
   followup_fix_modby,
 };
 
-static char *guau_fields[] = {
+static struct validate gubl_validate =
+{
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  access_login,
+  0,
+  followup_get_user,
+};
+
+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 *guau3_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static char *guau11_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure", 
+  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static char *guau_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure", 
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static char *guan2_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
   "modtime", "modby", "modwith",
 };
 
-static struct validate guan_validate =
+static char *guan3_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static char *guan11_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static char *guan_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static struct validate guan2_validate =
 {
   0,
   0,
@@ -124,27 +221,115 @@ static struct validate guan_validate =
   followup_fix_modby,
 };
 
-static char *guac_fields[] = {
+static struct validate guan_validate =
+{
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  followup_get_user,
+};
+
+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 *guac3_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+static char *guac11_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static char *guac_fields[] = {
+  "class",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+  "modtime", "modby", "modwith", "created", "creator",
+};
+
+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 *guam3_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "modtime", "modby", "modwith", "created", "creator", 
+};
+
+static char *guam11_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
+  "creator", 
+};
+
+static char *guam_fields[] = {
+  "clearid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+  "modtime", "modby", "modwith", "created", "creator", 
+};
+
+static char *guas_fields[] = {
+  "sponsor_type", "sponsor_name",
+  "login",
+};
+
+static struct valobj guas_valobj[] = {
+  {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
+  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
+};
+
+static struct validate guas_validate = {
+  guas_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  access_member,
+  0,
+  get_user_account_by_sponsor,
+};
+
+static char *gubu2_fields[] = {
   "unix_uid",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
-static struct validate gubu_validate =
+static char *gubu_fields[] = {
+  "unix_uid",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static struct validate gubu2_validate =
 {
   VOnum0,
   1,
@@ -157,13 +342,33 @@ static struct validate gubu_validate =
   followup_fix_modby,
 };
 
-static char *gubn_fields[] = {
+static struct validate gubu_validate =
+{
+  VOnum0,
+  1,
+  0,
+  0,
+  0,
+  0,
+  access_login,
+  0,
+  followup_get_user,
+};
+
+static char *gubn2_fields[] = {
   "first", "last",
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "modtime", "modby", "modwith",
 };
 
-static struct validate gubn_validate =
+static char *gubn_fields[] = {
+  "first", "last",
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle", 
+  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
+  "creator",
+};
+
+static struct validate gubn2_validate =
 {
   0,
   0,
@@ -176,24 +381,68 @@ static struct validate gubn_validate =
   followup_fix_modby,
 };
 
-static char *gubc_fields[] = {
+static struct validate gubn_validate =
+{
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  followup_get_user,
+};
+
+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",
+  "created", "creator",
+};
+
+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",
+  "created", "creator",
+};
+
+static char *auac2_fields[] = {
   "login", "unix_uid", "shell", "last", "first", "middle", "status",
   "clearid", "class", "comments", "signature", "secure",
 };
 
-static struct valobj auac_valobj[] = {
+static char *auac3_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", 
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+};
+
+static char *auac11_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir",
+};
+
+static char *auac_fields[] = {
+  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
+  "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+};
+
+static struct valobj auac2_valobj[] = {
   {V_CHAR, 0, USERS_TABLE, "login"},
   {V_NUM, 1},
   {V_CHAR, 2, USERS_TABLE, "shell"},
@@ -207,8 +456,60 @@ static struct valobj auac_valobj[] = {
   {V_NUM, 11},
 };
 
-static struct validate auac_validate = {
-  auac_valobj,
+static struct valobj auac3_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 valobj auac11_valobj[] = {
+  {V_CHAR, 0, USERS_TABLE, "login"},
+  {V_NUM, 1},
+  {V_CHAR, 2, USERS_TABLE, "shell"},
+  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 4, USERS_TABLE, "last"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "middle"},
+  {V_NUM, 7},
+  {V_CHAR, 8, USERS_TABLE, "clearid"},
+  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 12},
+  {V_LEN, 13, USERS_TABLE, "winhomedir"},
+  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
+};
+
+static struct valobj auac_valobj[] = {
+  {V_CHAR, 0, USERS_TABLE, "login"},
+  {V_NUM, 1},
+  {V_CHAR, 2, USERS_TABLE, "shell"},
+  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 4, USERS_TABLE, "last"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "middle"},
+  {V_NUM, 7},
+  {V_CHAR, 8, USERS_TABLE, "clearid"},
+  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 12},
+  {V_LEN, 13, USERS_TABLE, "winhomedir"},
+  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
+  {V_TYPE, 15, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 16, 0, 0, "list_id", MR_ACE},
+  {V_CHAR, 17, USERS_TABLE, "expiration"},
+};
+
+static struct validate auac2_validate = {
+  auac2_valobj,
   11,
   "login",
   "login = '%s'",
@@ -219,9 +520,9 @@ static struct validate auac_validate = {
   followup_ausr,
 };
 
-static struct validate ausr_validate = {
-  auac_valobj,
-  9,
+static struct validate auac3_validate = {
+  auac3_valobj,
+  12,
   "login",
   "login = '%s'",
   1,
@@ -231,39 +532,131 @@ static struct validate ausr_validate = {
   followup_ausr,
 };
 
-static char *rusr_fields[] = {
-  "unix_uid", "login", "pobox_type"
+static struct validate auac11_validate = {
+  auac11_valobj,
+  14,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
 };
 
-static struct valobj rusr_valobj[] = {
-  {V_NUM, 0},
-  {V_CHAR, 1, USERS_TABLE, "login"},
+static struct validate auac_validate = {
+  auac_valobj,
+  17,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
 };
 
-static struct validate rusr_validate = {
-  rusr_valobj,
-  2,
-  0,
-  0,
-  0,
-  0,
-  0,
-  register_user,
+static struct validate ausr2_validate = {
+  auac2_valobj,
+  9,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
   0,
+  setup_ausr,
+  followup_ausr,
 };
 
-static char *uuac_fields[] = {
+static struct validate ausr3_validate = {
+  auac3_valobj,
+  10,
   "login",
-  "newlogin", "unix_uid", "shell", "last", "first", "middle", "status",
-  "clearid", "class", "comments", "signature", "secure",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
 };
 
-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, "first"},
+static struct validate ausr11_validate = {
+  auac11_valobj,
+  12,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
+static struct validate ausr_validate = {
+  auac_valobj,
+  15,
+  "login",
+  "login = '%s'",
+  1,
+  "users_id",
+  0,
+  setup_ausr,
+  followup_ausr,
+};
+
+static char *rusr_fields[] = {
+  "unix_uid", "login", "pobox_type"
+};
+
+static struct valobj rusr_valobj[] = {
+  {V_NUM, 0},
+  {V_CHAR, 1, USERS_TABLE, "login"},
+};
+
+static struct validate rusr_validate = {
+  rusr_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  0,
+  register_user,
+  0,
+};
+
+static char *uuac2_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "last", "first", "middle", "status",
+  "clearid", "class", "comments", "signature", "secure",
+};
+
+static char *uuac3_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first", 
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+};
+
+static char *uuac11_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir",
+};
+
+static char *uuac_fields[] = {
+  "login",
+  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
+  "middle", "status", "clearid", "class", "comments", "signature", "secure",
+  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
+};
+
+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},
+  {V_CHAR, 3, USERS_TABLE, "shell"},
+  {V_CHAR, 4, USERS_TABLE, "first"},
   {V_CHAR, 5, USERS_TABLE, "last"},
   {V_CHAR, 6, USERS_TABLE, "middle"},
   {V_NUM, 7},
@@ -272,10 +665,137 @@ static struct valobj uuac_valobj[] = {
   {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
   {V_NUM, 12},
 };
+  
+static struct valobj uuac3_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 valobj uuac11_valobj[] = {
+  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
+  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_CHAR, 3, USERS_TABLE, "shell"},
+  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "last"},
+  {V_CHAR, 7, USERS_TABLE, "middle"},
+  {V_NUM, 8},
+  {V_CHAR, 9, USERS_TABLE, "clearid"},
+  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 13},
+  {V_LEN, 14, USERS_TABLE, "winhomedir"},
+  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
+};
+
+static struct valobj uuac_valobj[] = {
+  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
+  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
+  {V_NUM, 2},
+  {V_CHAR, 3, USERS_TABLE, "shell"},
+  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
+  {V_CHAR, 5, USERS_TABLE, "first"},
+  {V_CHAR, 6, USERS_TABLE, "last"},
+  {V_CHAR, 7, USERS_TABLE, "middle"},
+  {V_NUM, 8},
+  {V_CHAR, 9, USERS_TABLE, "clearid"},
+  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
+  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_NUM, 13},
+  {V_LEN, 14, USERS_TABLE, "winhomedir"},
+  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
+  {V_TYPE, 16, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 17, 0, 0, "list_id", MR_ACE},
+  {V_CHAR, 18, USERS_TABLE, "expiration"},
+};
+
+static struct validate uuac2_validate = {
+  uuac2_valobj,
+  12,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uuac3_validate = {
+  uuac3_valobj,
+  13,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uuac11_validate = {
+  uuac11_valobj,
+  15,
+  0,
+  0,
+  0,
+  "users_id",
+  access_update_user,
+  setup_ausr,
+  set_modtime_by_id,
+};
 
 static struct validate uuac_validate = {
   uuac_valobj,
-  12,
+  18,
+  0,
+  0,
+  0,
+  "users_id",
+  access_update_user,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uusr2_validate = {
+  uuac2_valobj,
+  10,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uusr3_validate = {
+  uuac3_valobj,
+  11,
+  0,
+  0,
+  0,
+  "users_id",
+  0,
+  setup_ausr,
+  set_modtime_by_id,
+};
+
+static struct validate uusr11_validate = {
+  uuac11_valobj,
+  13,
   0,
   0,
   0,
@@ -287,7 +807,7 @@ static struct validate uuac_validate = {
 
 static struct validate uusr_validate = {
   uuac_valobj,
-  11,
+  16,
   0,
   0,
   0,
@@ -319,6 +839,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",
@@ -586,7 +1128,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",
@@ -594,6 +1136,54 @@ 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 *ghst6_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 *ghbh6_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 char *ghst_fields[] = {
+  "name", "address", "location", "network",
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "account_number", "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",
+  "account_number", "use", "status", "status_change", "network", "address", 
+  "ace_type", "ace_name", "admin_comment", "ops_comment", "created", "creator",
+  "inuse", "modtime", "modby", "modwith",
+};
+
+static char *ghba_fields[] = {
+  "account_number",
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "account_number", "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,
@@ -601,8 +1191,8 @@ static struct validate ghst_validate = {
   0,
   0,
   0,
-  access_host,
   0,
+  setup_ghst,
   followup_ghst,
 };
 
@@ -611,13 +1201,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"},
@@ -633,9 +1223,80 @@ 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 *ahst6_fields[] = {
+  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "use", "status", "subnet", "address", "ace_type", "ace_name",
+  "admin_comment", "ops_comment",
+};
+
+static struct valobj ahst6_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 ahst6_validate = {
+  ahst6_valobj,
+  14,
+  "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",
+  "account_number", "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_CHAR, 7, MACHINE_TABLE, "account_number"},
+  {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 ahst_validate = {
   ahst_valobj,
-  13,
+  15,
   "name",
   "name = UPPER('%s')",
   1,
@@ -645,14 +1306,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},
@@ -670,8 +1331,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,
@@ -682,7 +1343,84 @@ static struct validate uhst_validate = {
   set_modtime_by_id,
 };
 
-static char *uhha_fields[] = {
+static char *uhst6_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 uhst6_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 uhst6_validate = {
+  uhst6_valobj,
+  16,
+  0,
+  0,
+  0,
+  "mach_id",
+  access_host,
+  setup_ahst,
+  set_modtime_by_id,
+};
+
+static char *uhst_fields[] = {
+  "name",
+  "newname", "vendor", "model", "os", "location", "contact", "billing_contact",
+  "account_number", "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_CHAR, 8, MACHINE_TABLE, "account_number"},
+  {V_NUM, 9},
+  {V_NUM, 10},
+  {V_ID, 11, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
+  {V_TYPE, 13, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 14, 0, 0, 0, MR_ACE},
+  {V_ID, 15, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+  {V_ID, 16, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
+};
+
+static struct validate uhst_validate = {
+  uhst_valobj,
+  17,
+  0,
+  0,
+  0,
+  "mach_id",
+  access_host,
+  setup_ahst,
+  set_modtime_by_id,
+};
+
+static char *uhha_fields[] = {
   "name",
   "hwaddr"
 };
@@ -770,12 +1508,19 @@ static struct validate dhal_validate = {
   0,
 };
 
-static char *gsnt_fields[] = {
+static char *gsnt2_fields[] = {
   "name",
   "name", "description", "address", "mask", "low", "high", "prefix",
   "ace_type", "ace_name", "modtime", "modby", "modwith"
 };
 
+static char *gsnt_fields[] = {
+  "name",
+  "name", "description", "status", "contact", "account_number", "address", 
+  "mask", "low", "high", "prefix", "ace_type", "ace_name", "modtime", 
+  "modby", "modwith"
+};
+
 static struct validate gsnt_validate = {
   0,
   0,
@@ -788,12 +1533,12 @@ static struct validate gsnt_validate = {
   followup_gsnt,
 };
 
-static char *asnt_fields[] = {
+static char *asnt2_fields[] = {
   "name", "description", "address", "mask", "low", "high", "prefix",
   "ace_type", "ace_name",
 };
 
-static struct valobj asnt_valobj[] = {
+static struct valobj asnt2_valobj[] = {
   {V_CHAR, 0, SUBNET_TABLE, "name"},
   {V_LEN, 1, SUBNET_TABLE, "description"},
   {V_NUM, 2},
@@ -805,9 +1550,9 @@ static struct valobj asnt_valobj[] = {
   {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
 };
 
-static struct validate asnt_validate =
+static struct validate asnt2_validate =
 {
-  asnt_valobj,
+  asnt2_valobj,
   9,
   "name",
   "name = UPPER('%s')",
@@ -818,13 +1563,46 @@ static struct validate asnt_validate =
   set_uppercase_modtime,
 };
 
-static char *usnt_fields[] = {
+static char *asnt_fields[] = {
+  "name", "description", "status", "contact", "account_number", "address", 
+  "mask", "low", "high", "prefix", "ace_type", "ace_name",
+};
+
+static struct valobj asnt_valobj[] = {
+  {V_CHAR, 0, SUBNET_TABLE, "name"},
+  {V_LEN, 1, SUBNET_TABLE, "description"},
+  {V_NUM, 2},
+  {V_CHAR, 3, SUBNET_TABLE, "contact"},
+  {V_CHAR, 4, SUBNET_TABLE, "account_number"},
+  {V_NUM, 5},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_LEN, 9, SUBNET_TABLE, "prefix"},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, 0, MR_ACE},
+};
+
+static struct validate asnt_validate =
+{
+  asnt_valobj,
+  12,
+  "name",
+  "name = UPPER('%s')",
+  1,
+  "snet_id",
+  0,
+  setup_asnt,
+  set_uppercase_modtime,
+};
+
+static char *usnt2_fields[] = {
   "name",
   "newname", "description", "address", "mask", "low", "high", "prefix",
   "ace_type", "ace_name",
 };
 
-static struct valobj usnt_valobj[] = {
+static struct valobj usnt2_valobj[] = {
   {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_NO_MATCH},
   {V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
   {V_LEN, 2, SUBNET_TABLE, "description"},
@@ -837,9 +1615,9 @@ static struct valobj usnt_valobj[] = {
   {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
 };
 
-static struct validate usnt_validate =
+static struct validate usnt2_validate =
 {
-  usnt_valobj,
+  usnt2_valobj,
   10,
   "name",
   "snet_id = %d",
@@ -850,6 +1628,41 @@ static struct validate usnt_validate =
   set_modtime_by_id,
 };
 
+static char *usnt_fields[] = {
+  "name",
+  "newname", "description", "status", "contact", "account_number", "address", 
+  "mask", "low", "high", "prefix", "ace_type", "ace_name",
+};
+
+static struct valobj usnt_valobj[] = {
+  {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_NO_MATCH},
+  {V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
+  {V_LEN, 2, SUBNET_TABLE, "description"},
+  {V_NUM, 3},
+  {V_CHAR, 4, SUBNET_TABLE, "contact"},
+  {V_CHAR, 5, SUBNET_TABLE, "account_number"},
+  {V_NUM, 6},
+  {V_NUM, 7},
+  {V_NUM, 8},
+  {V_NUM, 9},
+  {V_LEN, 10, SUBNET_TABLE, "prefix"},
+  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
+};
+
+static struct validate usnt_validate =
+{
+  usnt_valobj,
+  13,
+  "name",
+  "snet_id = %d",
+  1,
+  "snet_id",
+  0,
+  setup_asnt,
+  set_modtime_by_id,
+};
+
 static char *dsnt_fields[] = {
   "name",
 };
@@ -1000,12 +1813,33 @@ 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 *glin4_fields[] = {
+  "name",
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
+  "description", "modtime", "modby", "modwith",
+};
+
+static char *glin_fields[] = {
+  "name",
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name", 
+  "memace_type", "memace_name", "description", "modtime", "modby", "modwith",
+};
+
 static struct validate glin_validate = {
   0,
   0,
@@ -1018,12 +1852,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},
@@ -1036,9 +1870,110 @@ 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 *alis4_fields[] = {
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name", 
+  "description",
+};
+
+static struct valobj alis4_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 alis4_validate = {
+  alis4_valobj,
+  13,
+  "name",
+  "name = '%s'",
+  1,
+  "list_id",
+  0,
+  setup_alis,
+  set_modtime,
+};
+
+static char *alis_fields[] = {
+  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "mailman", "mailman_server", "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_NUM, 8},
+  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 13, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 14, LIST_TABLE, "description"},
+};
+
 static struct validate alis_validate = {
   alis_valobj,
-  10,
+  15,
   "name",
   "name = '%s'",
   1,
@@ -1048,13 +1983,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},
@@ -1068,8 +2003,8 @@ static struct valobj ulis_valobj[] = {
   {V_LEN, 10, LIST_TABLE, "description"},
 };
 
-static struct validate ulis_validate = {
-  ulis_valobj,
+static struct validate ulis2_validate = {
+  ulis2_valobj,
   11,
   "name",
   "list_id = %d",
@@ -1080,28 +2015,135 @@ static struct validate ulis_validate = {
   set_modtime_by_id,
 };
 
-static char *dlis_fields[] = {
+static char *ulis3_fields[] = {
   "name",
+  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid", 
+  "nfsgroup", "ace_type", "ace_name", "description",
 };
 
-static struct validate dlis_validate = {
-  VOlist0,
-  1,
-  "name",
+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,
-  0,
+  "list_id",
   access_list,
-  setup_dlis,
-  0,
+  setup_alis,
+  set_modtime_by_id,
 };
 
-static char *amtl_fields[] = {
-  "list_name", "member_type", "member_name",
+static char *ulis4_fields[] = {
+  "name",
+  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
+  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
+  "description",
 };
 
-static char *atml_fields[] = {
-  "list_name", "member_type", "member_name", "tag",
+static struct valobj ulis4_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 ulis4_validate = {
+  ulis4_valobj,
+  14,
+  "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", "mailman", "mailman_server", "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_NUM, 9},
+  {V_ID, 10, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
+  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 12, 0, 0, "list_id", MR_ACE},
+  {V_TYPE, 13, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 14, 0, 0, "list_id", MR_ACE},
+  {V_LEN, 15, LIST_TABLE, "description"},
+};
+
+static struct validate ulis_validate = {
+  ulis_valobj,
+  16,
+  "name",
+  "list_id = %d",
+  1,
+  "list_id",
+  access_list,
+  setup_alis,
+  set_modtime_by_id,
+};
+
+static char *dlis_fields[] = {
+  "name",
+};
+
+static struct validate dlis_validate = {
+  VOlist0,
+  1,
+  "name",
+  "list_id = %d",
+  1,
+  0,
+  access_list,
+  setup_dlis,
+  0,
+};
+
+static char *amtl_fields[] = {
+  "list_name", "member_type", "member_name",
+};
+
+static char *atml_fields[] = {
+  "list_name", "member_type", "member_name", "tag",
 };
 
 static struct valobj amtl_valobj[] = {
@@ -1141,13 +2183,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 =
@@ -1310,7 +2352,7 @@ static struct validate gsin_validate =
   0,
   access_service,
   0,
-  followup_glin,
+  followup_gsin,
 };
 
 static char *qgsv_fields[] = {
@@ -1579,7 +2621,7 @@ static struct validate gfsl_validate = {
   0,
   0,
   0,
-  access_filesys,
+  0,
   0,
   followup_fix_modby,
 };
@@ -1886,7 +2928,7 @@ static struct validate gqbf_validate = {
   0,
   0,
   0,
-  access_filesys,
+  0,
   0,
   followup_gqot,
 };
@@ -1951,7 +2993,7 @@ static struct validate gnfq_validate = {
   0,
   0,
   0,
-  access_filesys,
+  0,
   0,
   followup_gqot,
 };
@@ -2008,13 +3050,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,
@@ -2022,14 +3071,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[] = {
@@ -2042,11 +3121,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,
@@ -2056,11 +3137,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},
@@ -2072,16 +3183,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,
 };
@@ -2186,7 +3299,7 @@ static struct validate aacl_validate =
 };
 
 static char *gsvc_fields[] = {
-  "service",
+  "service", "protocol",
   "service", "protocol", "port", "description", "modtime", "modby", "modwith",
 };
 
@@ -2194,6 +3307,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"},
@@ -2205,12 +3322,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[] = {
@@ -2436,7 +3565,7 @@ static struct validate aali_validate = {
   3,
   0,
   0,
-  0,
+  setup_aali,
   0,
 };
 
@@ -2521,114 +3650,591 @@ static struct validate _sdl_validate =
   _sdl_followup,
 };
 
+static char *gcon7_fields[] = {
+  "name",
+  "name", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
+};
 
-\f
-/* Generalized Query Definitions */
+static struct validate gcon_validate = {
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  followup_gcon,
+};
 
-/* Multiple versions of the same query MUST be listed in ascending
- * order.
- */
+static char *gcon_fields[] = {
+  "name",
+  "name", "publicflg", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
+};
 
-/* Note: For any query which uses prefetch_value, the vcnt should be
- * one less than the number of %-format specifiers in the tlist.
- */
+static char *acon7_fields[] = {
+  "name", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
 
-struct query Queries[] = {
-  {
-    /* Q_GALO - GET_ALL_LOGINS */
-    "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,
-    6,
-    "u.users_id != 0",
-    0,
-    "u.login",
-    0,
-  },
+static struct valobj acon7_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},
+};
 
-  {
-    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS */
-    "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,
-    6,
-    "u.status = 1",
-    0,
-    "u.login",
-    0,
-  },
+static struct validate acon7_validate =
+{
+  acon7_valobj,
+  8,
+  "name",
+  "name = '%s'",
+  1,
+  "cnt_id",
+  0,
+  setup_acon,
+  set_modtime,
+};
 
-  {
-    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN */
-    "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, 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,
-    15,
-    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
-    1,
-    "u.login",
-    &gubl_validate,
-  },
+static char *acon_fields[] = {
+  "name", "publicflg", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
 
-  {
-    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID */
-    "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, 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,
-    15,
-    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
-    1,
-    "u.login",
-    &gubu_validate,
-  },
+static struct valobj acon_valobj[] = {
+  {V_CHAR, 0, CONTAINERS_TABLE, "name"},
+  {V_NUM, 1},
+  {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 acon_validate =
+{
+  acon_valobj,
+  9,
+  "name",
+  "name = '%s'",
+  1,
+  "cnt_id",
+  0,
+  setup_acon,
+  set_modtime,
+};
+
+static char *ucon7_fields[] = {
+  "name",
+  "newname", "description", "location", "contact",
+  "ace_type", "ace_name", "memace_type", "memace_name",
+};
+
+static struct valobj ucon7_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 ucon7_validate =
+{
+  ucon7_valobj,
+  9,
+  0,
+  0,
+  0,
+  0,
+  access_container,
+  0,
+  update_container,
+};
+
+static char *ucon_fields[] = {
+  "name",
+  "newname", "publicflg", "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_NUM, 2},
+  {V_LEN, 3, CONTAINERS_TABLE, "description"},
+  {V_CHAR, 4, CONTAINERS_TABLE, "location"},
+  {V_CHAR, 5, CONTAINERS_TABLE, "contact"},
+  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
+  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
+  {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
+};
+
+static struct validate ucon_validate =
+{
+  ucon_valobj,
+  10,
+  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",
+};
+
+static char *scli_fields[] = {
+  "containername",
+  "listname",
+};
+
+static struct valobj scli_valobj[] = {
+  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
+  {V_ID, 1, LIST_TABLE, "name", "list_id", MR_LIST},
+};
+
+static struct validate scli_validate = {
+  scli_valobj,
+  2,
+  0,
+  0,
+  0,
+  0,
+  0,
+  setup_scli,
+  set_container_list,
+};
+
+static char *gcli_fields[] = {
+  "containername",
+  "containername", "listname",
+};
+
+static struct validate glic_validate = 
+{
+  VOlist0,
+  1,
+  NULL,
+  NULL,
+  0,
+  0,
+  0,
+  0,
+  0,
+};
+
+static char *glic_fields[] = {
+  "listname",
+  "containername", "listname",
+};
+
+/* 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 Queries[] = {
+  {
+    /* Q_GALO - GET_ALL_LOGINS, v2 */
+    "get_all_logins",
+    "galo",
+    2,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
+    galo2_fields,
+    6,
+    "u.users_id != 0",
+    0,
+    "u.login",
+    0,
+  },
+
+  {
+    /* Q_GALO - GET_ALL_LOGINS, v3 */
+    "get_all_logins",
+    "galo",
+    3,
+    MR_Q_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_GUAN - GET_USER_ACCOUNT_BY_NAME */
+    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v2 */
+    "get_all_active_logins",
+    "gaal",
+    2,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
+    galo2_fields,
+    6,
+    "u.status = 1",
+    0,
+    "u.login",
+    0,
+  },
+
+  {
+    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v3 */
+    "get_all_active_logins",
+    "gaal",
+    3,
+    MR_Q_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,
+    MR_Q_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",
+    gual2_fields,
+    15,
+    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubl2_validate,
+  },
+
+  {
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v3 */
+    "get_user_account_by_login",
+    "gual",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    gual3_fields,
+    18,
+    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubl_validate,
+  },
+
+  {
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v11 */
+    "get_user_account_by_login",
+    "gual",
+    11,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    gual11_fields,
+    20,
+    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubl_validate,
+  },
+
+  {
+    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v12 */
+    "get_user_account_by_login",
+    "gual",
+    12,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    gual_fields,
+    23,
+    "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,
+    MR_Q_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",
+    guau2_fields,
+    15,
+    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubu2_validate,
+  },
+
+  {
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v3 */
+    "get_user_account_by_uid",
+    "guau",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guau3_fields,
+    18,
+    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubu_validate,
+  },
+
+  {
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v11 */
+    "get_user_account_by_uid",
+    "guau",
+    11,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guau3_fields,
+    20,
+    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &gubu_validate,
+  }, 
+
+  {
+    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v12 */
+    "get_user_account_by_uid",
+    "guau",
+    12,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guau_fields,
+    23,
+    "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,
+    MR_Q_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",
-    guan_fields,
+    guan2_fields,
     15,
     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
     2,
     "u.login",
+    &guan2_validate,
+  },
+
+  {
+    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v3 */
+    "get_user_account_by_name",
+    "guan",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guan3_fields,
+    18,
+    "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_GUAN - GET_USER_ACCOUNT_BY_NAME, v11 */
+    "get_user_account_by_name",
+    "guan",
+    11,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guan11_fields,
+    20,
+    "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 */
+    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v12 */
+    "get_user_account_by_name",
+    "guan",
+    12,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guan_fields,
+    23,
+    "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,
+    MR_Q_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",
-    guac_fields,
+    guac2_fields,
     15,
     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
     1,
@@ -2637,50 +4243,203 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID */
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v3 */
+    "get_user_account_by_class",
+    "guac",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guac3_fields,
+    18,
+    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v11 */
+    "get_user_account_by_class",
+    "guac",
+    11,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guac11_fields,
+    20,
+    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v12 */
+    "get_user_account_by_class",
+    "guac",
+    12,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guac_fields,
+    23,
+    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v2 */
     "get_user_account_by_id",
     "guai",
     2,
-    RETRIEVE,
+    MR_Q_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",
+    guam2_fields,
+    15,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &VDfix_modby,
+  },
+
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v3 */
+    "get_user_account_by_id",
+    "guai",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
     guam_fields,
+    18,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v11 */
+    "get_user_account_by_id",
+    "guai",
+    11,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guam11_fields,
+    20,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v12 */
+    "get_user_account_by_id",
+    "guai",
+    12,
+    MR_Q_RETRIEVE,
+    "u",
+    USERS_TABLE,
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
+    guam_fields,
+    23,
+    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUAS - GET_USER_ACCOUNT_BY_SPONSOR, v12 */
+    "get_user_account_by_sponsor",
+    "guas",
+    12,
+    MR_Q_RETRIEVE,
+    0,
+    0,
+    0,
+    guas_fields,
+    1,
+    0,
+    2,
+    NULL,
+    &guas_validate,
+  },
+
+  {
+    /* Q_GUBL - GET_USER_BY_LOGIN, v2 */
+    "get_user_by_login",
+    "gubl",
+    2,
+    MR_Q_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",
+    gubl2_fields,
+    12,
+    "u.login LIKE '%s' AND u.users_id != 0",
+    1,
+    "u.login",
+    &gubl2_validate,
+  },
+
+  {
+    /* Q_GUBL - GET_USER_BY_LOGIN, v3 */
+    "get_user_by_login",
+    "gubl",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
+    gubl_fields,
     15,
-    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
+    "u.login LIKE '%s' AND u.users_id != 0",
     1,
     "u.login",
-    &VDfix_modby,
+    &gubl_validate,
   },
 
   {
-    /* Q_GUBL - GET_USER_BY_LOGIN */
-    "get_user_by_login",
-    "gubl",
+    /* Q_GUBU - GET_USER_BY_UID, v2 */
+    "get_user_by_uid",
+    "gubu",
     2,
-    RETRIEVE,
+    MR_Q_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,
+    gubu2_fields,
     12,
-    "u.login LIKE '%s' AND u.users_id != 0",
+    "u.unix_uid = %s AND u.users_id != 0",
     1,
     "u.login",
-    &gubl_validate,
+    &gubu2_validate,
   },
 
   {
-    /* Q_GUBU - GET_USER_BY_UID */
+    /* Q_GUBU - GET_USER_BY_UID, v3 */
     "get_user_by_uid",
     "gubu",
-    2,
-    RETRIEVE,
+    3,
+    MR_Q_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",
+    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
     gubu_fields,
-    12,
+    15,
     "u.unix_uid = %s AND u.users_id != 0",
     1,
     "u.login",
@@ -2688,32 +4447,49 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GUBN - GET_USER_BY_NAME */
+    /* Q_GUBN - GET_USER_BY_NAME, v2 */
     "get_user_by_name",
     "gubn",
     2,
-    RETRIEVE,
+    MR_Q_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,
     "u.login",
+    &gubn2_validate,
+  },
+
+  {
+    /* Q_GUBN - GET_USER_BY_NAME, v3 */
+    "get_user_by_name",
+    "gubn",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
+    gubn_fields,
+    15,
+    "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 */
+    /* Q_GUBC - GET_USER_BY_CLASS, v2 */
     "get_user_by_class",
     "gubc",
     2,
-    RETRIEVE,
+    MR_Q_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,
@@ -2722,15 +4498,32 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GUBM - GET_USER_BY_MITID */
+    /* Q_GUBC - GET_USER_BY_CLASS, v3 */
+    "get_user_by_class",
+    "gubc",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS') FROM users u",
+    gubc_fields,
+    15,
+    "u.type = UPPER('%s') AND u.users_id != 0",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_GUBM - GET_USER_BY_MITID, v2 */
     "get_user_by_mitid",
     "gubm",
     2,
-    RETRIEVE,
+    MR_Q_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,
@@ -2739,19 +4532,96 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_AUAC - ADD_USER_ACCOUNT */  /* uses prefetch_value() for users_id */
+    /* Q_GUBM - GET_USER_BY_MITID, v3 */
+    "get_user_by_mitid",
+    "gubm",
+    3,
+    MR_Q_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, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u",
+    gubm_fields,
+    15,
+    "u.clearid LIKE '%s' AND u.users_id != 0",
+    1,
+    "u.login",
+    &guan_validate,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v2 */  /* uses prefetch_value() for users_id */
     "add_user_account",
     "auac",
     2,
-    APPEND,
+    MR_Q_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, 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)",
-    auac_fields,
+    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,
+    MR_Q_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, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, %s, SYSDATE, %s)",
+    auac3_fields,
+    13,
+    NULL,
+    0,
+    NULL,
+    &auac3_validate,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v11 */  /* uses prefetch_value() for users_id */
+    "add_user_account",
+    "auac",
+    11,
+    MR_Q_APPEND,
+    "u",
+    USERS_TABLE,
+    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
+     * but using up one argv element.
+     */
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
+    auac11_fields,
+    15,
+    NULL,
+    0,
+    NULL,
+    &auac11_validate,
+  },
+
+  {
+    /* Q_AUAC - ADD_USER_ACCOUNT, v12 */  /* uses prefetch_value() for users_id */
+    "add_user_account",
+    "auac",
     12,
+    MR_Q_APPEND,
+    "u",
+    USERS_TABLE,
+    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
+     * but using up one argv element.
+     */
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, NVL('%s', CHR(0)), %s, SYSDATE, %s)",
+    auac_fields,
+    18,
     NULL,
     0,
     NULL,
@@ -2759,19 +4629,70 @@ struct query Queries[] = {
   },
 
   {
-    /* 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,
+    MR_Q_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,
+    MR_Q_APPEND,
+    "u",
+    USERS_TABLE,
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, %s, SYSDATE, %s)",
+    auac3_fields,
+    10,
+    0,
+    0,
+    NULL,
+    &ausr3_validate,
+  },
+
+  {
+    /* Q_AUSR - ADD_USER, v11 */  /* uses prefetch_value() for users_id */
+    "add_user",
+    "ausr",
+    11,
+    MR_Q_APPEND,
+    "u",
+    USERS_TABLE,
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
+    auac11_fields,
+    12,
+    0,
+    0,
+    NULL,
+    &ausr11_validate,
+  },
+
+  {
+    /* Q_AUSR - ADD_USER, v12 */  /* uses prefetch_value() for users_id */
+    "add_user",
+    "ausr",
+    12,
+    MR_Q_APPEND,
+    "u",
+    USERS_TABLE,
+    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, NVL('%s', CHR(0)), %s, SYSDATE, %s)",
+    auac_fields,
+    15,
+    0,
+    0,
+    NULL,
     &ausr_validate,
   },
 
@@ -2780,7 +4701,7 @@ struct query Queries[] = {
     "register_user",
     "rusr",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     0,
     0,
@@ -2793,17 +4714,71 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_UUAC - UPDATE_USER_ACCOUNT */
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v2 */
     "update_user_account",
     "uuac",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     /* 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",
-    uuac_fields,
+    uuac2_fields,
+    12,
+    "users_id = %d",
+    1,
+    NULL,
+    &uuac2_validate,
+  },
+
+  {
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v3 */
+    "update_user_account",
+    "uuac",
+    3,
+    MR_Q_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",
+    uuac3_fields,
+    13,
+    "users_id = %d",
+    1,
+    NULL,
+    &uuac3_validate,
+  },
+
+  {
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v11 */
+    "update_user_account",
+    "uuac",
+    11,
+    MR_Q_UPDATE,
+    "u",
+    USERS_TABLE,
+    /* See comment in auac about signature. */
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s, winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0))",
+    uuac11_fields,
+    15,
+    "users_id = %d",
+    1,
+    NULL,
+    &uuac11_validate,
+  },
+
+  {
+    /* Q_UUAC - UPDATE_USER_ACCOUNT, v12 */
+    "update_user_account",
+    "uuac",
     12,
+    MR_Q_UPDATE,
+    "u",
+    USERS_TABLE,
+    /* See comment in auac about signature. */
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s, winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d, expiration = NVL('%s', CHR(0))",
+    uuac_fields,
+    18,
     "users_id = %d",
     1,
     NULL,
@@ -2811,19 +4786,70 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_UUSR - UPDATE_USER */
+    /* Q_UUSR - UPDATE_USER, v2 */
     "update_user",
     "uusr",
     2,
-    UPDATE,
+    MR_Q_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,
+    MR_Q_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'",
+    uuac3_fields,
+    10,
+    "users_id = %d",
+    1,
+    NULL,
+    &uusr3_validate,
+  },
+
+  {
+    /* Q_UUSR - UPDATE_USER, v11 */
+    "update_user",
+    "uusr",
+    11,
+    MR_Q_UPDATE,
+    "u",
+    USERS_TABLE,
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)) ",
+    uuac11_fields,
+    12,
+    "users_id = %d",
+    1,
+    NULL,
+    &uusr11_validate,
+  },
+
+  {
+    /* Q_UUSR - UPDATE_USER, v12 */
+    "update_user",
+    "uusr",
+    12,
+    MR_Q_UPDATE,
+    "u",
+    USERS_TABLE,
+    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d, expiration = NVL('%s', CHR(0)) ",
+    uuac_fields,
+    15,
+    "users_id = %d",
+    1,
+    NULL,
     &uusr_validate,
   },
 
@@ -2832,7 +4858,7 @@ struct query Queries[] = {
     "update_user_shell",
     "uush",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET shell = '%s'",
@@ -2844,12 +4870,29 @@ struct query Queries[] = {
     &uush_validate,
   },
 
+  {
+    /* Q_UUWS - UPDATE_USER_WINDOWS_SHELL */
+    "update_user_windows_shell",
+    "uuws",
+    2,
+    MR_Q_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,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET status = %s",
@@ -2866,7 +4909,7 @@ struct query Queries[] = {
     "update_user_security_status",
     "uuss",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET secure = %s",
@@ -2883,7 +4926,7 @@ struct query Queries[] = {
     "delete_user",
     "dusr",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "u",
     USERS_TABLE,
     NULL,
@@ -2900,7 +4943,7 @@ struct query Queries[] = {
     "add_user_reservation",
     "aurv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -2917,7 +4960,7 @@ struct query Queries[] = {
     "get_user_reservations",
     "gurv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     USERS_TABLE,
     0,
@@ -2934,7 +4977,7 @@ struct query Queries[] = {
     "get_user_by_reservation",
     "gubr",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     USERS_TABLE,
     0,
@@ -2951,7 +4994,7 @@ struct query Queries[] = {
     "delete_user_reservation",
     "durv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -2968,7 +5011,7 @@ struct query Queries[] = {
     "get_kerberos_user_map",
     "gkum",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "k",
     KRBMAP_TABLE,
     "u.login, str.string FROM krbmap km, users u, strings str",
@@ -2985,7 +5028,7 @@ struct query Queries[] = {
     "add_kerberos_user_map",
     "akum",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "k",
     KRBMAP_TABLE,
     "INTO krbmap (users_id, string_id) VALUES (%d, %d)",
@@ -3002,7 +5045,7 @@ struct query Queries[] = {
     "delete_kerberos_user_map",
     "dkum",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "k",
     KRBMAP_TABLE,
     0,
@@ -3019,7 +5062,7 @@ struct query Queries[] = {
     "get_finger_by_login",
     "gfbl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, fullname, nickname, home_addr, home_phone, office_addr, office_phone, department, affiliation, TO_CHAR(fmodtime, 'DD-mon-YYYY HH24:MI:SS'), fmodby, fmodwith FROM users",
@@ -3036,7 +5079,7 @@ struct query Queries[] = {
     "update_finger_by_login",
     "ufbl",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET fullname= NVL('%s', CHR(0)), nickname= NVL('%s', CHR(0)), home_addr= NVL('%s', CHR(0)), home_phone= NVL('%s', CHR(0)), office_addr= NVL('%s', CHR(0)), office_phone= NVL('%s', CHR(0)), department= NVL('%s', CHR(0)), affiliation= NVL('%s', CHR(0))",
@@ -3053,7 +5096,7 @@ struct query Queries[] = {
     "get_pobox",
     "gpob",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id, CHR(0), TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
@@ -3070,7 +5113,7 @@ struct query Queries[] = {
     "get_all_poboxes",
     "gapo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, pop_id || ':' || box_id FROM users",
@@ -3087,7 +5130,7 @@ struct query Queries[] = {
     "get_poboxes_pop",
     "gpop",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id FROM users",
@@ -3104,7 +5147,7 @@ struct query Queries[] = {
     "get_poboxes_smtp",
     "gpos",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "u",
     USERS_TABLE,
     "login, potype, users_id FROM users",
@@ -3121,7 +5164,7 @@ struct query Queries[] = {
     "set_pobox",
     "spob",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -3138,7 +5181,7 @@ struct query Queries[] = {
     "set_pobox_pop",
     "spop",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     USERS_TABLE,
     0,
@@ -3155,7 +5198,7 @@ struct query Queries[] = {
     "delete_pobox",
     "dpob",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "u",
     USERS_TABLE,
     "users SET potype = 'NONE'",
@@ -3168,16 +5211,50 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GHST - GET_HOST */
+    /* Q_GHST - GET_HOST, v2 */
+    "get_host",
+    "ghst",
+    2,
+    MR_Q_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",
+    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,
+    "m.name",
+    &ghst_validate,
+  },
+
+  {
+    /* Q_GHST - GET_HOST, v6 */
+    "get_host",
+    "ghst",
+    6,
+    MR_Q_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",
+    ghst6_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_GHST - GET_HOST, v8 */
     "get_host",
     "ghst",
-    2,
-    RETRIEVE,
+    8,
+    MR_Q_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",
+    "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
     ghst_fields,
-    21,
+    23,
     "m.name LIKE UPPER('%s') AND m.address LIKE '%s' AND m.location LIKE UPPER('%s') AND s.name LIKE UPPER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
     4,
     "m.name",
@@ -3185,20 +5262,71 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GHBH - GET_HOST_BY_HWADDR */
+    /* Q_GHBH - GET_HOST_BY_HWADDR, v2 */
     "get_host_by_hwaddr",
     "ghbh",
     2,
-    RETRIEVE,
+    MR_Q_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,
+    MR_Q_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",
+    ghbh6_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_GHBH - GET_HOST_BY_HWADDR, v8 */
+    "get_host_by_hwaddr",
+    "ghbh",
+    8,
+    MR_Q_RETRIEVE,
+    "m",
+    MACHINE_TABLE,
+    "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",
+    ghbh_fields,
+    23,
+    "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
+    1,
+    "m.name",
+    &ghst_validate,
+  },
+
+  {
+    /* Q_GHBA - GET_HOST_BY_ACCOUNT_NUMBER, v8 */
+    "get_host_by_account_number",
+    "ghba",
+    8,
+    MR_Q_RETRIEVE,
+    "m",
+    MACHINE_TABLE,
+    "m.name, m.vendor, m.model, m.os, m.location, m.contact, m.billing_contact, m.account_number, m.use, m.status, TO_CHAR(m.statuschange, 'DD-mon-YYYY HH24:MI:SS'), s.name, m.address, m.owner_type, m.owner_id, m.acomment, m.ocomment, TO_CHAR(m.created, 'DD-mon-YYYY HH24:MI:SS'), m.creator, TO_CHAR(m.inuse, 'DD-mon-YYYY HH24:MI:SS'), TO_CHAR(m.modtime, 'DD-mon-YYYY HH24:MI:SS'), m.modby, m.modwith FROM machine m, subnet s",    
+    ghba_fields,
+    23,
+    "m.account_number LIKE '%s' AND m.mach_id != 0 and s.snet_id = m.snet_id",
+    1,
+    "m.name",
+    &ghst_validate,
   },
 
   {
@@ -3206,7 +5334,7 @@ struct query Queries[] = {
     "get_host_hwaddr",
     "ghha",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "m.hwaddr FROM machine m",
@@ -3219,36 +5347,104 @@ struct query Queries[] = {
   },
 
   {
-    /* 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,
+    MR_Q_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,
+    MR_Q_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)",
+    ahst6_fields,
+    15,
+    0,
+    0,
+    NULL,
+    &ahst6_validate,
+  },
+
+  {
+    /* Q_AHST - ADD_HOST, v8 */ /* Uses prefetch_value() for mach_id */
+    "add_host",
+    "ahst",
+    8,
+    MR_Q_APPEND,
+    "m",
+    MACHINE_TABLE,
+    "INTO machine (name, vendor, model, os, location, contact, billing_contact, account_number, use, status, statuschange, snet_id, address, owner_type, owner_id, acomment, ocomment, created, inuse, mach_id, creator) VALUES (UPPER('%s'), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL(UPPER('%s'), CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, SYSDATE, %d, '%s', '%s', %d, %d, %d, SYSDATE, SYSDATE, %s, %s)",
+    ahst_fields,
+    16,
+    0,
+    0,
+    NULL,
     &ahst_validate,
   },
 
   {
-    /* Q_UHST - UPDATE_HOST */
+    /* Q_UHST - UPDATE_HOST, v2 */
     "update_host",
     "uhst",
     2,
-    UPDATE,
+    MR_Q_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,
+    MR_Q_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",
+    uhst6_fields,
+    15,
+    "mach_id = %d",
+    1,
+    NULL,
+    &uhst6_validate,
+  },
+
+  {
+    /* Q_UHST - UPDATE_HOST, v8 */
+    "update_host",
+    "uhst",
+    8,
+    MR_Q_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)), account_number = 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,
+    16,
+    "mach_id = %d",
+    1,
+    NULL,
     &uhst_validate,
   },
 
@@ -3257,7 +5453,7 @@ struct query Queries[] = {
     "update_host_hwaddr",
     "uhha",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "m",
     MACHINE_TABLE,
     "machine SET hwaddr = NVL('%s', CHR(0))",
@@ -3274,7 +5470,7 @@ struct query Queries[] = {
     "delete_host",
     "dhst",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "m",
     MACHINE_TABLE,
     NULL,
@@ -3291,7 +5487,7 @@ struct query Queries[] = {
     "get_machine",
     "gmac",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "m",
     MACHINE_TABLE,
     "name, vendor, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM machine",
@@ -3308,7 +5504,7 @@ struct query Queries[] = {
     "get_hostalias",
     "ghal",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "a",
     HOSTALIAS_TABLE,
     "a.name, m.name FROM hostalias a, machine m",
@@ -3325,7 +5521,7 @@ struct query Queries[] = {
     "add_hostalias",
     "ahal",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "a",
     HOSTALIAS_TABLE,
     "INTO hostalias (name, mach_id) VALUES (UPPER('%s'), %d)",
@@ -3342,7 +5538,7 @@ struct query Queries[] = {
     "delete_hostalias",
     "dhal",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "a",
     HOSTALIAS_TABLE,
     NULL,
@@ -3355,15 +5551,15 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GSNT - GET_SUBNET */
+    /* Q_GSNT - GET_SUBNET, v2 */
     "get_subnet",
     "gsnt",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "s",
     SUBNET_TABLE,
     "name, description, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
-    gsnt_fields,
+    gsnt2_fields,
     12,
     "name LIKE UPPER('%s')",
     1,
@@ -3372,36 +5568,87 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_ASNT - ADD_SUBNET */
+    /* Q_GSNT - GET_SUBNET, v8 */
+    "get_subnet",
+    "gsnt",
+    8,
+    MR_Q_RETRIEVE,
+    "s",
+    SUBNET_TABLE,
+    "name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
+    gsnt_fields,
+    15,
+    "name LIKE UPPER('%s')",
+    1,
+    "name",
+    &gsnt_validate,
+  },
+
+  {
+    /* Q_ASNT - ADD_SUBNET, v2 */
     "add_subnet",
     "asnt",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "s",
     SUBNET_TABLE,
     "INTO subnet (name, description, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
-    asnt_fields,
+    asnt2_fields,
     9,
     0,
     0,
     NULL,
+    &asnt2_validate,
+  },
+
+  {
+    /* Q_ASNT - ADD_SUBNET, v8 */
+    "add_subnet",
+    "asnt",
+    8,
+    MR_Q_APPEND,
+    "s",
+    SUBNET_TABLE,
+    "INTO subnet (name, description, status, contact, account_number, saddr, mask, low, high, prefix, owner_type, owner_id, snet_id) VALUES (UPPER('%s'), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, %s, %s, %s, NVL('%s', CHR(0)), '%s', %d, %s)",
+    asnt_fields,
+    12,
+    0,
+    0,
+    NULL,
     &asnt_validate,
   },
 
   {
-    /* Q_USNT - UPDATE_SUBNET */
+    /* Q_USNT - UPDATE_SUBNET, v2 */
     "update_subnet",
     "usnt",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SUBNET_TABLE,
     "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
-    usnt_fields,
+    usnt2_fields,
     9,
     "snet_id = %d",
     1,
     NULL,
+    &usnt2_validate,
+  },
+
+  {
+    /* Q_USNT - UPDATE_SUBNET, v8 */
+    "update_subnet",
+    "usnt",
+    8,
+    MR_Q_UPDATE,
+    "s",
+    SUBNET_TABLE,
+    "subnet SET name = UPPER('%s'), description = NVL('%s', CHR(0)), status = %s, contact = NVL('%s', CHR(0)), account_number = NVL('%s', CHR(0)), saddr = %s, mask = %s, low = %s, high = %s, prefix = NVL('%s', CHR(0)), owner_type = '%s', owner_id = %d",
+    usnt_fields,
+    12,
+    "snet_id = %d",
+    1,
+    NULL,
     &usnt_validate,
   },
 
@@ -3410,7 +5657,7 @@ struct query Queries[] = {
     "delete_subnet",
     "dsnt",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "s",
     SUBNET_TABLE,
     NULL,
@@ -3427,7 +5674,7 @@ struct query Queries[] = {
     "get_cluster",
     "gclu",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "c",
     CLUSTERS_TABLE,
     "name, description, location, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM clusters",
@@ -3444,7 +5691,7 @@ struct query Queries[] = {
     "add_cluster",
     "aclu",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "c",
     CLUSTERS_TABLE,
     "INTO clusters (name, description, location, clu_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s)",
@@ -3461,7 +5708,7 @@ struct query Queries[] = {
     "update_cluster",
     "uclu",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "c",
     CLUSTERS_TABLE,
     "clusters SET name = '%s', description = NVL('%s', CHR(0)), location = NVL('%s', CHR(0))",
@@ -3478,7 +5725,7 @@ struct query Queries[] = {
     "delete_cluster",
     "dclu",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "c",
     CLUSTERS_TABLE,
     NULL,
@@ -3495,7 +5742,7 @@ struct query Queries[] = {
     "get_machine_to_cluster_map",
     "gmcm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "mcm",
     MCMAP_TABLE,
     "m.name, c.name FROM machine m, clusters c, mcmap mcm",
@@ -3512,7 +5759,7 @@ struct query Queries[] = {
     "add_machine_to_cluster",
     "amtc",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "mcm",
     MCMAP_TABLE,
     "INTO mcmap (mach_id, clu_id) VALUES (%d, %d)",
@@ -3529,7 +5776,7 @@ struct query Queries[] = {
     "delete_machine_from_cluster",
     "dmfc",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "mcm",
     MCMAP_TABLE,
     0,
@@ -3546,7 +5793,7 @@ struct query Queries[] = {
     "get_cluster_data",
     "gcld",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "svc",
     SVC_TABLE,
     "c.name, svc.serv_label, svc.serv_cluster FROM svc svc, clusters c",
@@ -3563,7 +5810,7 @@ struct query Queries[] = {
     "add_cluster_data",
     "acld",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "svc",
     SVC_TABLE,
     "INTO svc (clu_id, serv_label, serv_cluster) VALUES (%d, '%s', '%s')",
@@ -3580,80 +5827,233 @@ struct query Queries[] = {
     "delete_cluster_data",
     "dcld",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "svc",
     SVC_TABLE,
     NULL,
     acld_fields,
     0,
-    "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
-    3,
+    "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
+    3,
+    NULL,
+    &dcld_validate,
+  },
+
+  {
+    /* Q_GLIN - GET_LIST_INFO, v2 */
+    "get_list_info",
+    "glin",
+    2,
+    MR_Q_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",
+    glin2_fields,
+    13,
+    "name LIKE '%s'",
+    1,
+    "name",
+    &glin_validate,
+  },
+
+  {
+    /* Q_GLIN - GET_LIST_INFO, v3 */
+    "get_list_info",
+    "glin",
+    3,
+    MR_Q_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,
+    MR_Q_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",
+    glin4_fields,
+    16,
+    "name LIKE '%s'",
+    1,
+    "name",
+    &glin_validate,
+  },
+
+  {
+    /* Q_GLIN - GET_LIST_INFO, v10 */
+    "get_list_info",
+    "glin",
+    10,
+    MR_Q_RETRIEVE,
+    "l",
+    LIST_TABLE,
+    "l.name, l.active, l.publicflg, l.hidden, l.maillist, l.grouplist, l.gid, l.nfsgroup, l.mailman, m.name, l.acl_type, l.acl_id, l.memacl_type, l.memacl_id, l.description, TO_CHAR(l.modtime, 'DD-mon-YYYY HH24:MI:SS'), l.modby, l.modwith FROM list l, machine m",
+    glin_fields,
+    18,
+    "l.name LIKE '%s' AND m.mach_id = l.mailman_id",
+    1,
+    "l.name",
+    &glin_validate,
+  },
+
+  {
+    /* Q_EXLN - EXPAND_LIST_NAMES */
+    "expand_list_names",
+    "exln",
+    2,
+    MR_Q_RETRIEVE,
+    "l",
+    LIST_TABLE,
+    "name FROM list",
+    glin_fields,
+    1,
+    "name LIKE '%s' AND list_id != 0",
+    1,
+    "name",
+    NULL,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v2 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    2,
+    MR_Q_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)",
+    alis2_fields,
+    10,
+    0,
+    0,
+    NULL,
+    &alis2_validate,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v3 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    3,
+    MR_Q_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,
+    MR_Q_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)",
+    alis4_fields,
+    13,
+    0,
+    0,
+    NULL,
+    &alis4_validate,
+  },
+
+  {
+    /* Q_ALIS - ADD_LIST, v10 */ /* uses prefetch_value() for list_id */
+    "add_list",
+    "alis",
+    10,
+    MR_Q_APPEND,
+    "l",
+    LIST_TABLE,
+    "INTO list (name, active, publicflg, hidden, maillist, grouplist, gid, nfsgroup, mailman, mailman_id, acl_type, acl_id, memacl_type, memacl_id, description, list_id) VALUES ('%s', %s, %s, %s, %s, %s, %s, %s, %s, %d, '%s', %d, '%s', %d, NVL('%s', CHR(0)), %s)",
+    alis_fields,
+    15,
+    0,
+    0,
     NULL,
-    &dcld_validate,
+    &alis_validate,
   },
 
   {
-    /* Q_GLIN - GET_LIST_INFO */
-    "get_list_info",
-    "glin",
+    /* Q_ULIS - UPDATE_LIST, v2 */
+    "update_list",
+    "ulis",
     2,
-    RETRIEVE,
+    MR_Q_UPDATE,
     "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,
-    13,
-    "name LIKE '%s'",
+    "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, acl_type = '%s', acl_id = %d, description = NVL('%s', CHR(0))",
+    ulis2_fields,
+    10,
+    "list_id = %d",
     1,
-    "name",
-    &glin_validate,
+    NULL,
+    &ulis2_validate,
   },
 
   {
-    /* Q_EXLN - EXPAND_LIST_NAMES */
-    "expand_list_names",
-    "exln",
-    2,
-    RETRIEVE,
+    /* Q_ULIS - UPDATE_LIST, v3 */
+    "update_list",
+    "ulis",
+    3,
+    MR_Q_UPDATE,
     "l",
     LIST_TABLE,
-    "name FROM list",
-    glin_fields,
-    1,
-    "name LIKE '%s' AND list_id != 0",
+    "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,
-    "name",
     NULL,
+    &ulis3_validate,
   },
 
   {
-    /* Q_ALIS - ADD_LIST */ /* uses prefetch_value() for list_id */
-    "add_list",
-    "alis",
-    2,
-    APPEND,
+    /* Q_ULIS, UPDATE_LIST, v4 */
+    "update_list",
+    "ulis",
+    4,
+    MR_Q_UPDATE,
     "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,
-    10,
-    0,
-    0,
+    "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
+    ulis4_fields,
+    13,
+    "list_id = %d",
+    1,
     NULL,
-    &alis_validate,
+    &ulis4_validate,
   },
 
   {
-    /* Q_ULIS - UPDATE_LIST */
+    /* Q_ULIS, UPDATE_LIST, v10 */
     "update_list",
     "ulis",
-    2,
-    UPDATE,
+    10,
+    MR_Q_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))",
+    "list SET name = '%s', active = %s, publicflg = %s, hidden = %s, maillist = %s, grouplist = %s, gid = %s, nfsgroup = %s, mailman = %s, mailman_id = %d, acl_type = '%s', acl_id = %d, memacl_type = '%s', memacl_id = %d, description = NVL('%s', CHR(0))",
     ulis_fields,
-    10,
+    15,
     "list_id = %d",
     1,
     NULL,
@@ -3665,7 +6065,7 @@ struct query Queries[] = {
     "delete_list",
     "dlis",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "l",
     LIST_TABLE,
     NULL,
@@ -3682,7 +6082,7 @@ struct query Queries[] = {
     "add_member_to_list",
     "amtl",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     IMEMBERS_TABLE,
     0,
@@ -3699,7 +6099,7 @@ struct query Queries[] = {
     "add_tagged_member_to_list",
     "atml",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     IMEMBERS_TABLE,
     0,
@@ -3716,13 +6116,13 @@ struct query Queries[] = {
     "tag_member_of_list",
     "tmol",
     2,
-    UPDATE,
-    "im",
+    MR_Q_UPDATE,
+    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,
@@ -3733,7 +6133,7 @@ struct query Queries[] = {
     "delete_member_from_list",
     "dmfl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     IMEMBERS_TABLE,
     NULL,
@@ -3750,7 +6150,7 @@ struct query Queries[] = {
     "get_ace_use",
     "gaus",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     0,
     0,
@@ -3767,7 +6167,7 @@ struct query Queries[] = {
     "get_host_by_owner",
     "ghbo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     0,
     0,
@@ -3784,7 +6184,7 @@ struct query Queries[] = {
     "qualified_get_lists",
     "qgli",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     LIST_TABLE,
     0,
@@ -3801,7 +6201,7 @@ struct query Queries[] = {
     "get_members_of_list",
     "gmol",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -3818,7 +6218,7 @@ struct query Queries[] = {
     "get_end_members_of_list",
     "geml",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -3835,7 +6235,7 @@ struct query Queries[] = {
     "get_tagged_members_of_list",
     "gtml",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     NULL,
     IMEMBERS_TABLE,
     NULL,
@@ -3852,7 +6252,7 @@ struct query Queries[] = {
     "get_lists_of_member",
     "glom",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     IMEMBERS_TABLE,
     0,
@@ -3869,7 +6269,7 @@ struct query Queries[] = {
     "count_members_of_list",
     "cmol",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     IMEMBERS_TABLE,
     0,
@@ -3886,7 +6286,7 @@ struct query Queries[] = {
     "get_server_info",
     "gsin",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "s",
     SERVERS_TABLE,
     "name, update_int, target_file, script, dfgen, dfcheck, type, enable, inprogress, harderror, errmsg, acl_type, acl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM servers",
@@ -3903,7 +6303,7 @@ struct query Queries[] = {
     "qualified_get_server",
     "qgsv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     SERVERS_TABLE,
     0,
@@ -3920,7 +6320,7 @@ struct query Queries[] = {
     "add_server_info",
     "asin",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "s",
     SERVERS_TABLE,
     "INTO servers (name, update_int, target_file, script, type, enable, acl_type, acl_id) VALUES (UPPER('%s'), %s, '%s', '%s', '%s', %s, '%s', %d)",
@@ -3937,7 +6337,7 @@ struct query Queries[] = {
     "update_server_info",
     "usin",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET update_int = %s, target_file = '%s', script = '%s', type = '%s', enable = %s, acl_type = '%s', acl_id = %d",
@@ -3954,7 +6354,7 @@ struct query Queries[] = {
     "reset_server_error",
     "rsve",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET harderror = 0, dfcheck = dfgen",
@@ -3971,7 +6371,7 @@ struct query Queries[] = {
     "set_server_internal_flags",
     "ssif",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERS_TABLE,
     "servers SET dfgen = %s, dfcheck = %s, inprogress = %s, harderror = %s, errmsg = NVL('%s', CHR(0))",
@@ -3988,7 +6388,7 @@ struct query Queries[] = {
     "delete_server_info",
     "dsin",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "s",
     SERVERS_TABLE,
     NULL,
@@ -4005,7 +6405,7 @@ struct query Queries[] = {
     "get_server_host_info",
     "gshi",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
     "sh.service, m.name, sh.enable, sh.override, sh.success, sh.inprogress, sh.hosterror, sh.hosterrmsg, sh.ltt, sh.lts, sh.value1, sh.value2, sh.value3, TO_CHAR(sh.modtime, 'DD-mon-YYYY HH24:MI:SS'), sh.modby, sh.modwith FROM serverhosts sh, machine m",
@@ -4022,7 +6422,7 @@ struct query Queries[] = {
     "qualified_get_server_host",
     "qgsh",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     0,
     SERVERHOSTS_TABLE,
     0,
@@ -4039,7 +6439,7 @@ struct query Queries[] = {
     "add_server_host_info",
     "ashi",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "sh",
     SERVERHOSTS_TABLE,
     "INTO serverhosts (service, mach_id, enable, value1, value2, value3) VALUES (UPPER('%s'), %d, %s, %s, %s, NVL('%s', CHR(0)))",
@@ -4056,7 +6456,7 @@ struct query Queries[] = {
     "update_server_host_info",
     "ushi",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET enable = %s, value1 = %s, value2 = %s, value3 = NVL('%s', CHR(0))",
@@ -4073,7 +6473,7 @@ struct query Queries[] = {
     "reset_server_host_error",
     "rshe",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET hosterror = 0",
@@ -4090,7 +6490,7 @@ struct query Queries[] = {
     "set_server_host_override",
     "ssho",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "sh",
     SERVERHOSTS_TABLE,
     "serverhosts SET override = 1",
@@ -4107,7 +6507,7 @@ struct query Queries[] = {
     "set_server_host_internal",
     "sshi",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "s",
     SERVERHOSTS_TABLE,
     "serverhosts SET override = %s, success = %s, inprogress = %s, hosterror = %s, hosterrmsg = NVL('%s', CHR(0)), ltt = %s, lts = %s",
@@ -4124,7 +6524,7 @@ struct query Queries[] = {
     "delete_server_host_info",
     "dshi",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "sh",
     SERVERHOSTS_TABLE,
     NULL,
@@ -4141,7 +6541,7 @@ struct query Queries[] = {
     "get_server_locations",
     "gslo",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "sh",
     SERVERHOSTS_TABLE,
     "sh.service, m.name FROM serverhosts sh, machine m",
@@ -4158,7 +6558,7 @@ struct query Queries[] = {
     "get_filesys_by_label",
     "gfsl",
     2,
-    RETRIEVE,
+    MR_Q_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",
@@ -4175,7 +6575,7 @@ struct query Queries[] = {
     "get_filesys_by_machine",
     "gfsm",
     2,
-    RETRIEVE,
+    MR_Q_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",
@@ -4192,7 +6592,7 @@ struct query Queries[] = {
     "get_filesys_by_nfsphys",
     "gfsn",
     2,
-    RETRIEVE,
+    MR_Q_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",
@@ -4209,7 +6609,7 @@ struct query Queries[] = {
     "get_filesys_by_group",
     "gfsg",
     2,
-    RETRIEVE,
+    MR_Q_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",
@@ -4226,7 +6626,7 @@ struct query Queries[] = {
     "get_filesys_by_path",
     "gfsp",
     2,
-    RETRIEVE,
+    MR_Q_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",
@@ -4243,7 +6643,7 @@ struct query Queries[] = {
     "add_filesys",
     "afil",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "fs",
     FILESYS_TABLE,
     "INTO filesys (label, type, mach_id, name, mount, rwaccess, comments, owner, owners, createflg, lockertype, filsys_id) VALUES ('%s', '%s', %d, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', NVL('%s', CHR(0)), %d, %d, %s, '%s', %s)",
@@ -4260,7 +6660,7 @@ struct query Queries[] = {
     "update_filesys",
     "ufil",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "fs",
     FILESYS_TABLE,
     "filesys SET label = '%s', type = '%s', mach_id = %d, name = NVL('%s', CHR(0)), mount = NVL('%s', CHR(0)), rwaccess = '%s', comments = NVL('%s', CHR(0)), owner = %d, owners = %d, createflg = %s, lockertype = '%s'",
@@ -4277,7 +6677,7 @@ struct query Queries[] = {
     "delete_filesys",
     "dfil",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "fs",
     FILESYS_TABLE,
     NULL,
@@ -4294,7 +6694,7 @@ struct query Queries[] = {
     "get_fsgroup_members",
     "gfgm",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "fg",
     FSGROUP_TABLE,
     "fs.label, fg.key FROM fsgroup fg, filesys fs",
@@ -4311,7 +6711,7 @@ struct query Queries[] = {
     "add_filesys_to_fsgroup",
     "aftg",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "fg",
     FSGROUP_TABLE,
     "INTO fsgroup (group_id, filsys_id, key) VALUES (%d, %d, '%s')",
@@ -4328,7 +6728,7 @@ struct query Queries[] = {
     "remove_filesys_from_fsgroup",
     "rffg",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "fg",
     FSGROUP_TABLE,
     NULL,
@@ -4345,7 +6745,7 @@ struct query Queries[] = {
     "get_all_nfsphys",
     "ganf",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "np",
     NFSPHYS_TABLE,
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
@@ -4362,7 +6762,7 @@ struct query Queries[] = {
     "get_nfsphys",
     "gnfp",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "np",
     NFSPHYS_TABLE,
     "m.name, np.dir, np.device, np.status, np.allocated, np.partsize, TO_CHAR(np.modtime, 'DD-mon-YYYY HH24:MI:SS'), np.modby, np.modwith FROM nfsphys np, machine m",
@@ -4379,7 +6779,7 @@ struct query Queries[] = {
     "add_nfsphys",
     "anfp",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "np",
     NFSPHYS_TABLE,
     "INTO nfsphys (mach_id, dir, device, status, allocated, partsize, nfsphys_id) VALUES (%d, '%s', NVL('%s', CHR(0)), %s, %s, %s, %s)",
@@ -4396,7 +6796,7 @@ struct query Queries[] = {
     "update_nfsphys",
     "unfp",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "np",
     NFSPHYS_TABLE,
     "nfsphys SET device = NVL('%s', CHR(0)), status = %s, allocated = %s, partsize = %s",
@@ -4413,7 +6813,7 @@ struct query Queries[] = {
     "adjust_nfsphys_allocation",
     "ajnf",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "np",
     NFSPHYS_TABLE,
     "nfsphys SET allocated = allocated + %s",
@@ -4430,7 +6830,7 @@ struct query Queries[] = {
     "delete_nfsphys",
     "dnfp",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "np",
     NFSPHYS_TABLE,
     NULL,
@@ -4447,7 +6847,7 @@ struct query Queries[] = {
     "get_quota",
     "gqot",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
@@ -4464,7 +6864,7 @@ struct query Queries[] = {
     "get_quota_by_filesys",
     "gqbf",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, q.type, q.entity_id, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, machine m",
@@ -4481,7 +6881,7 @@ struct query Queries[] = {
     "add_quota",
     "aqot",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     QUOTA_TABLE,
     "INTO quota (filsys_id, type, entity_id, quota, phys_id) VALUES ('%s', %d, %d, %s, %s)",
@@ -4498,7 +6898,7 @@ struct query Queries[] = {
     "update_quota",
     "uqot",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     QUOTA_TABLE,
     "quota SET quota = %s",
@@ -4515,7 +6915,7 @@ struct query Queries[] = {
     "delete_quota",
     "dqot",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     QUOTA_TABLE,
     NULL,
@@ -4532,7 +6932,7 @@ struct query Queries[] = {
     "get_nfs_quota",
     "gnfq",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, q.phys_id, m.name, TO_CHAR(q.modtime, 'DD-mon-YYYY HH24:MI:SS'), q.modby, q.modwith FROM quota q, filesys fs, users u, machine m",
@@ -4549,7 +6949,7 @@ struct query Queries[] = {
     "get_nfs_quotas_by_partition",
     "gnqp",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "q",
     QUOTA_TABLE,
     "fs.label, u.login, q.quota, np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
@@ -4566,7 +6966,7 @@ struct query Queries[] = {
     "add_nfs_quota",
     "anfq",
     2,
-    APPEND,
+    MR_Q_APPEND,
     0,
     QUOTA_TABLE,
     "INTO quota (type, filsys_id, entity_id, quota, phys_id ) VALUES ('USER', %d, %d, %s, %s)",
@@ -4583,7 +6983,7 @@ struct query Queries[] = {
     "update_nfs_quota",
     "unfq",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     0,
     QUOTA_TABLE,
     "quota SET quota = %s",
@@ -4600,7 +7000,7 @@ struct query Queries[] = {
     "delete_nfs_quota",
     "dnfq",
     2,
-    DELETE,
+    MR_Q_DELETE,
     0,
     QUOTA_TABLE,
     NULL,
@@ -4613,15 +7013,15 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_GZCL - GET_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v2 */
     "get_zephyr_class",
     "gzcl",
     2,
-    RETRIEVE,
+    MR_Q_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,
@@ -4630,36 +7030,87 @@ struct query Queries[] = {
   },
 
   {
-    /* Q_AZCL - ADD_ZEPHYR_CLASS */
+    /* Q_GZCL - GET_ZEPHYR_CLASS, v5 */
+    "get_zephyr_class",
+    "gzcl",
+    5,
+    MR_Q_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,
+    MR_Q_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,
+    MR_Q_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,
+    MR_Q_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,
+    MR_Q_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,
   },
 
@@ -4668,7 +7119,7 @@ struct query Queries[] = {
     "delete_zephyr_class",
     "dzcl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "z",
     ZEPHYR_TABLE,
     0,
@@ -4685,7 +7136,7 @@ struct query Queries[] = {
     "get_server_host_access",
     "gsha",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ha",
     HOSTACCESS_TABLE,
     "m.name, ha.acl_type, ha.acl_id, TO_CHAR(ha.modtime, 'DD-mon-YYYY HH24:MI:SS'), ha.modby, ha.modwith FROM hostaccess ha, machine m",
@@ -4702,7 +7153,7 @@ struct query Queries[] = {
     "add_server_host_access",
     "asha",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ha",
     HOSTACCESS_TABLE,
     "INTO hostaccess (mach_id, acl_type, acl_id) VALUES (%d, '%s', %d)",
@@ -4719,7 +7170,7 @@ struct query Queries[] = {
     "update_server_host_access",
     "usha",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "ha",
     HOSTACCESS_TABLE,
     "hostaccess SET acl_type = '%s', acl_id = %d",
@@ -4736,7 +7187,7 @@ struct query Queries[] = {
     "delete_server_host_access",
     "dsha",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ha",
     HOSTACCESS_TABLE,
     0,
@@ -4753,7 +7204,7 @@ struct query Queries[] = {
     "get_acl",
     "gacl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ac",
     ACL_TABLE,
     "m.name, ac.target, ac.kind, l.name FROM acl ac, machine m, list l",
@@ -4770,7 +7221,7 @@ struct query Queries[] = {
     "add_acl",
     "aacl",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ac",
     ACL_TABLE,
     "INTO acl (mach_id, target, kind, list_id) VALUES (%d, '%s', '%s', %d)",
@@ -4787,7 +7238,7 @@ struct query Queries[] = {
     "delete_acl",
     "dacl",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ac",
     ACL_TABLE,
     0,
@@ -4804,14 +7255,14 @@ struct query Queries[] = {
     "get_service",
     "gsvc",
     2,
-    RETRIEVE,
+    MR_Q_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,
   },
@@ -4821,7 +7272,7 @@ struct query Queries[] = {
     "add_service",
     "asvc",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ss",
     SERVICES_TABLE,
     "INTO services (name, protocol, port, description) VALUES ('%s', '%s', %s, NVL('%s', CHR(0)))",
@@ -4838,16 +7289,16 @@ struct query Queries[] = {
     "delete_service",
     "dsvc",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ss",
     SERVICES_TABLE,
     0,
-    asvc_fields,
+    dsvc_fields,
     0,
-    "name = '%s'",
-    1,
+    "name = '%s' AND protocol = '%s'",
+    2,
     NULL,
-    &asvc_validate,
+    &dsvc_validate,
   },
 
   {
@@ -4855,7 +7306,7 @@ struct query Queries[] = {
     "get_printer",
     "gprn",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4872,7 +7323,7 @@ struct query Queries[] = {
     "get_printer_by_duplexname",
     "gpbd",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4889,7 +7340,7 @@ struct query Queries[] = {
     "get_printer_by_ethernet",
     "gpbe",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4906,7 +7357,7 @@ struct query Queries[] = {
     "get_printer_by_hostname",
     "gpbh",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4923,7 +7374,7 @@ struct query Queries[] = {
     "get_printer_by_rm",
     "gpbr",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4940,7 +7391,7 @@ struct query Queries[] = {
     "get_printer_by_location",
     "gpbl",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4957,7 +7408,7 @@ struct query Queries[] = {
     "get_printer_by_contact",
     "gpbc",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "pr",
     PRINTERS_TABLE,
     "pr.name, pr.type, pr.hwtype, pr.duplexname, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2",
@@ -4974,7 +7425,7 @@ struct query Queries[] = {
     "add_printer",
     "aprn",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "pr",
     PRINTERS_TABLE,
     "INTO printers (name, type, hwtype, duplexname, mach_id, loghost, rm, rp, rq, ka, pc, ac, lpc_acl, banner, location, contact) VALUES ('%s', '%s', '%s', NVL('%s', CHR(0)), %d, %d, %d, NVL('%s', CHR(0)), %d, %s, %s, %d, %d, %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)))",
@@ -4991,14 +7442,14 @@ struct query Queries[] = {
     "update_printer",
     "uprn",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "pr",
     PRINTERS_TABLE,
-    "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %d, pc = %d, ac = %d, lpc_acl = %d, banner = %d, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
+    "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %s, pc = %s, ac = %d, lpc_acl = %d, banner = %s, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
     uprn_fields,
     16,
-    0,
-    0,
+    "name = '%s'",
+    1,
     NULL,
     &uprn_validate,
   },
@@ -5008,7 +7459,7 @@ struct query Queries[] = {
     "delete_printer",
     "dprn",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "pr",
     PRINTERS_TABLE,
     0,
@@ -5025,7 +7476,7 @@ struct query Queries[] = {
     "get_print_server",
     "gpsv",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "ps",
     PRINTSERVERS_TABLE,
     "m.name, ps.kind, s.string, ps.owner_type, ps.owner_id, l.name, TO_CHAR(ps.modtime, 'DD-mon-YYYY HH24:MI:SS'), ps.modby, ps.modwith FROM printservers ps, machine m, strings s, list l",
@@ -5042,7 +7493,7 @@ struct query Queries[] = {
     "add_print_server",
     "apsv",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "ps",
     PRINTSERVERS_TABLE,
     "INTO printservers (mach_id, kind, printer_types, owner_type, owner_id, lpc_acl) VALUES (%d, '%s', %d, '%s', %d, %d)",
@@ -5059,7 +7510,7 @@ struct query Queries[] = {
     "update_print_server",
     "upsv",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "ps",
     PRINTSERVERS_TABLE,
     "printservers SET kind = '%s', printer_types = %d, owner_type = '%s', owner_id = %d, lpc_acl = %d",
@@ -5076,7 +7527,7 @@ struct query Queries[] = {
     "delete_print_server",
     "dpsv",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "ps",
     PRINTSERVERS_TABLE,
     0,
@@ -5093,7 +7544,7 @@ struct query Queries[] = {
     "get_alias",
     "gali",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "a",
     ALIAS_TABLE,
     "name, type, trans FROM alias",
@@ -5110,7 +7561,7 @@ struct query Queries[] = {
     "add_alias",
     "aali",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "a",
     ALIAS_TABLE,
     "INTO alias (name, type, trans) VALUES ('%s', '%s', '%s')",
@@ -5127,7 +7578,7 @@ struct query Queries[] = {
     "delete_alias",
     "dali",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "a",
     ALIAS_TABLE,
     NULL,
@@ -5144,7 +7595,7 @@ struct query Queries[] = {
     "get_value",
     "gval",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "val",
     NUMVALUES_TABLE,
     "value FROM numvalues",
@@ -5161,7 +7612,7 @@ struct query Queries[] = {
     "add_value",
     "aval",
     2,
-    APPEND,
+    MR_Q_APPEND,
     "val",
     NUMVALUES_TABLE,
     "INTO numvalues (name, value) VALUES ('%s', %s)",
@@ -5178,7 +7629,7 @@ struct query Queries[] = {
     "update_value",
     "uval",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     "val",
     NUMVALUES_TABLE,
     "numvalues SET value = %s",
@@ -5195,7 +7646,7 @@ struct query Queries[] = {
     "delete_value",
     "dval",
     2,
-    DELETE,
+    MR_Q_DELETE,
     "val",
     NUMVALUES_TABLE,
     NULL,
@@ -5212,7 +7663,7 @@ struct query Queries[] = {
     "get_all_table_stats",
     "gats",
     2,
-    RETRIEVE,
+    MR_Q_RETRIEVE,
     "tbs",
     TBLSTATS_TABLE,
     "table_name, appends, updates, deletes, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS') FROM tblstats",
@@ -5229,7 +7680,7 @@ struct query Queries[] = {
     "_set_debug_level",
     "_sdl",
     2,
-    UPDATE,
+    MR_Q_UPDATE,
     NULL,
     0,
     NULL,
@@ -5241,6 +7692,278 @@ struct query Queries[] = {
     &_sdl_validate,
   },
 
+  {
+    /* Q_GCON - GET_CONTAINER, v7 */
+    "get_container",
+    "gcon",
+    7,
+    MR_Q_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",
+    gcon7_fields,
+    11,
+    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
+    1,
+    NULL,
+    &gcon_validate,
+  },
+
+  {
+    /* Q_GCON - GET_CONTAINER, v9 */
+    "get_container",
+    "gcon",
+    9,
+    MR_Q_RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM containers",
+    gcon_fields,
+    12,
+    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
+    1,
+    NULL,
+    &gcon_validate,
+  },
+
+  {
+    /* Q_ACON - ADD_CONTAINER, v7 */ /* uses prefetch_value() for cnt_id */
+    "add_container",
+    "acon",
+    7,
+    MR_Q_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)",
+    acon7_fields,
+    8,
+    0,
+    0,
+    NULL,
+    &acon7_validate,
+  },
+
+  {
+    /* Q_ACON - ADD_CONTAINER, v9 */ /* uses prefetch_value() for cnt_id */
+    "add_container",
+    "acon",
+    9,
+    MR_Q_APPEND,
+    "c",
+    CONTAINERS_TABLE,
+    "INTO containers (name, publicflg, description, location, contact, acl_type, acl_id, memacl_type, memacl_id, cnt_id) VALUES ('%s', %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, '%s', %d, %s)",
+    acon_fields,
+    9,
+    0,
+    0,
+    NULL,
+    &acon_validate,
+  },
+
+  {
+    /* Q_UCON - UPDATE_CONTAINER, v7 */
+    "update_container",
+    "ucon",
+    7,
+    MR_Q_UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    ucon7_fields,
+    8,
+    0,
+    1,
+    NULL,
+    &ucon7_validate,
+  },
+
+  {
+    /* Q_UCON - UPDATE_CONTAINER, v9 */
+    "update_container",
+    "ucon",
+    9,
+    MR_Q_UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    ucon_fields,
+    9,
+    0,
+    1,
+    NULL,
+    &ucon_validate,
+  },
+
+  {
+    /* Q_DCON - DELETE_CONTAINER, v7 */
+    "delete_container",
+    "dcon",
+    7,
+    MR_Q_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,
+    MR_Q_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,
+    MR_Q_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,
+    MR_Q_RETRIEVE,
+    "mcn",
+    MCNTMAP_TABLE,
+    "m.name, c.name FROM machine m, containers c, mcntmap mcn",
+    gmnm_fields,
+    2,
+    "m.name LIKE 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,
+    MR_Q_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,
+    MR_Q_RETRIEVE,
+    NULL,
+    CONTAINERS_TABLE,
+    NULL,
+    gsoc_fields,
+    1,
+    NULL,
+    2,
+    NULL,
+    &gsoc_validate,
+  },
+
+  {
+    /* Q_GTLC - GET_TOPLEVEL_CONTAINERS, v7 */
+    "get_toplevel_containers",
+    "gtlc",
+    7,
+    MR_Q_RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "name FROM containers",
+    gtlc_fields,
+    1,
+    "name NOT LIKE '%%/%%'",
+    0,
+    "name",
+    NULL,
+  },
+
+  {
+    /* Q_SCLI - SET_CONTAINER_LIST, v9 */
+    "set_container_list",
+    "scli",
+    9,
+    MR_Q_UPDATE,
+    0,
+    CONTAINERS_TABLE,
+    0,
+    scli_fields,
+    1,
+    0,
+    1,
+    NULL,
+    &scli_validate,
+  },
+
+  {
+    /* Q_GCLI - GET_CONTAINER_LIST, v9 */
+    "get_container_list",
+    "gcli",
+    9,
+    MR_Q_RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "c.name, l.name FROM containers c, list l",
+    gcli_fields,
+    2,
+    "LOWER(c.name) = LOWER('%s') AND c.list_id = l.list_id AND c.list_id != 0",
+    1,
+    NULL,
+    NULL,
+  },
+
+  {
+    /* G_GLIC - GET_LIST_CONTAINER, v9 */
+    "get_list_container",
+    "glic",
+    9,
+    MR_Q_RETRIEVE,
+    "c",
+    CONTAINERS_TABLE,
+    "c.name, l.name FROM containers c, list l",
+    glic_fields,
+    2,
+    "l.list_id = %d AND l.list_id = c.list_id and c.list_id != 0",
+    1,
+    NULL,
+    &glic_validate,
+  },
+
 };
 
 int QueryCount = (sizeof(Queries) / sizeof(struct query));
This page took 0.240475 seconds and 4 git commands to generate.