source: trunk/third/moira/server/queries2.c @ 24447

Revision 24447, 192.9 KB checked in by broder, 14 years ago (diff)
In moira: * New SVN snapshot.
Line 
1/* $Id: queries2.c 3989 2010-03-10 18:18:16Z zacheiss $
2 *
3 * This file defines the query dispatch table
4 *
5 * Copyright (C) 1987-1998 by the Massachusetts Institute of Technology.
6 * For copying and distribution information, please see the file
7 * <mit-copyright.h>.
8 */
9
10#include <mit-copyright.h>
11#include "mr_server.h"
12#include "query.h"
13
14#include "mr_et.h"
15
16RCSID("$HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/server/queries2.c $ $Id: queries2.c 3989 2010-03-10 18:18:16Z zacheiss $");
17
18/* VALOBJS
19 * These are commonly used validation objects, defined here so that they
20 * can be shared.
21 */
22
23static struct valobj VOuser0[] = {
24  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
25};
26
27static struct valobj VOmach0[] = {
28  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
29};
30
31static struct valobj VOclu0[] = {
32  {V_ID, 0, CLUSTERS_TABLE, "name", "clu_id", MR_CLUSTER},
33};
34
35static struct valobj VOsnet0[] = {
36  {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
37};
38
39static struct valobj VOlist0[] = {
40  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
41};
42
43static struct valobj VOfilesys0[] = {
44  {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
45};
46
47static struct valobj VOcon0[] = {
48  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
49};
50
51static struct valobj VOnum0[] = {
52  {V_NUM, 0},
53};
54
55/* Validations
56 * Commonly used validation records defined here so that they may
57 * be shared.
58 */
59
60static struct validate VDmach = { VOmach0, 1 };
61
62static struct validate VDfix_modby = {
63  0,
64  0,
65  0,
66  0,
67  0,
68  0,
69  0,
70  0,
71  followup_fix_modby,
72};
73
74/* Query data */
75
76static char *galo2_fields[] = {
77  "login", "unix_uid", "shell", "last", "first", "middle",
78};
79
80static char *galo_fields[] = {
81  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
82};
83
84static char *gual2_fields[] = {
85  "login",
86  "login", "unix_uid", "shell", "last", "first", "middle", "status",
87  "clearid", "class", "comments", "signature", "secure",
88  "modtime", "modby", "modwith",
89};
90
91static char *gual3_fields[] = {
92  "login",
93  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
94  "status", "clearid", "class", "comments", "signature", "secure", "modtime",
95  "modby", "modwith", "created", "creator",
96};
97
98static char *gual11_fields[] = {
99  "login",
100  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
101  "status", "clearid", "class", "comments", "signature", "secure",
102  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
103  "creator",
104};
105
106static char *gual12_fields[] = {
107  "login",
108  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
109  "status", "clearid", "class", "comments", "signature", "secure",
110  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
111  "modtime", "modby", "modwith", "created", "creator",
112};
113
114static char *gual_fields[] = {
115  "login",
116  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
117  "status", "clearid", "class", "comments", "signature", "secure",
118  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
119  "alternate_email", "alternate_phone", "modtime", "modby", "modwith", "created", "creator",
120};
121
122static char *gubl2_fields[] = {
123  "login",
124  "login", "unix_uid", "shell", "last", "first", "middle", "status",
125  "clearid", "class", "modtime", "modby", "modwith",
126};
127
128static char *gubl_fields[] = {
129  "login",
130  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
131  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
132  "creator",
133};
134
135static struct validate gubl2_validate =
136{
137  0,
138  0,
139  0,
140  0,
141  0,
142  0,
143  access_login,
144  0,
145  followup_fix_modby,
146};
147
148static struct validate gubl_validate =
149{
150  0,
151  0,
152  0,
153  0,
154  0,
155  0,
156  access_login,
157  0,
158  followup_get_user,
159};
160
161static char *guau2_fields[] = {
162  "unix_uid",
163  "login", "unix_uid", "shell", "last", "first", "middle", "status",
164  "clearid", "class", "comments", "signature", "secure",
165  "modtime", "modby", "modwith",
166};
167
168static char *guau3_fields[] = {
169  "unix_uid",
170  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
171  "status", "clearid", "class", "comments", "signature", "secure",
172  "modtime", "modby", "modwith", "created", "creator",
173};
174
175static char *guau11_fields[] = {
176  "unix_uid",
177  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
178  "status", "clearid", "class", "comments", "signature", "secure",
179  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
180  "creator",
181};
182
183static char *guau12_fields[] = {
184  "unix_uid",
185  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
186  "status", "clearid", "class", "comments", "signature", "secure",
187  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
188  "modtime", "modby", "modwith", "created", "creator",
189};
190
191static char *guau_fields[] = {
192  "unix_uid",
193  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
194  "status", "clearid", "class", "comments", "signature", "secure",
195  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
196  "alternate_email", "alternate_phone", "modtime", "modby", "modwith", "created", "creator",
197};
198
199static char *guan2_fields[] = {
200  "first", "last",
201  "login", "unix_uid", "shell", "last", "first", "middle", "status",
202  "clearid", "class", "comments", "signature", "secure",
203  "modtime", "modby", "modwith",
204};
205
206static char *guan3_fields[] = {
207  "first", "last",
208  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
209  "status", "clearid", "class", "comments", "signature", "secure",
210  "modtime", "modby", "modwith", "created", "creator",
211};
212
213static char *guan11_fields[] = {
214  "first", "last",
215  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
216  "status", "clearid", "class", "comments", "signature", "secure",
217  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
218  "creator",
219};
220
221static char *guan12_fields[] = {
222  "first", "last",
223  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
224  "status", "clearid", "class", "comments", "signature", "secure",
225  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
226  "modtime", "modby", "modwith", "created", "creator",
227};
228
229static char *guan_fields[] = {
230  "first", "last",
231  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
232  "status", "clearid", "class", "comments", "signature", "secure",
233  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
234  "alternate_email", "alternate_phone", "modtime", "modby", "modwith", "created", "creator",
235};
236
237static struct validate guan2_validate =
238{
239  0,
240  0,
241  0,
242  0,
243  0,
244  0,
245  0,
246  0,
247  followup_fix_modby,
248};
249
250static struct validate guan_validate =
251{
252  0,
253  0,
254  0,
255  0,
256  0,
257  0,
258  0,
259  0,
260  followup_get_user,
261};
262
263static char *guac2_fields[] = {
264  "class",
265  "login", "unix_uid", "shell", "last", "first", "middle", "status",
266  "clearid", "class", "comments", "signature", "secure",
267  "modtime", "modby", "modwith",
268};
269
270static char *guac3_fields[] = {
271  "class",
272  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
273  "status", "clearid", "class", "comments", "signature", "secure",
274  "modtime", "modby", "modwith", "created", "creator",
275};
276
277static char *guac11_fields[] = {
278  "class",
279  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
280  "status", "clearid", "class", "comments", "signature", "secure",
281  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
282  "creator",
283};
284
285static char *guac12_fields[] = {
286  "class",
287  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
288  "status", "clearid", "class", "comments", "signature", "secure",
289  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
290  "modtime", "modby", "modwith", "created", "creator",
291};
292
293static char *guac_fields[] = {
294  "class",
295  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
296  "status", "clearid", "class", "comments", "signature", "secure",
297  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
298  "alternate_email", "alternate_phone", "modtime", "modby", "modwith", "created", "creator",
299};
300
301static char *guam2_fields[] = {
302  "clearid",
303  "login", "unix_uid", "shell", "last", "first", "middle", "status",
304  "clearid", "class", "comments", "signature", "secure",
305  "modtime", "modby", "modwith",
306};
307
308static char *guam3_fields[] = {
309  "clearid",
310  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
311  "status", "clearid", "class", "comments", "signature", "secure",
312  "modtime", "modby", "modwith", "created", "creator",
313};
314
315static char *guam11_fields[] = {
316  "clearid",
317  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
318  "status", "clearid", "class", "comments", "signature", "secure",
319  "winhomedir", "winprofiledir", "modtime", "modby", "modwith", "created",
320  "creator",
321};
322
323static char *guam12_fields[] = {
324  "clearid",
325  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
326  "status", "clearid", "class", "comments", "signature", "secure",
327  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
328  "modtime", "modby", "modwith", "created", "creator",
329};
330
331static char *guam_fields[] = {
332  "clearid",
333  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
334  "status", "clearid", "class", "comments", "signature", "secure",
335  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
336  "alternate_email", "alternate_phone", "modtime", "modby", "modwith", "created", "creator",
337};
338
339static char *guas_fields[] = {
340  "sponsor_type", "sponsor_name",
341  "login",
342};
343
344static struct valobj guas_valobj[] = {
345  {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
346  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
347};
348
349static struct validate guas_validate = {
350  guas_valobj,
351  2,
352  0,
353  0,
354  0,
355  0,
356  access_member,
357  0,
358  get_user_account_by_sponsor,
359};
360
361static char *gubu2_fields[] = {
362  "unix_uid",
363  "login", "unix_uid", "shell", "last", "first", "middle", "status",
364  "clearid", "class", "modtime", "modby", "modwith",
365};
366
367static char *gubu_fields[] = {
368  "unix_uid",
369  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
370  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
371  "creator",
372};
373
374static struct validate gubu2_validate =
375{
376  VOnum0,
377  1,
378  0,
379  0,
380  0,
381  0,
382  access_login,
383  0,
384  followup_fix_modby,
385};
386
387static struct validate gubu_validate =
388{
389  VOnum0,
390  1,
391  0,
392  0,
393  0,
394  0,
395  access_login,
396  0,
397  followup_get_user,
398};
399
400static char *gubn2_fields[] = {
401  "first", "last",
402  "login", "unix_uid", "shell", "last", "first", "middle", "status",
403  "clearid", "class", "modtime", "modby", "modwith",
404};
405
406static char *gubn_fields[] = {
407  "first", "last",
408  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
409  "status", "clearid", "class", "modtime", "modby", "modwith", "created",
410  "creator",
411};
412
413static struct validate gubn2_validate =
414{
415  0,
416  0,
417  0,
418  0,
419  0,
420  0,
421  0,
422  0,
423  followup_fix_modby,
424};
425
426static struct validate gubn_validate =
427{
428  0,
429  0,
430  0,
431  0,
432  0,
433  0,
434  0,
435  0,
436  followup_get_user,
437};
438
439static char *gubc2_fields[] = {
440  "class",
441  "login", "unix_uid", "shell", "last", "first", "middle", "status",
442  "clearid", "class", "modtime", "modby", "modwith",
443};
444
445static char *gubc_fields[] = {
446  "class",
447  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
448  "status", "clearid", "class", "modtime", "modby", "modwith",
449  "created", "creator",
450};
451
452static char *gubm2_fields[] = {
453  "clearid",
454  "login", "unix_uid", "shell", "last", "first", "middle", "status",
455  "clearid", "class", "modtime", "modby", "modwith",
456};
457
458static char *gubm_fields[] = {
459  "clearid",
460  "login", "unix_uid", "shell", "winconsoleshell", "last", "first",
461  "middle", "status", "clearid", "class", "modtime", "modby", "modwith",
462  "created", "creator",
463};
464
465static char *auac2_fields[] = {
466  "login", "unix_uid", "shell", "last", "first", "middle", "status",
467  "clearid", "class", "comments", "signature", "secure",
468};
469
470static char *auac3_fields[] = {
471  "login", "unix_uid", "shell", "winconsoleshell", "last", "first",
472  "middle", "status", "clearid", "class", "comments", "signature", "secure",
473};
474
475static char *auac11_fields[] = {
476  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
477  "status", "clearid", "class", "comments", "signature", "secure",
478  "winhomedir", "winprofiledir",
479};
480
481static char *auac12_fields[] = {
482  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
483  "status", "clearid", "class", "comments", "signature", "secure",
484  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
485};
486
487static char *auac_fields[] = {
488  "login", "unix_uid", "shell", "winconsoleshell", "last", "first", "middle",
489  "status", "clearid", "class", "comments", "signature", "secure",
490  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
491  "alternate_email", "alternate_phone",
492};
493
494static struct valobj auac2_valobj[] = {
495  {V_CHAR, 0, USERS_TABLE, "login"},
496  {V_NUM, 1},
497  {V_CHAR, 2, USERS_TABLE, "shell"},
498  {V_CHAR, 3, USERS_TABLE, "last"},
499  {V_CHAR, 4, USERS_TABLE, "first"},
500  {V_CHAR, 5, USERS_TABLE, "middle"},
501  {V_NUM, 6},
502  {V_CHAR, 7, USERS_TABLE, "clearid"},
503  {V_TYPE, 8, 0, "class", 0, MR_BAD_CLASS},
504  {V_ID, 9, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
505  {V_NUM, 11},
506};
507
508static struct valobj auac3_valobj[] = {
509  {V_CHAR, 0, USERS_TABLE, "login"},
510  {V_NUM, 1},
511  {V_CHAR, 2, USERS_TABLE, "shell"},
512  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
513  {V_CHAR, 4, USERS_TABLE, "last"},
514  {V_CHAR, 5, USERS_TABLE, "first"},
515  {V_CHAR, 6, USERS_TABLE, "middle"},
516  {V_NUM, 7},
517  {V_CHAR, 8, USERS_TABLE, "clearid"},
518  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
519  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
520  {V_NUM, 12},
521};
522
523static struct valobj auac11_valobj[] = {
524  {V_CHAR, 0, USERS_TABLE, "login"},
525  {V_NUM, 1},
526  {V_CHAR, 2, USERS_TABLE, "shell"},
527  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
528  {V_CHAR, 4, USERS_TABLE, "last"},
529  {V_CHAR, 5, USERS_TABLE, "first"},
530  {V_CHAR, 6, USERS_TABLE, "middle"},
531  {V_NUM, 7},
532  {V_CHAR, 8, USERS_TABLE, "clearid"},
533  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
534  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
535  {V_NUM, 12},
536  {V_LEN, 13, USERS_TABLE, "winhomedir"},
537  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
538};
539
540static struct valobj auac12_valobj[] = {
541  {V_CHAR, 0, USERS_TABLE, "login"},
542  {V_NUM, 1},
543  {V_CHAR, 2, USERS_TABLE, "shell"},
544  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
545  {V_CHAR, 4, USERS_TABLE, "last"},
546  {V_CHAR, 5, USERS_TABLE, "first"},
547  {V_CHAR, 6, USERS_TABLE, "middle"},
548  {V_NUM, 7},
549  {V_CHAR, 8, USERS_TABLE, "clearid"},
550  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
551  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
552  {V_NUM, 12},
553  {V_LEN, 13, USERS_TABLE, "winhomedir"},
554  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
555  {V_TYPE, 15, 0, "ace_type", 0, MR_ACE},
556  {V_TYPEDATA, 16, 0, 0, "list_id", MR_ACE},
557  {V_CHAR, 17, USERS_TABLE, "expiration"},
558};
559
560static struct valobj auac_valobj[] = {
561  {V_CHAR, 0, USERS_TABLE, "login"},
562  {V_NUM, 1},
563  {V_CHAR, 2, USERS_TABLE, "shell"},
564  {V_CHAR, 3, USERS_TABLE, "winconsoleshell"},
565  {V_CHAR, 4, USERS_TABLE, "last"},
566  {V_CHAR, 5, USERS_TABLE, "first"},
567  {V_CHAR, 6, USERS_TABLE, "middle"},
568  {V_NUM, 7},
569  {V_CHAR, 8, USERS_TABLE, "clearid"},
570  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
571  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
572  {V_NUM, 12},
573  {V_LEN, 13, USERS_TABLE, "winhomedir"},
574  {V_LEN, 14, USERS_TABLE, "winprofiledir"},
575  {V_TYPE, 15, 0, "ace_type", 0, MR_ACE},
576  {V_TYPEDATA, 16, 0, 0, "list_id", MR_ACE},
577  {V_CHAR, 17, USERS_TABLE, "expiration"},
578  {V_CHAR, 18, USERS_TABLE, "alternate_email"},
579  {V_CHAR, 19, USERS_TABLE, "alternate_phone"},
580};
581
582static struct validate auac2_validate = {
583  auac2_valobj,
584  11,
585  "login",
586  "login = '%s'",
587  1,
588  "users_id",
589  0,
590  setup_ausr,
591  followup_ausr,
592};
593
594static struct validate auac3_validate = {
595  auac3_valobj,
596  12,
597  "login",
598  "login = '%s'",
599  1,
600  "users_id",
601  0,
602  setup_ausr,
603  followup_ausr,
604};
605
606static struct validate auac11_validate = {
607  auac11_valobj,
608  14,
609  "login",
610  "login = '%s'",
611  1,
612  "users_id",
613  0,
614  setup_ausr,
615  followup_ausr,
616};
617
618static struct validate auac12_validate = {
619  auac12_valobj,
620  17,
621  "login",
622  "login = '%s'",
623  1,
624  "users_id",
625  0,
626  setup_ausr,
627  followup_ausr,
628};
629
630static struct validate auac_validate = {
631  auac_valobj,
632  19,
633  "login",
634  "login = '%s'",
635  1,
636  "users_id",
637  0,
638  setup_ausr,
639  followup_ausr,
640};
641
642static struct validate ausr2_validate = {
643  auac2_valobj,
644  9,
645  "login",
646  "login = '%s'",
647  1,
648  "users_id",
649  0,
650  setup_ausr,
651  followup_ausr,
652};
653
654static struct validate ausr3_validate = {
655  auac3_valobj,
656  10,
657  "login",
658  "login = '%s'",
659  1,
660  "users_id",
661  0,
662  setup_ausr,
663  followup_ausr,
664};
665
666static struct validate ausr11_validate = {
667  auac11_valobj,
668  12,
669  "login",
670  "login = '%s'",
671  1,
672  "users_id",
673  0,
674  setup_ausr,
675  followup_ausr,
676};
677
678static struct validate ausr12_validate = {
679  auac12_valobj,
680  15,
681  "login",
682  "login = '%s'",
683  1,
684  "users_id",
685  0,
686  setup_ausr,
687  followup_ausr,
688};
689
690static struct validate ausr_validate = {
691  auac_valobj,
692  17,
693  "login",
694  "login = '%s'",
695  1,
696  "users_id",
697  0,
698  setup_ausr,
699  followup_ausr,
700};
701
702static char *rusr_fields[] = {
703  "unix_uid", "login", "pobox_type"
704};
705
706static struct valobj rusr_valobj[] = {
707  {V_NUM, 0},
708  {V_CHAR, 1, USERS_TABLE, "login"},
709};
710
711static struct validate rusr_validate = {
712  rusr_valobj,
713  2,
714  0,
715  0,
716  0,
717  0,
718  0,
719  register_user,
720  0,
721};
722
723static char *uuac2_fields[] = {
724  "login",
725  "newlogin", "unix_uid", "shell", "last", "first", "middle", "status",
726  "clearid", "class", "comments", "signature", "secure",
727};
728
729static char *uuac3_fields[] = {
730  "login",
731  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
732  "middle", "status", "clearid", "class", "comments", "signature", "secure",
733};
734
735static char *uuac11_fields[] = {
736  "login",
737  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
738  "middle", "status", "clearid", "class", "comments", "signature", "secure",
739  "winhomedir", "winprofiledir",
740};
741
742static char *uuac12_fields[] = {
743  "login",
744  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
745  "middle", "status", "clearid", "class", "comments", "signature", "secure",
746  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
747};
748
749static char *uuac_fields[] = {
750  "login",
751  "newlogin", "unix_uid", "shell", "winconsoleshell", "last", "first",
752  "middle", "status", "clearid", "class", "comments", "signature", "secure",
753  "winhomedir", "winprofiledir", "sponsor_type", "sponsor_name", "expiration",
754  "alternate_email", "alternate_phone",
755};
756
757static struct valobj uuac2_valobj[] = {
758  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
759  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
760  {V_NUM, 2},
761  {V_CHAR, 3, USERS_TABLE, "shell"},
762  {V_CHAR, 4, USERS_TABLE, "first"},
763  {V_CHAR, 5, USERS_TABLE, "last"},
764  {V_CHAR, 6, USERS_TABLE, "middle"},
765  {V_NUM, 7},
766  {V_CHAR, 8, USERS_TABLE, "clearid"},
767  {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
768  {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
769  {V_NUM, 12},
770};
771 
772static struct valobj uuac3_valobj[] = {
773  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
774  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
775  {V_NUM, 2},
776  {V_CHAR, 3, USERS_TABLE, "shell"},
777  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
778  {V_CHAR, 5, USERS_TABLE, "first"},
779  {V_CHAR, 6, USERS_TABLE, "last"},
780  {V_CHAR, 7, USERS_TABLE, "middle"},
781  {V_NUM, 8},
782  {V_CHAR, 9, USERS_TABLE, "clearid"},
783  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
784  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
785  {V_NUM, 13},
786};
787
788static struct valobj uuac11_valobj[] = {
789  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
790  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
791  {V_NUM, 2},
792  {V_CHAR, 3, USERS_TABLE, "shell"},
793  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
794  {V_CHAR, 5, USERS_TABLE, "first"},
795  {V_CHAR, 6, USERS_TABLE, "last"},
796  {V_CHAR, 7, USERS_TABLE, "middle"},
797  {V_NUM, 8},
798  {V_CHAR, 9, USERS_TABLE, "clearid"},
799  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
800  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
801  {V_NUM, 13},
802  {V_LEN, 14, USERS_TABLE, "winhomedir"},
803  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
804};
805
806static struct valobj uuac12_valobj[] = {
807  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
808  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
809  {V_NUM, 2},
810  {V_CHAR, 3, USERS_TABLE, "shell"},
811  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
812  {V_CHAR, 5, USERS_TABLE, "first"},
813  {V_CHAR, 6, USERS_TABLE, "last"},
814  {V_CHAR, 7, USERS_TABLE, "middle"},
815  {V_NUM, 8},
816  {V_CHAR, 9, USERS_TABLE, "clearid"},
817  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
818  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
819  {V_NUM, 13},
820  {V_LEN, 14, USERS_TABLE, "winhomedir"},
821  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
822  {V_TYPE, 16, 0, "ace_type", 0, MR_ACE},
823  {V_TYPEDATA, 17, 0, 0, "list_id", MR_ACE},
824  {V_CHAR, 18, USERS_TABLE, "expiration"},
825};
826
827static struct valobj uuac_valobj[] = {
828  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
829  {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
830  {V_NUM, 2},
831  {V_CHAR, 3, USERS_TABLE, "shell"},
832  {V_CHAR, 4, USERS_TABLE, "winconsoleshell"},
833  {V_CHAR, 5, USERS_TABLE, "first"},
834  {V_CHAR, 6, USERS_TABLE, "last"},
835  {V_CHAR, 7, USERS_TABLE, "middle"},
836  {V_NUM, 8},
837  {V_CHAR, 9, USERS_TABLE, "clearid"},
838  {V_TYPE, 10, 0, "class", 0, MR_BAD_CLASS},
839  {V_ID, 11, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
840  {V_NUM, 13},
841  {V_LEN, 14, USERS_TABLE, "winhomedir"},
842  {V_LEN, 15, USERS_TABLE, "winprofiledir"},
843  {V_TYPE, 16, 0, "ace_type", 0, MR_ACE},
844  {V_TYPEDATA, 17, 0, 0, "list_id", MR_ACE},
845  {V_CHAR, 18, USERS_TABLE, "expiration"},
846  {V_CHAR, 19, USERS_TABLE, "alternate_email"},
847  {V_CHAR, 20, USERS_TABLE, "alternate_phone"},
848};
849
850static struct validate uuac2_validate = {
851  uuac2_valobj,
852  12,
853  0,
854  0,
855  0,
856  "users_id",
857  0,
858  setup_ausr,
859  set_modtime_by_id,
860};
861
862static struct validate uuac3_validate = {
863  uuac3_valobj,
864  13,
865  0,
866  0,
867  0,
868  "users_id",
869  0,
870  setup_ausr,
871  set_modtime_by_id,
872};
873
874static struct validate uuac11_validate = {
875  uuac11_valobj,
876  15,
877  0,
878  0,
879  0,
880  "users_id",
881  access_update_user,
882  setup_ausr,
883  set_modtime_by_id,
884};
885
886static struct validate uuac12_validate = {
887  uuac12_valobj,
888  18,
889  0,
890  0,
891  0,
892  "users_id",
893  access_update_user,
894  setup_ausr,
895  set_modtime_by_id,
896};
897
898static struct validate uuac_validate = {
899  uuac_valobj,
900  20,
901  0,
902  0,
903  0,
904  "users_id",
905  access_update_user,
906  setup_ausr,
907  set_modtime_by_id,
908};
909
910static struct validate uusr2_validate = {
911  uuac2_valobj,
912  10,
913  0,
914  0,
915  0,
916  "users_id",
917  0,
918  setup_ausr,
919  set_modtime_by_id,
920};
921
922static struct validate uusr3_validate = {
923  uuac3_valobj,
924  11,
925  0,
926  0,
927  0,
928  "users_id",
929  0,
930  setup_ausr,
931  set_modtime_by_id,
932};
933
934static struct validate uusr11_validate = {
935  uuac11_valobj,
936  13,
937  0,
938  0,
939  0,
940  "users_id",
941  0,
942  setup_ausr,
943  set_modtime_by_id,
944};
945
946static struct validate uusr12_validate = {
947  uuac12_valobj,
948  16,
949  0,
950  0,
951  0,
952  "users_id",
953  0,
954  setup_ausr,
955  set_modtime_by_id,
956};
957
958static struct validate uusr_validate = {
959  uuac_valobj,
960  18,
961  0,
962  0,
963  0,
964  "users_id",
965  0,
966  setup_ausr,
967  set_modtime_by_id,
968};
969
970static char *uush_fields[] = {
971  "login",
972  "shell",
973};
974
975static struct valobj uush_valobj[] = {
976  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
977  {V_CHAR, 1, USERS_TABLE, "shell"},
978};
979
980static struct validate uush_validate = {
981  uush_valobj,
982  2,
983  0,
984  0,
985  0,
986  "users_id",
987  access_user,
988  0,
989  set_finger_modtime,
990};
991
992static char *uuws_fields[] = {
993  "login",
994  "winconsoleshell",
995};
996
997static struct valobj uuws_valobj[] = {
998  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
999  {V_CHAR, 1, USERS_TABLE, "winconsoleshell"},
1000};
1001
1002static struct validate uuws_validate = {
1003  uuws_valobj,
1004  2,
1005  0,
1006  0,
1007  0,
1008  "users_id",
1009  access_user,
1010  0,
1011  set_finger_modtime,
1012};
1013
1014static char *uust_fields[] = {
1015  "login",
1016  "status",
1017};
1018
1019static char *uuss_fields[] = {
1020  "login",
1021  "secure",
1022};
1023
1024static struct valobj uust_valobj[] = {
1025  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
1026  {V_NUM, 1},
1027  {V_NUM, 2},
1028};
1029
1030static struct validate uust_validate = {
1031  uust_valobj,
1032  2,
1033  0,
1034  0,
1035  0,
1036  "users_id",
1037  0,
1038  0,
1039  set_modtime_by_id,
1040};
1041
1042static char *dusr_fields[] = {
1043  "login",
1044};
1045
1046static struct validate dusr_validate = {
1047  VOuser0,
1048  1,
1049  0,
1050  0,
1051  0,
1052  0,
1053  0,
1054  setup_dusr,
1055  0,
1056};
1057
1058static char *aurv_fields[] = {
1059  "login", "reservation",
1060};
1061
1062static struct validate aurv_validate = {
1063  VOuser0,
1064  1,
1065  0,
1066  0,
1067  0,
1068  "users_id",
1069  0,
1070  0,
1071  do_user_reservation,
1072};
1073
1074static char *gurv_fields[] = {
1075  "login",
1076  "reservation",
1077};
1078
1079static struct validate gurv_validate = {
1080  VOuser0,
1081  1,
1082  0,
1083  0,
1084  0,
1085  0,
1086  0,
1087  0,
1088  get_user_reservations,
1089};
1090
1091static char *gubr_fields[] = {
1092  "reservation",
1093  "login",
1094};
1095
1096static struct validate gubr_validate = {
1097  0,
1098  0,
1099  0,
1100  0,
1101  0,
1102  0,
1103  0,
1104  0,
1105  get_user_by_reservation,
1106};
1107
1108static char *gkum_fields[] = { "login", "kerberos",
1109                                   "login", "kerberos" };
1110
1111static char *akum_fields[] = { "login", "kerberos" };
1112
1113static struct valobj akum_valobj[] =
1114{
1115  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
1116  {V_ID, 1, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1117};
1118
1119static struct validate akum_validate =
1120{
1121  akum_valobj,
1122  2,
1123  "users_id",
1124  "users_id = %d or string_id = %d",
1125  2,
1126  "users_id",
1127  access_user,
1128  0,
1129  0,
1130};
1131
1132static struct validate dkum_validate =
1133{
1134  akum_valobj,
1135  2,
1136  "users_id",
1137  "users_id = %d and string_id = %d",
1138  2,
1139  "users_id",
1140  access_user,
1141  0,
1142  0,
1143};
1144
1145static char *gfbl_fields[] = {
1146  "login",
1147  "login", "fullname", "nickname", "home_addr",
1148  "home_phone", "office_addr", "office_phone", "department",
1149  "affiliation", "modtime", "modby", "modwith",
1150};
1151
1152static struct validate gfbl_validate = {
1153  VOuser0,
1154  1,
1155  0,
1156  0,
1157  0,
1158  0,
1159  access_user,
1160  0,
1161  followup_fix_modby,
1162};
1163
1164static char *ufbl_fields[] = {
1165  "login",
1166  "fullname", "nickname", "home_addr",
1167  "home_phone", "office_addr", "office_phone", "department",
1168  "affiliation",
1169};
1170
1171static struct valobj ufbl_valobj[] = {
1172  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
1173  {V_LEN, 1, USERS_TABLE, "fullname"},
1174  {V_LEN, 2, USERS_TABLE, "nickname"},
1175  {V_LEN, 3, USERS_TABLE, "home_addr"},
1176  {V_LEN, 4, USERS_TABLE, "home_phone"},
1177  {V_LEN, 5, USERS_TABLE, "office_addr"},
1178  {V_LEN, 6, USERS_TABLE, "office_phone"},
1179  {V_LEN, 7, USERS_TABLE, "department"},
1180  {V_LEN, 8, USERS_TABLE, "affiliation"},
1181};
1182
1183static struct validate ufbl_validate = {
1184  ufbl_valobj,
1185  9,
1186  0,
1187  0,
1188  0,
1189  0,
1190  access_user,
1191  0,
1192  set_finger_modtime,
1193};
1194
1195static char *gpob_fields[] = {
1196  "login",
1197  "login", "type", "box", "address", "modtime", "modby", "modwith",
1198};
1199
1200static struct validate gpob_validate = {
1201  VOuser0,
1202  1,
1203  "potype",
1204  "potype != 'NONE' and users_id = %d",
1205  1,
1206  0,
1207  access_user,
1208  0,
1209  followup_gpob,
1210};
1211
1212static char *gpox_fields[] = {
1213  "login", "type", "box",
1214};
1215
1216static struct validate gpox_validate = {
1217  0,
1218  0,
1219  0,
1220  0,
1221  0,
1222  0,
1223  0,
1224  0,
1225  followup_gpob,
1226};
1227
1228static char *spob_fields[] = {
1229  "login", "type", "box",
1230};
1231
1232static struct valobj spob_valobj[] = {
1233  {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
1234  {V_TYPE, 1, 0, "pobox", 0, MR_TYPE},
1235};
1236
1237static struct validate spob_validate =  /* SET_POBOX */
1238{
1239  spob_valobj,
1240  2,
1241  0,
1242  0,
1243  0,
1244  0,
1245  access_spob,
1246  0,
1247  set_pobox,
1248};
1249
1250static struct validate spop_validate =  /* SET_POBOX_POP */
1251{
1252  VOuser0,
1253  1,
1254  0,
1255  0,
1256  0,
1257  0,
1258  access_user,
1259  0,
1260  set_pobox_pop,
1261};
1262
1263static struct validate dpob_validate =  /* DELETE_POBOX */
1264{
1265  VOuser0,
1266  1,
1267  0,
1268  0,
1269  0,
1270  0,
1271  access_user,
1272  setup_dpob,
1273  set_pobox_modtime,
1274};
1275
1276static char *gmac_fields[] = {
1277  "name",
1278  "name", "type", "modtime", "modby", "modwith",
1279};
1280
1281static char *ghst2_fields[] = {
1282  "name", "address", "location", "network",
1283  "name", "vendor", "model", "os", "location", "contact", "use",
1284  "status", "status_change", "network", "address", "ace_type",
1285  "ace_name", "admin_comment", "ops_comment", "created", "creator",
1286  "inuse", "modtime", "modby", "modwith",
1287};
1288
1289static char *ghbh2_fields[] = {
1290  "hwaddr",
1291  "name", "vendor", "model", "os", "location", "contact", "use",
1292  "status", "status_change", "network", "address", "ace_type",
1293  "ace_name", "admin_comment", "ops_comment", "created", "creator",
1294  "inuse", "modtime", "modby", "modwith",
1295};
1296
1297static char *ghst6_fields[] = {
1298  "name", "address", "location", "network",
1299  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1300  "use", "status", "status_change", "network", "address", "ace_type",
1301  "ace_name", "admin_comment", "ops_comment", "created", "creator",
1302  "inuse", "modtime", "modby", "modwith",
1303};
1304
1305static char *ghbh6_fields[] = {
1306  "hwaddr",
1307  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1308  "use", "status", "status_change", "network", "address", "ace_type",
1309  "ace_name", "admin_comment", "ops_comment", "created", "creator",
1310  "inuse", "modtime", "modby", "modwith",
1311};
1312
1313static char *ghst_fields[] = {
1314  "name", "address", "location", "network",
1315  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1316  "account_number", "use", "status", "status_change", "network", "address",
1317  "ace_type", "ace_name", "admin_comment", "ops_comment", "created", "creator",
1318  "inuse", "modtime", "modby", "modwith",
1319};
1320
1321static char *ghbh_fields[] = {
1322  "hwaddr",
1323  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1324  "account_number", "use", "status", "status_change", "network", "address",
1325  "ace_type", "ace_name", "admin_comment", "ops_comment", "created", "creator",
1326  "inuse", "modtime", "modby", "modwith",
1327};
1328
1329static char *ghba_fields[] = {
1330  "account_number",
1331  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1332  "account_number", "use", "status", "status_change", "network", "address",
1333  "ace_type", "ace_name", "admin_comment", "ops_comment", "created", "creator",
1334  "inuse", "modtime", "modby", "modwith",
1335};
1336
1337static struct validate ghst_validate = {
1338  0,
1339  0,
1340  0,
1341  0,
1342  0,
1343  0,
1344  0,
1345  setup_ghst,
1346  followup_ghst,
1347};
1348
1349static char *ghha_fields[] = {
1350  "name",
1351  "hwaddr",
1352};
1353
1354static char *ahst2_fields[] = {
1355  "name", "vendor", "model", "os", "location", "contact", "use",
1356  "status", "subnet", "address", "ace_type", "ace_name",
1357  "admin_comment", "ops_comment",
1358};
1359
1360static struct valobj ahst2_valobj[] = {
1361  {V_CHAR, 0, MACHINE_TABLE, "name"},
1362  {V_CHAR, 1, MACHINE_TABLE, "vendor"},
1363  {V_CHAR, 2, MACHINE_TABLE, "model"},
1364  {V_CHAR, 3, MACHINE_TABLE, "os"},
1365  {V_CHAR, 4, MACHINE_TABLE, "location"},
1366  {V_CHAR, 5, MACHINE_TABLE, "contact"},
1367  {V_NUM, 6},
1368  {V_NUM, 7},
1369  {V_ID, 8, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1370  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
1371  {V_TYPEDATA, 11, 0, 0, 0, MR_ACE},
1372  {V_ID, 12, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1373  {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1374};
1375
1376static struct validate ahst2_validate = {
1377  ahst2_valobj,
1378  13,
1379  "name",
1380  "name = UPPER('%s')",
1381  1,
1382  "mach_id",
1383  access_host,
1384  setup_ahst,
1385  set_uppercase_modtime,
1386};
1387
1388static char *ahst6_fields[] = {
1389  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1390  "use", "status", "subnet", "address", "ace_type", "ace_name",
1391  "admin_comment", "ops_comment",
1392};
1393
1394static struct valobj ahst6_valobj[] = {
1395  {V_CHAR, 0, MACHINE_TABLE, "name"},
1396  {V_CHAR, 1, MACHINE_TABLE, "vendor"},
1397  {V_CHAR, 2, MACHINE_TABLE, "model"},
1398  {V_CHAR, 3, MACHINE_TABLE, "os"},
1399  {V_CHAR, 4, MACHINE_TABLE, "location"},
1400  {V_CHAR, 5, MACHINE_TABLE, "contact"},
1401  {V_CHAR, 6, MACHINE_TABLE, "billing_contact"},
1402  {V_NUM, 7},
1403  {V_NUM, 8},
1404  {V_ID, 9, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1405  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
1406  {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
1407  {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1408  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1409};
1410
1411static struct validate ahst6_validate = {
1412  ahst6_valobj,
1413  14,
1414  "name",
1415  "name = UPPER('%s')",
1416  1,
1417  "mach_id",
1418  access_host,
1419  setup_ahst,
1420  set_uppercase_modtime,
1421};
1422
1423static char *ahst_fields[] = {
1424  "name", "vendor", "model", "os", "location", "contact", "billing_contact",
1425  "account_number", "use", "status", "subnet", "address", "ace_type",
1426  "ace_name", "admin_comment", "ops_comment",
1427};
1428
1429static struct valobj ahst_valobj[] = {
1430  {V_CHAR, 0, MACHINE_TABLE, "name"},
1431  {V_CHAR, 1, MACHINE_TABLE, "vendor"},
1432  {V_CHAR, 2, MACHINE_TABLE, "model"},
1433  {V_CHAR, 3, MACHINE_TABLE, "os"},
1434  {V_CHAR, 4, MACHINE_TABLE, "location"},
1435  {V_CHAR, 5, MACHINE_TABLE, "contact"},
1436  {V_CHAR, 6, MACHINE_TABLE, "billing_contact"},
1437  {V_CHAR, 7, MACHINE_TABLE, "account_number"},
1438  {V_NUM, 8},
1439  {V_NUM, 9},
1440  {V_ID, 10, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1441  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
1442  {V_TYPEDATA, 13, 0, 0, 0, MR_ACE},
1443  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1444  {V_ID, 15, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1445};
1446
1447static struct validate ahst_validate = {
1448  ahst_valobj,
1449  15,
1450  "name",
1451  "name = UPPER('%s')",
1452  1,
1453  "mach_id",
1454  access_host,
1455  setup_ahst,
1456  set_uppercase_modtime,
1457};
1458
1459static char *uhst2_fields[] = {
1460  "name",
1461  "newname", "vendor", "model", "os", "location", "contact", "use",
1462  "status", "subnet", "address", "ace_type", "ace_name",
1463  "admin_comment", "ops_comment",
1464};
1465
1466static struct valobj uhst2_valobj[] = {
1467  {V_CHAR, 0, MACHINE_TABLE, "name"},
1468  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1469  {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
1470  {V_CHAR, 2, MACHINE_TABLE, "vendor"},
1471  {V_CHAR, 3, MACHINE_TABLE, "model"},
1472  {V_CHAR, 4, MACHINE_TABLE, "os"},
1473  {V_CHAR, 5, MACHINE_TABLE, "location"},
1474  {V_CHAR, 6, MACHINE_TABLE, "contact"},
1475  {V_NUM, 7},
1476  {V_NUM, 8},
1477  {V_ID, 9, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1478  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
1479  {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
1480  {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1481  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1482};
1483
1484static struct validate uhst2_validate = {
1485  uhst2_valobj,
1486  15,
1487  0,
1488  0,
1489  0,
1490  "mach_id",
1491  access_host,
1492  setup_ahst,
1493  set_modtime_by_id,
1494};
1495
1496static char *uhst6_fields[] = {
1497  "name",
1498  "newname", "vendor", "model", "os", "location", "contact", "billing_contact",
1499  "use", "status", "subnet", "address", "ace_type", "ace_name",
1500  "admin_comment", "ops_comment",
1501};
1502
1503static struct valobj uhst6_valobj[] = {
1504  {V_CHAR, 0, MACHINE_TABLE, "name"},
1505  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1506  {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
1507  {V_CHAR, 2, MACHINE_TABLE, "vendor"},
1508  {V_CHAR, 3, MACHINE_TABLE, "model"},
1509  {V_CHAR, 4, MACHINE_TABLE, "os"},
1510  {V_CHAR, 5, MACHINE_TABLE, "location"},
1511  {V_CHAR, 6, MACHINE_TABLE, "contact"},
1512  {V_CHAR, 7, MACHINE_TABLE, "billing_contact"},
1513  {V_NUM, 8},
1514  {V_NUM, 9},
1515  {V_ID, 10, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1516  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
1517  {V_TYPEDATA, 13, 0, 0, 0, MR_ACE},
1518  {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1519  {V_ID, 15, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1520};
1521
1522static struct validate uhst6_validate = {
1523  uhst6_valobj,
1524  16,
1525  0,
1526  0,
1527  0,
1528  "mach_id",
1529  access_host,
1530  setup_ahst,
1531  set_modtime_by_id,
1532};
1533
1534static char *uhst_fields[] = {
1535  "name",
1536  "newname", "vendor", "model", "os", "location", "contact", "billing_contact",
1537  "account_number", "use", "status", "subnet", "address", "ace_type",
1538  "ace_name", "admin_comment", "ops_comment",
1539};
1540
1541static struct valobj uhst_valobj[] = {
1542  {V_CHAR, 0, MACHINE_TABLE, "name"},
1543  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1544  {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
1545  {V_CHAR, 2, MACHINE_TABLE, "vendor"},
1546  {V_CHAR, 3, MACHINE_TABLE, "model"},
1547  {V_CHAR, 4, MACHINE_TABLE, "os"},
1548  {V_CHAR, 5, MACHINE_TABLE, "location"},
1549  {V_CHAR, 6, MACHINE_TABLE, "contact"},
1550  {V_CHAR, 7, MACHINE_TABLE, "billing_contact"},
1551  {V_CHAR, 8, MACHINE_TABLE, "account_number"},
1552  {V_NUM, 9},
1553  {V_NUM, 10},
1554  {V_ID, 11, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
1555  {V_TYPE, 13, 0, "ace_type", 0, MR_ACE},
1556  {V_TYPEDATA, 14, 0, 0, 0, MR_ACE},
1557  {V_ID, 15, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1558  {V_ID, 16, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
1559};
1560
1561static struct validate uhst_validate = {
1562  uhst_valobj,
1563  17,
1564  0,
1565  0,
1566  0,
1567  "mach_id",
1568  access_host,
1569  setup_ahst,
1570  set_modtime_by_id,
1571};
1572
1573static char *uhha_fields[] = {
1574  "name",
1575  "hwaddr"
1576};
1577
1578static struct valobj uhha_valobj[] = {
1579  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1580  {V_CHAR, 1, MACHINE_TABLE, "hwaddr"},
1581};
1582
1583static struct validate uhha_validate = {
1584  uhha_valobj,
1585  2,
1586  0,
1587  0,
1588  0,
1589  "mach_id",
1590  0,
1591  setup_uhha,
1592  set_modtime_by_id,
1593};
1594
1595static char *dhst_fields[] = {
1596  "name",
1597};
1598
1599static struct validate dhst_validate = {
1600  VOmach0,
1601  1,
1602  0,
1603  0,
1604  0,
1605  0,
1606  0,
1607  setup_dmac,
1608  0,
1609};
1610
1611static char *ghal_fields[] = {
1612  "alias", "canonical_hostname",
1613  "alias", "canonical_hostname"
1614};
1615
1616static struct validate ghal_validate = {
1617  0,
1618  0,
1619  0,
1620  0,
1621  0,
1622  0,
1623  access_ahal,
1624  0,
1625  0,
1626};
1627
1628static struct valobj ahal_valobj[] = {
1629  {V_CHAR, 0, HOSTALIAS_TABLE, "name"},
1630  {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1631};
1632
1633static struct validate ahal_validate = {
1634  ahal_valobj,
1635  2,
1636  "name",
1637  "name = UPPER('%s')",
1638  1,
1639  "mach_id",
1640  access_ahal,
1641  setup_ahal,
1642  0,
1643};
1644
1645static struct valobj dhal_valobj[] = {
1646  {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1647};
1648
1649static struct validate dhal_validate = {
1650  dhal_valobj,
1651  1,
1652  "name",
1653  "name = UPPER('%s') AND mach_id = %d",
1654  2,
1655  "mach_id",
1656  access_ahal,
1657  0,
1658  0,
1659};
1660
1661static char *gsnt2_fields[] = {
1662  "name",
1663  "name", "description", "address", "mask", "low", "high", "prefix",
1664  "ace_type", "ace_name", "modtime", "modby", "modwith"
1665};
1666
1667static char *gsnt_fields[] = {
1668  "name",
1669  "name", "description", "status", "contact", "account_number", "address",
1670  "mask", "low", "high", "prefix", "ace_type", "ace_name", "modtime",
1671  "modby", "modwith"
1672};
1673
1674static struct validate gsnt_validate = {
1675  0,
1676  0,
1677  0,
1678  0,
1679  0,
1680  0,
1681  access_snt,
1682  0,
1683  followup_gsnt,
1684};
1685
1686static char *asnt2_fields[] = {
1687  "name", "description", "address", "mask", "low", "high", "prefix",
1688  "ace_type", "ace_name",
1689};
1690
1691static struct valobj asnt2_valobj[] = {
1692  {V_CHAR, 0, SUBNET_TABLE, "name"},
1693  {V_LEN, 1, SUBNET_TABLE, "description"},
1694  {V_NUM, 2},
1695  {V_NUM, 3},
1696  {V_NUM, 4},
1697  {V_NUM, 5},
1698  {V_LEN, 6, SUBNET_TABLE, "prefix"},
1699  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
1700  {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
1701};
1702
1703static struct validate asnt2_validate =
1704{
1705  asnt2_valobj,
1706  9,
1707  "name",
1708  "name = UPPER('%s')",
1709  1,
1710  "snet_id",
1711  0,
1712  prefetch_value,
1713  set_uppercase_modtime,
1714};
1715
1716static char *asnt_fields[] = {
1717  "name", "description", "status", "contact", "account_number", "address",
1718  "mask", "low", "high", "prefix", "ace_type", "ace_name",
1719};
1720
1721static struct valobj asnt_valobj[] = {
1722  {V_CHAR, 0, SUBNET_TABLE, "name"},
1723  {V_LEN, 1, SUBNET_TABLE, "description"},
1724  {V_NUM, 2},
1725  {V_CHAR, 3, SUBNET_TABLE, "contact"},
1726  {V_CHAR, 4, SUBNET_TABLE, "account_number"},
1727  {V_NUM, 5},
1728  {V_NUM, 6},
1729  {V_NUM, 7},
1730  {V_NUM, 8},
1731  {V_LEN, 9, SUBNET_TABLE, "prefix"},
1732  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
1733  {V_TYPEDATA, 11, 0, 0, 0, MR_ACE},
1734};
1735
1736static struct validate asnt_validate =
1737{
1738  asnt_valobj,
1739  12,
1740  "name",
1741  "name = UPPER('%s')",
1742  1,
1743  "snet_id",
1744  0,
1745  setup_asnt,
1746  set_uppercase_modtime,
1747};
1748
1749static char *usnt2_fields[] = {
1750  "name",
1751  "newname", "description", "address", "mask", "low", "high", "prefix",
1752  "ace_type", "ace_name",
1753};
1754
1755static struct valobj usnt2_valobj[] = {
1756  {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_NO_MATCH},
1757  {V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
1758  {V_LEN, 2, SUBNET_TABLE, "description"},
1759  {V_NUM, 3},
1760  {V_NUM, 4},
1761  {V_NUM, 5},
1762  {V_NUM, 6},
1763  {V_LEN, 7, SUBNET_TABLE, "prefix"},
1764  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
1765  {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
1766};
1767
1768static struct validate usnt2_validate =
1769{
1770  usnt2_valobj,
1771  10,
1772  "name",
1773  "snet_id = %d",
1774  1,
1775  "snet_id",
1776  0,
1777  0,
1778  set_modtime_by_id,
1779};
1780
1781static char *usnt_fields[] = {
1782  "name",
1783  "newname", "description", "status", "contact", "account_number", "address",
1784  "mask", "low", "high", "prefix", "ace_type", "ace_name",
1785};
1786
1787static struct valobj usnt_valobj[] = {
1788  {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_NO_MATCH},
1789  {V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
1790  {V_LEN, 2, SUBNET_TABLE, "description"},
1791  {V_NUM, 3},
1792  {V_CHAR, 4, SUBNET_TABLE, "contact"},
1793  {V_CHAR, 5, SUBNET_TABLE, "account_number"},
1794  {V_NUM, 6},
1795  {V_NUM, 7},
1796  {V_NUM, 8},
1797  {V_NUM, 9},
1798  {V_LEN, 10, SUBNET_TABLE, "prefix"},
1799  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
1800  {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
1801};
1802
1803static struct validate usnt_validate =
1804{
1805  usnt_valobj,
1806  13,
1807  "name",
1808  "snet_id = %d",
1809  1,
1810  "snet_id",
1811  0,
1812  setup_asnt,
1813  set_modtime_by_id,
1814};
1815
1816static char *dsnt_fields[] = {
1817  "name",
1818};
1819
1820static struct validate dsnt_validate = {
1821  VOsnet0,
1822  1,
1823  0,
1824  0,
1825  0,
1826  0,
1827  0,
1828  setup_dsnt,
1829  0,
1830};
1831
1832static char *gclu_fields[] = {
1833  "name",
1834  "name", "description", "location", "modtime", "modby", "modwith",
1835};
1836
1837static char *aclu_fields[] = {
1838  "name", "description", "location",
1839};
1840
1841static struct valobj aclu_valobj[] = {
1842  {V_CHAR, 0, CLUSTERS_TABLE, "name"},
1843  {V_LEN, 1, CLUSTERS_TABLE, "description"},
1844  {V_LEN, 2, CLUSTERS_TABLE, "location"},
1845};
1846
1847static struct validate aclu_validate =
1848{
1849  aclu_valobj,
1850  3,
1851  "name",
1852  "name = '%s'",
1853  1,
1854  "clu_id",
1855  0,
1856  prefetch_value,
1857  set_modtime,
1858};
1859
1860static char *uclu_fields[] = {
1861  "name",
1862  "newname", "description", "location",
1863};
1864
1865static struct valobj uclu_valobj[] = {
1866  {V_ID, 0, CLUSTERS_TABLE, "name", "clu_id", MR_CLUSTER},
1867  {V_RENAME, 1, CLUSTERS_TABLE, "name", "clu_id", MR_NOT_UNIQUE},
1868  {V_LEN, 2, CLUSTERS_TABLE, "description"},
1869  {V_LEN, 3, CLUSTERS_TABLE, "location"},
1870};
1871
1872static struct validate uclu_validate = {
1873  uclu_valobj,
1874  4,
1875  0,
1876  0,
1877  0,
1878  "clu_id",
1879  0,
1880  0,
1881  set_modtime_by_id,
1882};
1883
1884static char *dclu_fields[] = {
1885  "name",
1886};
1887
1888static struct validate dclu_validate = {
1889  VOclu0,
1890  1,
1891  0,
1892  0,
1893  0,
1894  0,
1895  0,
1896  setup_dclu,
1897  0,
1898};
1899
1900static char *gmcm_fields[] = {
1901  "machine", "cluster",
1902  "machine", "cluster",
1903};
1904
1905static struct valobj amtc_valobj[] =    /* ADD_MACHINE_TO_CLUSTER */
1906{                                       /* DELETE_MACHINE_FROM_CLUSTER */
1907  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1908  {V_ID, 1, CLUSTERS_TABLE, "name", "clu_id", MR_CLUSTER},
1909};
1910
1911static struct validate amtc_validate = /* for amtc and dmfc */
1912{
1913  amtc_valobj,
1914  2,
1915  "mach_id",
1916  "mach_id = %d and clu_id = %d",
1917  2,
1918  0,
1919  0,
1920  0,
1921  set_mach_modtime_by_id,
1922};
1923
1924static char *gcld_fields[] = {
1925  "cluster", "serv_label",
1926  "cluster", "serv_label", "serv_cluster",
1927};
1928
1929static char *acld_fields[] = {
1930  "cluster", "serv_label", "serv_cluster",
1931};
1932
1933static struct valobj acld_valobj[] =
1934{
1935  {V_ID, 0, CLUSTERS_TABLE, "name", "clu_id", MR_CLUSTER},
1936  {V_CHAR, 1, SVC_TABLE, "serv_label"},
1937  {V_CHAR, 2, SVC_TABLE, "serv_cluster"}
1938};
1939
1940static struct validate acld_validate =
1941{
1942  acld_valobj,
1943  3,
1944  "clu_id",
1945  "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
1946  3,
1947  0,
1948  0,
1949  0,
1950  set_cluster_modtime_by_id,
1951};
1952
1953static struct validate dcld_validate =
1954{
1955  VOclu0,
1956  1,
1957  "clu_id",
1958  "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
1959  3,
1960  0,
1961  0,
1962  0,
1963  set_cluster_modtime_by_id,
1964};
1965
1966static char *glin2_fields[] = {
1967  "name",
1968  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1969  "ace_type", "ace_name", "description", "modtime", "modby", "modwith",
1970};
1971
1972static char *glin3_fields[] = {
1973  "name",
1974  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1975  "nfsgroup", "ace_type", "ace_name", "description", "modtime", "modby",
1976  "modwith",
1977};
1978
1979static char *glin4_fields[] = {
1980  "name",
1981  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1982  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
1983  "description", "modtime", "modby", "modwith",
1984};
1985
1986static char *glin_fields[] = {
1987  "name",
1988  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1989  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name",
1990  "memace_type", "memace_name", "description", "modtime", "modby", "modwith",
1991};
1992
1993static struct validate glin_validate = {
1994  0,
1995  0,
1996  0,
1997  0,
1998  0,
1999  0,
2000  access_vis_list_by_name,
2001  0,
2002  followup_glin,
2003};
2004
2005static char *alis2_fields[] = {
2006  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2007  "ace_type", "ace_name", "description",
2008};
2009
2010static struct valobj alis2_valobj[] = {
2011  {V_CHAR, 0, LIST_TABLE, "name"},
2012  {V_NUM, 1},
2013  {V_NUM, 2},
2014  {V_NUM, 3},
2015  {V_NUM, 4},
2016  {V_NUM, 5},
2017  {V_NUM, 6},
2018  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
2019  {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
2020  {V_LEN, 9, LIST_TABLE, "description"},
2021};
2022
2023static struct validate alis2_validate = {
2024  alis2_valobj,
2025  10,
2026  "name",
2027  "name = '%s'",
2028  1,
2029  "list_id",
2030  0,
2031  setup_alis,
2032  set_modtime,
2033};
2034
2035static char *alis3_fields[] = {
2036  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2037  "nfsgroup", "ace_type", "ace_name", "description",
2038};
2039
2040static struct valobj alis3_valobj[] = {
2041  {V_CHAR, 0, LIST_TABLE, "name"},
2042  {V_NUM, 1},
2043  {V_NUM, 2},
2044  {V_NUM, 3},
2045  {V_NUM, 4},
2046  {V_NUM, 5},
2047  {V_NUM, 6},
2048  {V_NUM, 7},
2049  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
2050  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
2051  {V_LEN, 10, LIST_TABLE, "description"},
2052};
2053
2054static struct validate alis3_validate = {
2055  alis3_valobj,
2056  11,
2057  "name",
2058  "name = '%s'",
2059  1,
2060  "list_id",
2061  0,
2062  setup_alis,
2063  set_modtime,
2064};
2065
2066static char *alis4_fields[] = {
2067  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2068  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
2069  "description",
2070};
2071
2072static struct valobj alis4_valobj[] = {
2073  {V_CHAR, 0, LIST_TABLE, "name"},
2074  {V_NUM, 1},
2075  {V_NUM, 2},
2076  {V_NUM, 3},
2077  {V_NUM, 4},
2078  {V_NUM, 5},
2079  {V_NUM, 6},
2080  {V_NUM, 7},
2081  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
2082  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
2083  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
2084  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
2085  {V_LEN, 12, LIST_TABLE, "description"},
2086};
2087
2088static struct validate alis4_validate = {
2089  alis4_valobj,
2090  13,
2091  "name",
2092  "name = '%s'",
2093  1,
2094  "list_id",
2095  0,
2096  setup_alis,
2097  set_modtime,
2098};
2099
2100static char *alis_fields[] = {
2101  "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2102  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name",
2103  "memace_type", "memace_name", "description",
2104};
2105
2106static struct valobj alis_valobj[] = {
2107  {V_CHAR, 0, LIST_TABLE, "name"},
2108  {V_NUM, 1},
2109  {V_NUM, 2},
2110  {V_NUM, 3},
2111  {V_NUM, 4},
2112  {V_NUM, 5},
2113  {V_NUM, 6},
2114  {V_NUM, 7},
2115  {V_NUM, 8},
2116  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2117  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
2118  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
2119  {V_TYPE, 12, 0, "ace_type", 0, MR_ACE},
2120  {V_TYPEDATA, 13, 0, 0, "list_id", MR_ACE},
2121  {V_LEN, 14, LIST_TABLE, "description"},
2122};
2123
2124static struct validate alis_validate = {
2125  alis_valobj,
2126  15,
2127  "name",
2128  "name = '%s'",
2129  1,
2130  "list_id",
2131  0,
2132  setup_alis,
2133  set_modtime,
2134};
2135
2136static char *ulis2_fields[] = {
2137  "name",
2138  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2139  "ace_type", "ace_name", "description",
2140};
2141
2142static struct valobj ulis2_valobj[] = {
2143  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
2144  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
2145  {V_NUM, 2},
2146  {V_NUM, 3},
2147  {V_NUM, 4},
2148  {V_NUM, 5},
2149  {V_NUM, 6},
2150  {V_NUM, 7},
2151  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
2152  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
2153  {V_LEN, 10, LIST_TABLE, "description"},
2154};
2155
2156static struct validate ulis2_validate = {
2157  ulis2_valobj,
2158  11,
2159  "name",
2160  "list_id = %d",
2161  1,
2162  "list_id",
2163  access_list,
2164  setup_alis,
2165  set_modtime_by_id,
2166};
2167
2168static char *ulis3_fields[] = {
2169  "name",
2170  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2171  "nfsgroup", "ace_type", "ace_name", "description",
2172};
2173
2174static struct valobj ulis3_valobj[] = {
2175  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
2176  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
2177  {V_NUM, 2},
2178  {V_NUM, 3},
2179  {V_NUM, 4},
2180  {V_NUM, 5},
2181  {V_NUM, 6},
2182  {V_NUM, 7},
2183  {V_NUM, 8},
2184  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
2185  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
2186  {V_LEN, 11, LIST_TABLE, "description"},
2187};
2188
2189static struct validate ulis3_validate = {
2190  ulis3_valobj,
2191  12,
2192  "name",
2193  "list_id = %d",
2194  1,
2195  "list_id",
2196  access_list,
2197  setup_alis,
2198  set_modtime_by_id,
2199};
2200
2201static char *ulis4_fields[] = {
2202  "name",
2203  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2204  "nfsgroup", "ace_type", "ace_name", "memace_type", "memace_name",
2205  "description",
2206};
2207
2208static struct valobj ulis4_valobj[] = {
2209  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
2210  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
2211  {V_NUM, 2},
2212  {V_NUM, 3},
2213  {V_NUM, 4},
2214  {V_NUM, 5},
2215  {V_NUM, 6},
2216  {V_NUM, 7},
2217  {V_NUM, 8},
2218  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
2219  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
2220  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
2221  {V_TYPEDATA, 12, 0, 0, "list_id", MR_ACE},
2222  {V_LEN, 13, LIST_TABLE, "description"},
2223};
2224
2225static struct validate ulis4_validate = {
2226  ulis4_valobj,
2227  14,
2228  "name",
2229  "list_id = %d",
2230  1,
2231  "list_id",
2232  access_list,
2233  setup_alis,
2234  set_modtime_by_id,
2235};
2236
2237static char *ulis_fields[] = {
2238  "name",
2239  "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
2240  "nfsgroup", "mailman", "mailman_server", "ace_type", "ace_name",
2241  "memace_type", "memace_name", "description",
2242};
2243
2244static struct valobj ulis_valobj[] = {
2245  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
2246  {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
2247  {V_NUM, 2},
2248  {V_NUM, 3},
2249  {V_NUM, 4},
2250  {V_NUM, 5},
2251  {V_NUM, 6},
2252  {V_NUM, 7},
2253  {V_NUM, 8},
2254  {V_NUM, 9},
2255  {V_ID, 10, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2256  {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
2257  {V_TYPEDATA, 12, 0, 0, "list_id", MR_ACE},
2258  {V_TYPE, 13, 0, "ace_type", 0, MR_ACE},
2259  {V_TYPEDATA, 14, 0, 0, "list_id", MR_ACE},
2260  {V_LEN, 15, LIST_TABLE, "description"},
2261};
2262
2263static struct validate ulis_validate = {
2264  ulis_valobj,
2265  16,
2266  "name",
2267  "list_id = %d",
2268  1,
2269  "list_id",
2270  access_list,
2271  setup_alis,
2272  set_modtime_by_id,
2273};
2274
2275static char *dlis_fields[] = {
2276  "name",
2277};
2278
2279static struct validate dlis_validate = {
2280  VOlist0,
2281  1,
2282  "name",
2283  "list_id = %d",
2284  1,
2285  0,
2286  access_list,
2287  setup_dlis,
2288  0,
2289};
2290
2291static char *amtl_fields[] = {
2292  "list_name", "member_type", "member_name",
2293};
2294
2295static char *atml_fields[] = {
2296  "list_name", "member_type", "member_name", "tag",
2297};
2298
2299static struct valobj amtl_valobj[] = {
2300  {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
2301  {V_TYPE, 1, 0, "member", 0, MR_TYPE},
2302  {V_TYPEDATA, 2, 0, 0, 0, MR_NO_MATCH},
2303  {V_ID, 3, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
2304};
2305
2306static struct validate amtl_validate =
2307{
2308  amtl_valobj,
2309  3,
2310  0,
2311  0,
2312  0,
2313  0,
2314  access_list,
2315  0,
2316  add_member_to_list,
2317};
2318
2319static struct validate atml_validate =
2320{
2321  amtl_valobj,
2322  4,
2323  0,
2324  0,
2325  0,
2326  0,
2327  access_list,
2328  0,
2329  add_member_to_list,
2330};
2331
2332static struct validate tmol_validate =
2333{
2334  amtl_valobj,
2335  4,
2336  0,
2337  0,
2338  0,
2339  0,
2340  access_list,
2341  0,
2342  tag_member_of_list,
2343};
2344
2345static struct validate dmfl_validate =
2346{
2347  amtl_valobj,
2348  3,
2349  0,
2350  0,
2351  0,
2352  0,
2353  access_list,
2354  0,
2355  delete_member_from_list,
2356};
2357
2358static char *gaus_fields[] = {
2359  "ace_type", "ace_name",
2360  "use_type", "use_name",
2361};
2362
2363static struct valobj gaus_valobj[] = {
2364  {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
2365  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
2366};
2367
2368static struct validate gaus_validate = {
2369  gaus_valobj,
2370  2,
2371  0,
2372  0,
2373  0,
2374  0,
2375  access_member,
2376  0,
2377  get_ace_use,
2378};
2379
2380static char *ghbo_fields[] = {
2381  "ace_type", "ace_name",
2382  "name",
2383};
2384
2385static struct valobj ghbo_valobj[] = {
2386  {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
2387  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
2388};
2389
2390static struct validate ghbo_validate = {
2391  ghbo_valobj,
2392  2,
2393  0,
2394  0,
2395  0,
2396  0,
2397  access_member,
2398  0,
2399  get_host_by_owner,
2400};
2401
2402static char *qgli_fields[] = {
2403  "active", "publicflg", "hidden", "maillist", "grouplist",
2404  "list",
2405};
2406
2407static struct valobj qgli_valobj[] = {
2408  {V_TYPE, 0, 0, "boolean", 0, MR_TYPE},
2409  {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
2410  {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
2411  {V_TYPE, 3, 0, "boolean", 0, MR_TYPE},
2412  {V_TYPE, 4, 0, "boolean", 0, MR_TYPE},
2413};
2414
2415static struct validate qgli_validate = {
2416  qgli_valobj,
2417  5,
2418  0,
2419  0,
2420  0,
2421  0,
2422  access_qgli,
2423  0,
2424  qualified_get_lists,
2425};
2426
2427static char *gmol_fields[] = {
2428  "list_name",
2429  "member_type", "member_name",
2430};
2431
2432static char *gtml_fields[] = {
2433  "list_name",
2434  "member_type", "member_name", "tag",
2435};
2436
2437static struct validate gmol_validate = {
2438  VOlist0,
2439  1,
2440  0,
2441  0,
2442  0,
2443  0,
2444  access_visible_list,
2445  0,
2446  get_members_of_list,
2447};
2448
2449static char *glom_fields[] = {
2450  "member_type", "member_name",
2451  "list_name", "active", "publicflg", "hidden", "maillist", "grouplist",
2452};
2453
2454static struct valobj glom_valobj[] = {
2455  {V_TYPE, 0, 0, "rmember", 0, MR_TYPE},
2456  {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
2457};
2458
2459static struct validate glom_validate = {
2460  glom_valobj,
2461  2,
2462  0,
2463  0,
2464  0,
2465  0,
2466  access_member,
2467  0,
2468  get_lists_of_member,
2469};
2470
2471static char *cmol_fields[] = {
2472  "list_name",
2473  "count",
2474};
2475
2476static struct validate cmol_validate = {
2477  VOlist0,
2478  1,
2479  0,
2480  0,
2481  0,
2482  0,
2483  access_visible_list,
2484  0,
2485  count_members_of_list,
2486};
2487
2488static char *gsin_fields[] = {
2489  "service",
2490  "service", "update_int", "target_file", "script", "dfgen", "dfcheck",
2491  "type", "enable", "inprogress", "harderror", "errmsg",
2492  "ace_type", "ace_name", "modtime", "modby", "modwith",
2493};
2494
2495static struct validate gsin_validate =
2496{
2497  0,
2498  0,
2499  0,
2500  0,
2501  0,
2502  0,
2503  access_service,
2504  0,
2505  followup_gsin,
2506};
2507
2508static char *qgsv_fields[] = {
2509  "enable", "inprogress", "harderror",
2510  "service",
2511};
2512
2513static struct valobj qgsv_valobj[] = {
2514  {V_TYPE, 0, 0, "boolean", 0, MR_TYPE},
2515  {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
2516  {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
2517};
2518
2519static struct validate qgsv_validate = {
2520  qgsv_valobj,
2521  3,
2522  0,
2523  0,
2524  0,
2525  0,
2526  0,
2527  0,
2528  qualified_get_server,
2529};
2530
2531static char *asin_fields[] = {
2532  "service", "update_int", "target_file", "script", "type", "enable",
2533  "ace_type", "ace_name",
2534};
2535
2536static struct valobj asin_valobj[] = {
2537  {V_CHAR, 0, SERVERS_TABLE, "name"},
2538  {V_NUM, 1},
2539  {V_LEN, 2, SERVERS_TABLE, "target_file"},
2540  {V_LEN, 3, SERVERS_TABLE, "script"},
2541  {V_TYPE, 4, 0, "service", 0, MR_TYPE},
2542  {V_NUM, 5},
2543  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
2544  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
2545};
2546
2547static struct validate asin_validate =  /* for asin, usin */
2548{
2549  asin_valobj,
2550  8,
2551  "name",
2552  "name = UPPER('%s')",
2553  1,
2554  0,
2555  0,
2556  0,
2557  set_uppercase_modtime,
2558};
2559
2560static struct validate rsve_validate = {
2561  asin_valobj,
2562  1,
2563  "name",
2564  "name = UPPER('%s')",
2565  1,
2566  0,
2567  access_service,
2568  0,
2569  set_uppercase_modtime,
2570};
2571
2572static char *ssif_fields[] = {
2573  "service", "dfgen", "dfcheck", "inprogress", "harderror", "errmsg",
2574};
2575
2576static struct valobj ssif_valobj[] = {
2577  {V_NAME, 0, SERVERS_TABLE, "name", 0, MR_SERVICE},
2578  {V_NUM, 1},
2579  {V_NUM, 2},
2580  {V_NUM, 3},
2581  {V_NUM, 4},
2582  {V_LEN, 5, SERVERS_TABLE, "errmsg"},
2583};
2584
2585static struct validate ssif_validate = {
2586  ssif_valobj,
2587  6,
2588  "name",
2589  "name = UPPER('%s')",
2590  1,
2591  0,
2592  0,
2593  0,
2594  0,
2595};
2596
2597static char *dsin_fields[] = {
2598  "service",
2599};
2600
2601static struct validate dsin_validate = {
2602  asin_valobj,
2603  1,
2604  "name",
2605  "name = UPPER('%s')",
2606  1,
2607  0,
2608  0,
2609  setup_dsin,
2610  0,
2611};
2612
2613static char *gshi_fields[] = {
2614  "service", "machine",
2615  "service", "machine", "enable", "override", "success", "inprogress",
2616  "hosterror", "hosterrormsg", "ltt", "lts", "value1", "value2",
2617  "value3", "modtime", "modby", "modwith",
2618};
2619
2620static struct validate gshi_validate = {
2621  0,
2622  0,
2623  0,
2624  0,
2625  0,
2626  0,
2627  access_service,
2628  0,
2629  followup_fix_modby,
2630};
2631
2632static char *qgsh_fields[] = {
2633  "service", "enable", "override", "success", "inprogress", "hosterror",
2634  "service", "machine",
2635};
2636
2637static struct valobj qgsh_valobj[] = {
2638  {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
2639  {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
2640  {V_TYPE, 3, 0, "boolean", 0, MR_TYPE},
2641  {V_TYPE, 4, 0, "boolean", 0, MR_TYPE},
2642  {V_TYPE, 5, 0, "boolean", 0, MR_TYPE},
2643};
2644
2645static struct validate qgsh_validate = {
2646  qgsh_valobj,
2647  5,
2648  0,
2649  0,
2650  0,
2651  0,
2652  0,
2653  0,
2654  qualified_get_serverhost,
2655};
2656
2657static char *ashi_fields[] = {
2658  "service", "machine", "enable", "value1", "value2", "value3",
2659};
2660
2661static struct valobj ashi_valobj[] = {
2662  {V_NAME, 0, SERVERS_TABLE, "name", 0, MR_SERVICE},
2663  {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2664  {V_NUM, 2},
2665  {V_NUM, 3},
2666  {V_NUM, 4},
2667  {V_LEN, 5, SERVERHOSTS_TABLE, "value3"},
2668};
2669
2670static struct validate ashi_validate = /* ashi & ushi */
2671{
2672  ashi_valobj,
2673  6,
2674  "service",
2675  "service = UPPER('%s') AND mach_id = %d",
2676  2,
2677  0,
2678  access_service,
2679  0,
2680  set_serverhost_modtime,
2681};
2682
2683static struct validate rshe_validate =
2684{
2685  ashi_valobj,
2686  2,
2687  "service",
2688  "service = UPPER('%s') AND mach_id = %d",
2689  2,
2690  0,
2691  access_service,
2692  0,
2693  set_serverhost_modtime,
2694};
2695
2696static struct validate ssho_validate =
2697{
2698  ashi_valobj,
2699  2,
2700  "service",
2701  "service = UPPER('%s') AND mach_id = %d",
2702  2,
2703  0,
2704  access_service,
2705  0,
2706  trigger_dcm,
2707};
2708
2709static char *sshi_fields[] = {
2710  "service", "machine", "override", "success", "inprogress",
2711  "hosterror", "errmsg", "ltt", "lts",
2712};
2713
2714static struct valobj sshi_valobj[] = {
2715  {V_NAME, 0, SERVERS_TABLE, "name", 0, MR_SERVICE},
2716  {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2717  {V_NUM, 2},
2718  {V_NUM, 3},
2719  {V_NUM, 4},
2720  {V_NUM, 5},
2721  {V_LEN, 6, SERVERHOSTS_TABLE, "hosterrmsg"},
2722  {V_NUM, 7},
2723  {V_NUM, 8},
2724};
2725
2726static struct validate sshi_validate =
2727{
2728  sshi_valobj,
2729  9,
2730  0,
2731  0,
2732  0,
2733  0,
2734  0,
2735  0,
2736  0,
2737};
2738
2739static char *dshi_fields[] = {
2740  "service", "machine",
2741};
2742
2743static struct validate dshi_validate =
2744{
2745  ashi_valobj,
2746  2,
2747  "service",
2748  "service = UPPER('%s') AND mach_id = %d",
2749  2,
2750  0,
2751  access_service,
2752  setup_dshi,
2753  0,
2754};
2755
2756static char *gslo_fields[] = {
2757  "server",
2758  "server", "machine",
2759};
2760
2761static char *gfsl_fields[] = {
2762  "label",
2763  "label", "type", "machine", "name", "mount", "access", "comments",
2764  "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
2765};
2766
2767static struct validate gfsl_validate = {
2768  0,
2769  0,
2770  0,
2771  0,
2772  0,
2773  0,
2774  0,
2775  0,
2776  followup_fix_modby,
2777};
2778
2779static char *gfsm_fields[] = {
2780  "machine",
2781  "label", "type", "machine", "name", "mount", "access", "comments",
2782  "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
2783};
2784
2785static struct validate gfsm_validate = {
2786  VOmach0,
2787  1,
2788  0,
2789  0,
2790  0,
2791  0,
2792  0,
2793  0,
2794  followup_fix_modby,
2795};
2796
2797static char *gfsn_fields[] = {
2798  "machine", "partition",
2799  "label", "type", "machine", "name", "mount", "access", "comments",
2800  "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
2801};
2802
2803static struct validate gfsn_validate = {
2804  VOmach0,
2805  1,
2806  0,
2807  0,
2808  0,
2809  0,
2810  0,
2811  0,
2812  followup_fix_modby,
2813};
2814
2815static char *gfsp_fields[] = {
2816  "path",
2817  "label", "type", "machine", "name", "mount", "access", "comments",
2818  "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
2819};
2820
2821static char *gfsg_fields[] = {
2822  "list",
2823  "label", "type", "machine", "name", "mount", "access", "comments",
2824  "owner", "owners", "create", "lockertype", "modtime", "modby", "modwith",
2825};
2826
2827static struct validate gfsg_validate = {
2828  VOlist0,
2829  1,
2830  0,
2831  0,
2832  0,
2833  0,
2834  access_list,
2835  0,
2836  followup_fix_modby,
2837};
2838
2839static char *afil_fields[] = {
2840  "label", "type", "machine", "name", "mount", "access", "comments",
2841  "owner", "owners", "create", "lockertype",
2842};
2843
2844static struct valobj afil_valobj[] = {
2845  {V_CHAR, 0, FILESYS_TABLE, "label"},
2846  {V_TYPE, 1, 0, "filesys", 0, MR_FSTYPE},
2847  {V_ID, 2, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2848  {V_CHAR, 3, FILESYS_TABLE, "name"},
2849  {V_LEN, 4, FILESYS_TABLE, "mount"},
2850  {V_LEN, 5, FILESYS_TABLE, "rwaccess"},
2851  {V_LEN, 6, FILESYS_TABLE, "comments"},
2852  {V_ID, 7, USERS_TABLE, "login", "users_id", MR_USER},
2853  {V_ID, 8, LIST_TABLE, "name", "list_id", MR_LIST},
2854  {V_NUM, 9},
2855  {V_TYPE, 10, 0, "lockertype", 0, MR_TYPE},
2856};
2857
2858static struct validate afil_validate = {
2859  afil_valobj,
2860  11,
2861  "label",
2862  "label = '%s'",
2863  1,
2864  "filsys_id",
2865  0,
2866  setup_afil,
2867  set_filesys_modtime,
2868};
2869
2870static char *ufil_fields[] = {
2871  "label", "newlabel", "type", "machine", "name", "mount", "access",
2872  "comments", "owner", "owners", "create", "lockertype",
2873};
2874
2875static struct valobj ufil_valobj[] = {
2876  {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
2877  {V_RENAME, 1, FILESYS_TABLE, "label", "filsys_id", MR_NOT_UNIQUE},
2878  {V_TYPE, 2, 0, "filesys", 0, MR_FSTYPE},
2879  {V_ID, 3, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2880  {V_CHAR, 4, FILESYS_TABLE, "name"},
2881  {V_LEN, 5, FILESYS_TABLE, "mount"},
2882  {V_LEN, 6, FILESYS_TABLE, "rwaccess"},
2883  {V_LEN, 7, FILESYS_TABLE, "comments"},
2884  {V_ID, 8, USERS_TABLE, "login", "users_id", MR_USER},
2885  {V_ID, 9, LIST_TABLE, "name", "list_id", MR_LIST},
2886  {V_NUM, 10},
2887  {V_TYPE, 11, 0, "lockertype", 0, MR_TYPE},
2888};
2889
2890static struct validate ufil_validate = {
2891  ufil_valobj,
2892  12,
2893  "label",
2894  "filsys_id = %d",
2895  1,
2896  "filsys_id",
2897  0,
2898  setup_ufil,
2899  set_filesys_modtime,
2900};
2901
2902static char *dfil_fields[] = {
2903  "label",
2904};
2905
2906static struct validate dfil_validate = {
2907  VOfilesys0,
2908  1,
2909  "label",
2910  "filsys_id = %d",
2911  1,
2912  0,
2913  0,
2914  setup_dfil,
2915  0,
2916};
2917
2918static char *gfgm_fields[] = {
2919  "fsgroup", "filesys", "sortkey"
2920};
2921
2922static struct validate gfgm_validate = {
2923  VOfilesys0,
2924  1,
2925  0,
2926  0,
2927  0,
2928  0,
2929  0,
2930  0,
2931  0,
2932};
2933
2934static struct valobj aftg_valobj[] = {
2935  {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
2936  {V_ID, 1, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
2937};
2938
2939static struct validate aftg_validate = {
2940  aftg_valobj,
2941  2,
2942  "group_id",
2943  "group_id = %d and filsys_id = %d",
2944  2,
2945  0,
2946  0,
2947  0,
2948  0,
2949};
2950
2951static char *ganf_fields[] = {
2952  "machine", "dir", "device", "status", "allocated", "size",
2953  "modtime", "modby", "modwith",
2954};
2955
2956static char *gnfp_fields[] = {
2957  "machine", "dir",
2958  "machine", "dir", "device", "status", "allocated", "size",
2959  "modtime", "modby", "modwith",
2960};
2961
2962static struct validate gnfp_validate = {
2963  VOmach0,
2964  1,
2965  0,
2966  0,
2967  0,
2968  0,
2969  0,
2970  0,
2971  followup_fix_modby,
2972};
2973
2974static struct valobj anfp_valobj[] = {
2975  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2976  {V_CHAR, 1, NFSPHYS_TABLE, "dir"},
2977  {V_LEN, 2, NFSPHYS_TABLE, "device"},
2978  {V_NUM, 3},
2979  {V_NUM, 4},
2980  {V_NUM, 5},
2981};
2982
2983static struct validate anfp_validate = {
2984  anfp_valobj,
2985  6,
2986  "dir",
2987  "mach_id = %d and dir = '%s'",
2988  2,
2989  "nfsphys_id",
2990  0,
2991  prefetch_value,
2992  set_nfsphys_modtime,
2993};
2994
2995static struct validate unfp_validate = {
2996  anfp_valobj,
2997  6,
2998  "dir",
2999  "mach_id = %d and dir = '%s'",
3000  2,
3001  "nfsphys_id",
3002  0,
3003  0,
3004  set_nfsphys_modtime,
3005};
3006
3007static char *ajnf_fields[] = {
3008  "machine", "dir", "adjustment",
3009};
3010
3011static struct valobj ajnf_valobj[] = {
3012  {V_ID, 0, MACHINE_TABLE, NAME, "mach_id", MR_MACHINE},
3013  {V_CHAR, 1, NFSPHYS_TABLE, "dir"},
3014  {V_NUM, 2},
3015};
3016
3017static struct validate ajnf_validate = {
3018  ajnf_valobj,
3019  3,
3020  "dir",
3021  "mach_id = %d and dir = '%s'",
3022  2,
3023  "nfsphys_id",
3024  0,
3025  0,
3026  set_nfsphys_modtime,
3027};
3028
3029static char *dnfp_fields[] = {
3030  "machine", "dir",
3031};
3032
3033static struct validate dnfp_validate = {
3034  anfp_valobj,
3035  2,
3036  "dir",
3037  "mach_id = %d and dir = '%s'",
3038  2,
3039  "nfsphys_id",
3040  0,
3041  setup_dnfp,
3042  set_nfsphys_modtime,
3043};
3044
3045static char *gqot_fields[] = {
3046  "filesys", "type", "name",
3047  "filesys", "type", "name", "quota", "dir", "machine",
3048  "modtime", "modby", "modwith",
3049};
3050
3051static struct valobj gqot_valobj[] = {
3052  {V_TYPE, 1, 0, "quota_type", 0, MR_TYPE},
3053  {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
3054};
3055
3056static struct validate gqot_validate = {
3057  gqot_valobj,
3058  2,
3059  0,
3060  0,
3061  0,
3062  0,
3063  0,
3064  0,
3065  followup_gqot,
3066};
3067
3068static char *gqbf_fields[] = {
3069  "filesys",
3070  "filesys", "type", "name", "quota", "dir", "machine",
3071  "modtime", "modby", "modwith",
3072};
3073
3074static struct validate gqbf_validate = {
3075  0,
3076  0,
3077  0,
3078  0,
3079  0,
3080  0,
3081  0,
3082  0,
3083  followup_gqot,
3084};
3085
3086static char *aqot_fields[] = {
3087  "filesys", "type", "name", "quota",
3088};
3089
3090static struct valobj aqot_valobj[] = {
3091  {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
3092  {V_TYPE, 1, 0, "quota_type", 0, MR_TYPE},
3093  {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
3094  {V_NUM, 3},
3095};
3096
3097static struct validate aqot_validate = {
3098  aqot_valobj,
3099  4,
3100  "filsys_id",
3101  "filsys_id = %d and type = '%s' and entity_id = %d",
3102  3,
3103  0,
3104  0,
3105  prefetch_filesys,
3106  followup_aqot,
3107};
3108
3109static struct validate uqot_validate = {
3110  aqot_valobj,
3111  4,
3112  "filsys_id",
3113  "filsys_id = %d AND type = '%s' AND entity_id = %d",
3114  3,
3115  0,
3116  0,
3117  setup_dqot,
3118  followup_aqot,
3119};
3120
3121static struct validate dqot_validate = {
3122  aqot_valobj,
3123  3,
3124  "filsys_id",
3125  "filsys_id = %d AND type = '%s' AND entity_id = %d",
3126  3,
3127  0,
3128  0,
3129  setup_dqot,
3130  followup_dqot,
3131};
3132
3133static char *gnfq_fields[] = {
3134  "filesys", "login",
3135  "filesys", "login", "quota", "dir", "machine",
3136  "modtime", "modby", "modwith",
3137};
3138
3139static struct validate gnfq_validate = {
3140  0,
3141  0,
3142  0,
3143  0,
3144  0,
3145  0,
3146  0,
3147  0,
3148  followup_gqot,
3149};
3150
3151static char *gnqp_fields[] = {
3152  "machine", "dir",
3153  "filesys", "login", "quota", "dir", "machine",
3154  "modtime", "modby", "modwith",
3155};
3156
3157static char *anfq_fields[] = {
3158  "filesys", "login", "quota",
3159};
3160
3161static struct valobj anfq_valobj[] = {
3162  {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
3163  {V_ID, 1, USERS_TABLE, "login", "users_id", MR_USER},
3164  {V_NUM, 2},
3165};
3166
3167static struct validate anfq_validate = {
3168  anfq_valobj,
3169  3,
3170  "filsys_id",
3171  "filsys_id = %d AND type = 'USER' AND entity_id = %d",
3172  2,
3173  0, /* object ? */
3174  0,
3175  prefetch_filesys,
3176  followup_aqot,
3177};
3178
3179static struct validate unfq_validate = {
3180  anfq_valobj,
3181  3,
3182  "filsys_id",
3183  "filsys_id = %d AND type = 'USER' AND entity_id = %d",
3184  2,
3185  0,
3186  0,
3187  setup_dqot,
3188  followup_aqot,
3189};
3190
3191static struct validate dnfq_validate = {
3192  anfq_valobj,
3193  3,
3194  "filsys_id",
3195  "filsys_id = %d AND entity_id = %d",
3196  2,
3197  0,
3198  0,
3199  setup_dqot,
3200  followup_dqot,
3201};
3202
3203static char *gzcl2_fields[] = {
3204  "class",
3205  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
3206  "iws_type", "iws_name", "iui_type", "iui_name",
3207  "modtime", "modby", "modwith",
3208};
3209
3210static char *gzcl_fields[] = {
3211  "class",
3212  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
3213  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type",
3214  "owner_id", "modtime", "modby", "modwith",
3215};
3216
3217static struct validate gzcl_validate = {
3218  0,
3219  0,
3220  0,
3221  0,
3222  0,
3223  0,
3224  access_zephyr,
3225  0,
3226  followup_gzcl,
3227};
3228
3229static char *azcl2_fields[] = {
3230  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
3231  "iws_type", "iws_name", "iui_type", "iui_name",
3232}; 
3233
3234static struct valobj azcl2_valobj[] = {
3235  {V_CHAR, 0, ZEPHYR_TABLE, "class"},
3236  {V_TYPE, 1, 0, "zace_type", 0, MR_ACE},
3237  {V_TYPEDATA, 2, 0, 0, "list_id", MR_ACE},
3238  {V_TYPE, 3, 0, "zace_type", 0, MR_ACE},
3239  {V_TYPEDATA, 4, 0, 0, "list_id", MR_ACE},
3240  {V_TYPE, 5, 0, "zace_type", 0, MR_ACE},
3241  {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
3242  {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
3243  {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
3244};
3245
3246static struct validate azcl2_validate = {
3247  azcl2_valobj,
3248  9,
3249  "class",
3250  "class = '%s'",
3251  1,
3252  0,
3253  0,
3254  0,
3255  set_zephyr_modtime,
3256};
3257
3258static char *azcl_fields[] = {
3259  "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
3260  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type",
3261  "owner_id",
3262};
3263
3264static struct valobj azcl_valobj[] = {
3265  {V_CHAR, 0, ZEPHYR_TABLE, "class"},
3266  {V_TYPE, 1, 0, "zace_type", 0, MR_ACE},
3267  {V_TYPEDATA, 2, 0, 0, "list_id", MR_ACE},
3268  {V_TYPE, 3, 0, "zace_type", 0, MR_ACE},
3269  {V_TYPEDATA, 4, 0, 0, "list_id", MR_ACE},
3270  {V_TYPE, 5, 0, "zace_type", 0, MR_ACE},
3271  {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
3272  {V_TYPE, 7, 0, "zace_type", 0, MR_ACE},
3273  {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
3274  {V_TYPE, 9, 0, "ace_type", 0, MR_ACE},
3275  {V_TYPEDATA, 10, 0, 0, "list_id", MR_ACE},
3276};
3277
3278static struct validate azcl_validate = {
3279  azcl_valobj,
3280  11,
3281  "class",
3282  "class = '%s'",
3283  1,
3284  0,
3285  0,
3286  0,
3287  set_zephyr_modtime,
3288};
3289
3290static char *uzcl2_fields[] = {
3291  "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
3292  "iws_type", "iws_name", "iui_type", "iui_name",
3293};
3294
3295static struct valobj uzcl2_valobj[] = {
3296  {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
3297  {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
3298  {V_TYPE, 2, 0, "zace_type", 0, MR_ACE},
3299  {V_TYPEDATA, 3, 0, 0, "list_id", MR_ACE},
3300  {V_TYPE, 4, 0, "zace_type", 0, MR_ACE},
3301  {V_TYPEDATA, 5, 0, 0, "list_id", MR_ACE},
3302  {V_TYPE, 6, 0, "zace_type", 0, MR_ACE},
3303  {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
3304  {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
3305  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
3306};
3307
3308static struct validate uzcl2_validate = {
3309  uzcl2_valobj,
3310  10,
3311  "class",
3312  "class = '%s'",
3313  1,
3314  0,
3315  access_zephyr,
3316  0,
3317  set_zephyr_modtime,
3318};
3319
3320static char *uzcl_fields[] = {
3321  "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
3322  "iws_type", "iws_name", "iui_type", "iui_name", "owner_type", "owner_id",
3323};
3324
3325static struct valobj uzcl_valobj[] = {
3326  {V_NAME, 0, ZEPHYR_TABLE, "class", 0, MR_BAD_CLASS},
3327  {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
3328  {V_TYPE, 2, 0, "zace_type", 0, MR_ACE},
3329  {V_TYPEDATA, 3, 0, 0, "list_id", MR_ACE},
3330  {V_TYPE, 4, 0, "zace_type", 0, MR_ACE},
3331  {V_TYPEDATA, 5, 0, 0, "list_id", MR_ACE},
3332  {V_TYPE, 6, 0, "zace_type", 0, MR_ACE},
3333  {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
3334  {V_TYPE, 8, 0, "zace_type", 0, MR_ACE},
3335  {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
3336  {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
3337  {V_TYPEDATA, 11, 0, 0, "list_id", MR_ACE},
3338};
3339
3340static struct validate uzcl_validate = {
3341  uzcl_valobj,
3342  12,
3343  "class",
3344  "class = '%s'",
3345  1,
3346  0,
3347  access_zephyr,
3348  0,
3349  set_zephyr_modtime,
3350};
3351
3352static struct validate dzcl_validate = {
3353  0,
3354  0,
3355  "class",
3356  "class = '%s'",
3357  1,
3358  0,
3359  0,
3360  0,
3361  0,
3362};
3363
3364static char *gsha_fields[] = {
3365  "machine",
3366  "machine", "ace_type", "ace_name", "modtime", "modby", "modwith",
3367};
3368
3369static struct validate gsha_validate =
3370{
3371  0,
3372  0,
3373  0,
3374  0,
3375  0,
3376  0,
3377  0,
3378  0,
3379  followup_gsha,
3380};
3381
3382static char *asha_fields[] = {
3383  "machine", "ace_type", "ace_name",
3384};
3385
3386static struct valobj asha_valobj[] = {
3387  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3388  {V_TYPE, 1, 0, "ace_type", 0, MR_ACE},
3389  {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
3390};
3391
3392static struct validate asha_validate =
3393{
3394  asha_valobj,
3395  3,
3396  "mach_id",
3397  "mach_id = %d",
3398  1,
3399  "mach_id",
3400  0,
3401  0,
3402  set_modtime_by_id,
3403};
3404
3405static char *gacl_fields[] = {
3406  "machine", "target",
3407  "machine", "target", "kind", "list",
3408};
3409
3410static char *aacl_fields[] = {
3411  "machine", "target", "kind", "list",
3412};
3413
3414static char *dacl_fields[] = {
3415  "machine", "target",
3416};
3417
3418static struct valobj aacl_valobj[] = {
3419  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3420  {V_CHAR, 1, ACL_TABLE, "target"},
3421  {V_TYPE, 2, 0, "acl_kind", 0, MR_TYPE},
3422  {V_ID, 3, LIST_TABLE, "name", "list_id", MR_LIST},
3423};
3424
3425static struct validate gacl_validate =
3426{
3427  aacl_valobj,
3428  1,
3429  NULL,
3430  NULL,
3431  0,
3432  "mach_id",
3433  /* access_acl */ 0,
3434  0,
3435  0,
3436};
3437
3438static struct validate aacl_validate =
3439{
3440  aacl_valobj,
3441  4,
3442  "mach_id",
3443  "mach_id = %d AND target = '%s'",
3444  2,
3445  "mach_id",
3446  /* access_acl */ 0,
3447  0,
3448  0,
3449};
3450
3451static char *gsvc_fields[] = {
3452  "service", "protocol",
3453  "service", "protocol", "port", "description", "modtime", "modby", "modwith",
3454};
3455
3456static char *asvc_fields[] = {
3457  "service", "protocol", "port", "description",
3458};
3459
3460static char *dsvc_fields[] = {
3461  "service", "protocol",
3462};
3463
3464static struct valobj asvc_valobj[] = {
3465  {V_CHAR, 0, SERVICES_TABLE, "name"},
3466  {V_CHAR, 1, SERVICES_TABLE, "protocol"},
3467  {V_NUM, 2},
3468  {V_CHAR, 3, SERVICES_TABLE, "description"},
3469};
3470
3471static struct validate asvc_validate = {
3472  asvc_valobj,
3473  4,
3474  "name",
3475  "name = '%s' AND protocol = '%s'",
3476  2,
3477  0,
3478  0,
3479  0,
3480  set_service_modtime,
3481};
3482
3483static struct validate dsvc_validate = {
3484  asvc_valobj,
3485  2,
3486  "name",
3487  "name = '%s' AND protocol = '%s'",
3488  2,
3489  0,
3490  0,
3491  0,
3492  0,
3493};
3494
3495static char *gprn2_fields[] = {
3496  "name",
3497  "name", "type", "hwtype", "duplexname", "hostname",
3498  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3499  "banner", "location", "contact", "modtime", "modby", "modwith"
3500};
3501
3502static char *gpbd2_fields[] = {
3503  "duplexname",
3504  "name", "type", "hwtype", "duplexname", "hostname",
3505  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3506  "banner", "location", "contact", "modtime", "modby", "modwith"
3507};
3508
3509static char *gpbe2_fields[] = {
3510  "hwaddr",
3511  "name", "type", "hwtype", "duplexname", "hostname",
3512  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3513  "banner", "location", "contact", "modtime", "modby", "modwith"
3514};
3515
3516static char *gpbh2_fields[] = {
3517  "hostname",
3518  "name", "type", "hwtype", "duplexname", "hostname",
3519  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3520  "banner", "location", "contact", "modtime", "modby", "modwith"
3521};
3522
3523static char *gpbr2_fields[] = {
3524  "rm",
3525  "name", "type", "hwtype", "duplexname", "hostname",
3526  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3527  "banner", "location", "contact", "modtime", "modby", "modwith"
3528};
3529
3530static char *gpbl2_fields[] = {
3531  "location",
3532  "name", "type", "hwtype", "duplexname", "hostname",
3533  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3534  "banner", "location", "contact", "modtime", "modby", "modwith"
3535};
3536
3537static char *gpbc2_fields[] = {
3538  "contact",
3539  "name", "type", "hwtype", "duplexname", "hostname",
3540  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3541  "banner", "location", "contact", "modtime", "modby", "modwith"
3542};
3543
3544static char *gprn_fields[] = {
3545  "name",
3546  "name", "type", "hwtype", "duplexname", "duplexdefault",
3547  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3548  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3549  "location", "contact", "modtime", "modby", "modwith"
3550};
3551
3552static char *gpbd_fields[] = {
3553  "duplexname",
3554  "name", "type", "hwtype", "duplexname", "duplexdefault",
3555  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3556  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3557  "location", "contact", "modtime", "modby", "modwith"
3558};
3559
3560static char *gpbe_fields[] = {
3561  "hwaddr",
3562  "name", "type", "hwtype", "duplexname", "duplexdefault",
3563  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3564  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3565  "location", "contact", "modtime", "modby", "modwith"
3566};
3567
3568static char *gpbh_fields[] = {
3569  "hostname",
3570  "name", "type", "hwtype", "duplexname", "duplexdefault",
3571  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3572  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3573  "location", "contact", "modtime", "modby", "modwith"
3574};
3575
3576static char *gpbr_fields[] = {
3577  "rm",
3578  "name", "type", "hwtype", "duplexname", "duplexdefault",
3579  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3580  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3581  "location", "contact", "modtime", "modby", "modwith"
3582};
3583
3584static char *gpbl_fields[] = {
3585  "location",
3586  "name", "type", "hwtype", "duplexname", "duplexdefault",
3587  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3588  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3589  "location", "contact", "modtime", "modby", "modwith"
3590
3591};
3592
3593static char *gpbc_fields[] = {
3594  "contact",
3595  "name", "type", "hwtype", "duplexname", "duplexdefault",
3596  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3597  "rq", "ka", "pc", "ac", "lpc_acl", "report_list",  "banner",
3598  "location", "contact", "modtime", "modby", "modwith"
3599};
3600
3601static char *aprn2_fields[] = {
3602  "printer", "type", "hwtype", "duplexname", "hostname",
3603  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3604  "banner", "location", "contact",
3605};
3606
3607static struct valobj aprn2_valobj[] = {
3608  {V_CHAR, 0, PRINTERS_TABLE, "name"},
3609  {V_TYPE, 1, 0, "printertype", 0, MR_TYPE},
3610  {V_TYPE, 2, 0, "printerhwtype", 0, MR_TYPE},
3611  {V_CHAR, 3, PRINTERS_TABLE, "duplexname"},
3612  {V_ID, 4, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3613  {V_ID, 5, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3614  {V_ID, 6, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3615  {V_CHAR, 7, PRINTERS_TABLE, "rp"},
3616  {V_ID, 8, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3617  {V_NUM, 9},
3618  {V_NUM, 10},
3619  {V_ID, 11, LIST_TABLE, "name", "list_id", MR_LIST},
3620  {V_ID, 12, LIST_TABLE, "name", "list_id", MR_LIST},
3621  {V_NUM, 13},
3622  {V_CHAR, 14, PRINTERS_TABLE, "location"},
3623  {V_CHAR, 15, PRINTERS_TABLE, "contact"},
3624};
3625
3626static struct validate aprn2_validate = {
3627  aprn2_valobj,
3628  16,
3629  "name",
3630  "name = '%s'",
3631  1,
3632  0,
3633  access_printer,
3634  setup_aprn,
3635  set_modtime,
3636};
3637
3638static char *aprn_fields[] = {
3639  "printer", "type", "hwtype", "duplexname", "duplexdefault",
3640  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3641  "rq", "ka", "pc", "ac", "lpc_acl", "report_list", "banner",
3642  "location", "contact",
3643};
3644
3645static struct valobj aprn_valobj[] = {
3646  {V_CHAR, 0, PRINTERS_TABLE, "name"},
3647  {V_TYPE, 1, 0, "printertype", 0, MR_TYPE},
3648  {V_TYPE, 2, 0, "printerhwtype", 0, MR_TYPE},
3649  {V_CHAR, 3, PRINTERS_TABLE, "duplexname"},
3650  {V_NUM, 4},
3651  {V_NUM, 5},
3652  {V_NUM, 6},
3653  {V_ID, 7, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3654  {V_ID, 8, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3655  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3656  {V_CHAR, 10, PRINTERS_TABLE, "rp"},
3657  {V_ID, 11, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3658  {V_NUM, 12},
3659  {V_NUM, 13},
3660  {V_ID, 14, LIST_TABLE, "name", "list_id", MR_LIST},
3661  {V_ID, 15, LIST_TABLE, "name", "list_id", MR_LIST},
3662  {V_ID, 16, LIST_TABLE, "name", "list_id", MR_LIST},
3663  {V_NUM, 17},
3664  {V_CHAR, 18, PRINTERS_TABLE, "location"},
3665  {V_CHAR, 19, PRINTERS_TABLE, "contact"},
3666};
3667
3668static struct validate aprn_validate = {
3669  aprn_valobj,
3670  20,
3671  "name",
3672  "name = '%s'",
3673  1,
3674  0,
3675  access_printer,
3676  setup_aprn,
3677  set_modtime,
3678};
3679
3680static char *uprn2_fields[] = {
3681  "printer",
3682  "printer", "type", "hwtype", "duplexname", "hostname",
3683  "loghost", "rm", "rp", "rq", "ka", "pc", "ac", "lpc_acl",
3684  "banner", "location", "contact",
3685};
3686
3687static struct valobj uprn2_valobj[] = {
3688  {V_CHAR, 0, PRINTERS_TABLE, "name"},
3689  {V_CHAR, 1, PRINTERS_TABLE, "name"},
3690  {V_TYPE, 2, 0, "printertype", 0, MR_TYPE},
3691  {V_TYPE, 3, 0, "printerhwtype", 0, MR_TYPE},
3692  {V_CHAR, 4, PRINTERS_TABLE, "duplexname"},
3693  {V_ID, 5, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3694  {V_ID, 6, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3695  {V_ID, 7, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3696  {V_CHAR, 8, PRINTERS_TABLE, "rp"},
3697  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3698  {V_NUM, 10},
3699  {V_NUM, 11},
3700  {V_ID, 12, LIST_TABLE, "name", "list_id", MR_LIST},
3701  {V_ID, 13, LIST_TABLE, "name", "list_id", MR_LIST},
3702  {V_NUM, 14},
3703  {V_CHAR, 15, PRINTERS_TABLE, "location"},
3704  {V_CHAR, 16, PRINTERS_TABLE, "contact"},
3705};
3706
3707static struct validate uprn2_validate = {
3708  uprn2_valobj,
3709  16,
3710  "name",
3711  "name = '%s'",
3712  1,
3713  0,
3714  access_printer,
3715  setup_aprn,
3716  set_modtime,
3717};
3718
3719static char *uprn_fields[] = {
3720  "printer",
3721  "printer", "type", "hwtype", "duplexname", "duplexdefault",
3722  "holddefault", "status", "hostname", "loghost", "rm", "rp",
3723  "rq", "ka", "pc", "ac", "lpc_acl", "report_list", "banner",
3724  "location", "contact",
3725};
3726
3727static struct valobj uprn_valobj[] = {
3728  {V_CHAR, 0, PRINTERS_TABLE, "name"},
3729  {V_CHAR, 1, PRINTERS_TABLE, "name"},
3730  {V_TYPE, 2, 0, "printertype", 0, MR_TYPE},
3731  {V_TYPE, 3, 0, "printerhwtype", 0, MR_TYPE},
3732  {V_CHAR, 4, PRINTERS_TABLE, "duplexname"},
3733  {V_NUM, 5},
3734  {V_NUM, 6},
3735  {V_NUM, 7},
3736  {V_ID, 8, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3737  {V_ID, 9, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3738  {V_ID, 10, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3739  {V_CHAR, 11, PRINTERS_TABLE, "rp"},
3740  {V_ID, 12, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3741  {V_NUM, 13},
3742  {V_NUM, 14},
3743  {V_ID, 15, LIST_TABLE, "name", "list_id", MR_LIST},
3744  {V_ID, 16, LIST_TABLE, "name", "list_id", MR_LIST},
3745  {V_ID, 17, LIST_TABLE, "name", "list_id", MR_LIST},
3746  {V_NUM, 18},
3747  {V_CHAR, 19, PRINTERS_TABLE, "location"},
3748  {V_CHAR, 20, PRINTERS_TABLE, "contact"},
3749};
3750
3751static struct validate uprn_validate = {
3752  uprn_valobj,
3753  20,
3754  "name",
3755  "name = '%s'",
3756  1,
3757  0,
3758  access_printer,
3759  setup_aprn,
3760  set_modtime,
3761};
3762
3763static struct validate dprn_validate = {
3764  0,
3765  0,
3766  "name",
3767  "name = '%s'",
3768  1,
3769  0,
3770  access_printer,
3771  0,
3772  0,
3773};
3774
3775static char *gpsv_fields[] = {
3776  "host",
3777  "host", "kind", "printer_types", "owner_type", "owner_name",
3778  "lpc_acl", "modtime", "modby", "modwith"
3779};
3780
3781static struct valobj gpsv_valobj[] = {
3782  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3783};
3784
3785static struct validate gpsv_validate = {
3786  gpsv_valobj,
3787  1,
3788  0,
3789  0,
3790  0,
3791  0,
3792  0,
3793  0,
3794  followup_gpsv,
3795};
3796
3797static char *apsv_fields[] = {
3798  "host", "kind", "printer_types", "owner_type", "owner_name", "lpc_acl"
3799};
3800
3801static struct valobj apsv_valobj[] = {
3802  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
3803  {V_TYPE, 1, 0, "lpd_kind", 0, MR_TYPE},
3804  {V_ID, 2, STRINGS_TABLE, "string", "string_id", MR_STRING},
3805  {V_TYPE, 3, 0, "ace_type", 0, MR_ACE},
3806  {V_TYPEDATA, 4, 0, 0, 0, MR_ACE},
3807  {V_ID, 5, LIST_TABLE, "name", "list_id", MR_LIST},
3808};
3809
3810static struct validate apsv_validate = {
3811  apsv_valobj,
3812  6,
3813  "mach_id",
3814  "mach_id = %d",
3815  1,
3816  "mach_id",
3817  0,
3818  0,
3819  set_modtime_by_id,
3820};
3821
3822static char *dpsv_fields[] = {
3823  "host",
3824};
3825
3826static struct validate dpsv_validate = {
3827  gpsv_valobj,
3828  1,
3829  "mach_id",
3830  "mach_id = %d",
3831  1,
3832  0,
3833  0,
3834  setup_dpsv,
3835  0,
3836}; 
3837
3838static char *gali_fields[] = {
3839  "name", "type", "trans",
3840  "name", "type", "trans",
3841};
3842
3843static char *aali_fields[] = {
3844  "name", "type", "trans",
3845};
3846
3847static struct valobj aali_valobj[] = {
3848  {V_CHAR, 0, ALIAS_TABLE, "name"},
3849  {V_TYPE, 1, 0, "alias", 0, MR_TYPE},
3850  {V_CHAR, 2, ALIAS_TABLE, "trans"},
3851};
3852
3853static struct validate aali_validate = {
3854  aali_valobj,
3855  3,
3856  "trans",
3857  "name = '%s' and type = '%s' and trans = '%s'",
3858  3,
3859  0,
3860  0,
3861  setup_aali,
3862  0,
3863};
3864
3865static struct validate dali_validate =  /* DELETE_ALIAS */
3866{
3867  0,
3868  0,
3869  "trans",
3870  "name = '%s' and type = '%s' and trans = '%s'",
3871  3,
3872  0,
3873  0,
3874  0,
3875  0,
3876};
3877
3878static char *gval_fields[] = {
3879  "name", "value",
3880};
3881
3882static struct valobj gval_valobj[] = {
3883  {V_NAME, 0, NUMVALUES_TABLE, "name", 0, MR_NO_MATCH},
3884};
3885
3886static struct validate gval_validate = {
3887  gval_valobj,
3888  1,
3889  0,
3890  0,
3891  0,
3892  0,
3893  0,
3894  0,
3895  0,
3896};
3897
3898static char *aval_fields[] = {
3899  "name", "value",
3900};
3901
3902static struct valobj aval_valobj[] = {
3903  {V_CHAR, 0, NUMVALUES_TABLE, "name"},
3904  {V_NUM, 1},
3905};
3906
3907static struct validate aval_validate =  /* for aval, uval, and dval */
3908{
3909  aval_valobj,
3910  2,
3911  "name",
3912  "name = '%s'",
3913  1,
3914  0,
3915  0,
3916  0,
3917  0,
3918};
3919
3920static char *dval_fields[] = {
3921  "name",
3922};
3923
3924static char *gats_fields[] = {
3925  "table_name", "appends", "updates", "deletes",
3926  "modtime", "modby", "modwith",
3927};
3928
3929static char *_sdl_fields[] = {
3930  "level",
3931};
3932
3933static struct validate _sdl_validate =
3934{
3935  VOnum0,
3936  1,
3937  NULL,
3938  NULL,
3939  0,
3940  0,
3941  0,
3942  0,
3943  _sdl_followup,
3944};
3945
3946static char *gcon7_fields[] = {
3947  "name",
3948  "name", "description", "location", "contact",
3949  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
3950};
3951
3952static struct validate gcon_validate = {
3953  0,
3954  0,
3955  0,
3956  0,
3957  0,
3958  0,
3959  0,
3960  0,
3961  followup_gcon,
3962};
3963
3964static char *gcon_fields[] = {
3965  "name",
3966  "name", "publicflg", "description", "location", "contact",
3967  "ace_type", "ace_name", "memace_type", "memace_name", "modtime", "modby", "modwith",
3968};
3969
3970static char *acon7_fields[] = {
3971  "name", "description", "location", "contact",
3972  "ace_type", "ace_name", "memace_type", "memace_name",
3973};
3974
3975static struct valobj acon7_valobj[] = {
3976  {V_CHAR, 0, CONTAINERS_TABLE, "name"},
3977  {V_LEN, 1, CONTAINERS_TABLE, "description"},
3978  {V_CHAR, 2, CONTAINERS_TABLE, "location"},
3979  {V_CHAR, 3, CONTAINERS_TABLE, "contact"},
3980  {V_TYPE, 4, 0, "ace_type", 0, MR_ACE},
3981  {V_TYPEDATA, 5, 0, 0, 0, MR_ACE},
3982  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
3983  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
3984};
3985
3986static struct validate acon7_validate =
3987{
3988  acon7_valobj,
3989  8,
3990  "name",
3991  "name = '%s'",
3992  1,
3993  "cnt_id",
3994  0,
3995  setup_acon,
3996  set_modtime,
3997};
3998
3999static char *acon_fields[] = {
4000  "name", "publicflg", "description", "location", "contact",
4001  "ace_type", "ace_name", "memace_type", "memace_name",
4002};
4003
4004static struct valobj acon_valobj[] = {
4005  {V_CHAR, 0, CONTAINERS_TABLE, "name"},
4006  {V_NUM, 1},
4007  {V_LEN, 2, CONTAINERS_TABLE, "description"},
4008  {V_CHAR, 3, CONTAINERS_TABLE, "location"},
4009  {V_CHAR, 4, CONTAINERS_TABLE, "contact"},
4010  {V_TYPE, 5, 0, "ace_type", 0, MR_ACE},
4011  {V_TYPEDATA, 6, 0, 0, 0, MR_ACE},
4012  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
4013  {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
4014};
4015
4016static struct validate acon_validate =
4017{
4018  acon_valobj,
4019  9,
4020  "name",
4021  "name = '%s'",
4022  1,
4023  "cnt_id",
4024  0,
4025  setup_acon,
4026  set_modtime,
4027};
4028
4029static char *ucon7_fields[] = {
4030  "name",
4031  "newname", "description", "location", "contact",
4032  "ace_type", "ace_name", "memace_type", "memace_name",
4033};
4034
4035static struct valobj ucon7_valobj[] = {
4036  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
4037  {V_RENAME, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_NOT_UNIQUE},
4038  {V_LEN, 2, CONTAINERS_TABLE, "description"},
4039  {V_CHAR, 3, CONTAINERS_TABLE, "location"},
4040  {V_CHAR, 4, CONTAINERS_TABLE, "contact"},
4041  {V_TYPE, 5, 0, "ace_type", 0, MR_ACE},
4042  {V_TYPEDATA, 6, 0, 0, 0, MR_ACE},
4043  {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
4044  {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
4045};
4046
4047static struct validate ucon7_validate =
4048{
4049  ucon7_valobj,
4050  9,
4051  0,
4052  0,
4053  0,
4054  0,
4055  access_container,
4056  0,
4057  update_container,
4058};
4059
4060static char *ucon_fields[] = {
4061  "name",
4062  "newname", "publicflg", "description", "location", "contact",
4063  "ace_type", "ace_name", "memace_type", "memace_name",
4064};
4065
4066static struct valobj ucon_valobj[] = {
4067  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
4068  {V_RENAME, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_NOT_UNIQUE},
4069  {V_NUM, 2},
4070  {V_LEN, 3, CONTAINERS_TABLE, "description"},
4071  {V_CHAR, 4, CONTAINERS_TABLE, "location"},
4072  {V_CHAR, 5, CONTAINERS_TABLE, "contact"},
4073  {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
4074  {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
4075  {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
4076  {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
4077};
4078
4079static struct validate ucon_validate =
4080{
4081  ucon_valobj,
4082  10,
4083  0,
4084  0,
4085  0,
4086  0,
4087  access_container,
4088  0,
4089  update_container,
4090};
4091
4092static char *dcon_fields[] = {
4093  "name",
4094};
4095
4096static struct validate dcon_validate =
4097{
4098  VOcon0,
4099  1,
4100  0,
4101  0,
4102  0,
4103  0,
4104  0,
4105  setup_dcon,
4106  0,
4107};
4108
4109static char *amcn_fields[] = {
4110  "machine", "container",
4111};
4112
4113static struct valobj amcn_valobj[] =    /* ADD_MACHINE_TO_CONTAINER */
4114{                                       /* DELETE_MACHINE_FROM_CONTAINER */
4115  {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
4116  {V_ID, 1, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
4117};
4118
4119static struct validate amcn_validate = /* for amtn and dmfn */
4120{
4121  amcn_valobj,
4122  2,
4123  "mach_id",
4124  "mach_id = %d",
4125  1,
4126  0,
4127  access_container,
4128  0,
4129  set_mach_modtime_by_id,
4130};
4131
4132static struct validate dmcn_validate = /* for amtn and dmfn */
4133{
4134  amcn_valobj,
4135  2,
4136  "mach_id",
4137  "mach_id = %d and cnt_id = %d",
4138  2,
4139  0,
4140  access_container,
4141  0,
4142  set_mach_modtime_by_id,
4143};
4144
4145static char *gmnm_fields[] = {
4146  "machine",
4147  "machine", "container",
4148};
4149
4150static char *gmoc_fields[] = {
4151  "container",
4152  "isrecursive",
4153        "machine",
4154  "container",
4155};
4156
4157static struct validate gmoc_validate =
4158{
4159  VOcon0,
4160  1,
4161  0,
4162  0,
4163  0,
4164  0,
4165  0,
4166  0,
4167  get_machines_of_container,
4168};
4169
4170static char *gsoc_fields[] = {
4171  "container",
4172  "isrecursive",
4173        "subcontainer",
4174};
4175
4176static struct validate gsoc_validate =
4177{
4178  VOcon0,
4179  1,
4180  0,
4181  0,
4182  0,
4183  0,
4184  0,
4185  0,
4186  get_subcontainers_of_container,
4187};
4188
4189static char *gtlc_fields[] = {
4190  "name",
4191};
4192
4193static char *scli_fields[] = {
4194  "containername",
4195  "listname",
4196};
4197
4198static struct valobj scli_valobj[] = {
4199  {V_ID, 0, CONTAINERS_TABLE, "name", "cnt_id", MR_CONTAINER},
4200  {V_ID, 1, LIST_TABLE, "name", "list_id", MR_LIST},
4201};
4202
4203static struct validate scli_validate = {
4204  scli_valobj,
4205  2,
4206  0,
4207  0,
4208  0,
4209  0,
4210  0,
4211  setup_scli,
4212  set_container_list,
4213};
4214
4215static char *gcli_fields[] = {
4216  "containername",
4217  "containername", "listname",
4218};
4219
4220static struct validate glic_validate =
4221{
4222  VOlist0,
4223  1,
4224  NULL,
4225  NULL,
4226  0,
4227  0,
4228  0,
4229  0,
4230  0,
4231};
4232
4233static char *glic_fields[] = {
4234  "listname",
4235  "containername", "listname",
4236};
4237
4238/* Generalized Query Definitions */
4239
4240/* Multiple versions of the same query MUST be listed in ascending
4241 * order.
4242 */
4243
4244/* Note: For any query which uses prefetch_value, the vcnt should be
4245 * one less than the number of %-format specifiers in the tlist.
4246 */
4247
4248struct query Queries[] = {
4249  {
4250    /* Q_GALO - GET_ALL_LOGINS, v2 */
4251    "get_all_logins",
4252    "galo",
4253    2,
4254    MR_Q_RETRIEVE,
4255    "u",
4256    USERS_TABLE,
4257    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
4258    galo2_fields,
4259    6,
4260    "u.users_id != 0",
4261    0,
4262    "u.login",
4263    0,
4264  },
4265
4266  {
4267    /* Q_GALO - GET_ALL_LOGINS, v3 */
4268    "get_all_logins",
4269    "galo",
4270    3,
4271    MR_Q_RETRIEVE,
4272    "u",
4273    USERS_TABLE,
4274    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
4275    galo_fields,
4276    7,
4277    "u.users_id != 0",
4278    0,
4279    "u.login",
4280    0,
4281  },
4282
4283  {
4284    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v2 */
4285    "get_all_active_logins",
4286    "gaal",
4287    2,
4288    MR_Q_RETRIEVE,
4289    "u",
4290    USERS_TABLE,
4291    "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
4292    galo2_fields,
4293    6,
4294    "u.status = 1",
4295    0,
4296    "u.login",
4297    0,
4298  },
4299
4300  {
4301    /* Q_GAAL - GET_ALL_ACTIVE_LOGINS, v3 */
4302    "get_all_active_logins",
4303    "gaal",
4304    3,
4305    MR_Q_RETRIEVE,
4306    "u",
4307    USERS_TABLE,
4308    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle FROM users u",
4309    galo_fields,
4310    7,
4311    "u.status = 1",
4312    0,
4313    "u.login",
4314    0,
4315  },
4316
4317  {
4318    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v2 */
4319    "get_user_account_by_login",
4320    "gual",
4321    2,
4322    MR_Q_RETRIEVE,
4323    "u",
4324    USERS_TABLE,
4325    "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",
4326    gual2_fields,
4327    15,
4328    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4329    1,
4330    "u.login",
4331    &gubl2_validate,
4332  },
4333
4334  {
4335    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v3 */
4336    "get_user_account_by_login",
4337    "gual",
4338    3,
4339    MR_Q_RETRIEVE,
4340    "u",
4341    USERS_TABLE,
4342    "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",
4343    gual3_fields,
4344    18,
4345    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4346    1,
4347    "u.login",
4348    &gubl_validate,
4349  },
4350
4351  {
4352    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v11 */
4353    "get_user_account_by_login",
4354    "gual",
4355    11,
4356    MR_Q_RETRIEVE,
4357    "u",
4358    USERS_TABLE,
4359    "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",
4360    gual11_fields,
4361    20,
4362    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4363    1,
4364    "u.login",
4365    &gubl_validate,
4366  },
4367
4368  {
4369    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v12 */
4370    "get_user_account_by_login",
4371    "gual",
4372    12,
4373    MR_Q_RETRIEVE,
4374    "u",
4375    USERS_TABLE,
4376    "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",
4377    gual12_fields,
4378    23,
4379    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4380    1,
4381    "u.login",
4382    &gubl_validate,
4383  },
4384
4385  {
4386    /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN, v14 */
4387    "get_user_account_by_login",
4388    "gual",
4389    14,
4390    MR_Q_RETRIEVE,
4391    "u",
4392    USERS_TABLE,
4393    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, u.alternate_email, u.alternate_phone, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
4394    gual_fields,
4395    25,
4396    "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4397    1,
4398    "u.login",
4399    &gubl_validate,
4400  },
4401
4402  {
4403    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v2 */
4404    "get_user_account_by_uid",
4405    "guau",
4406    2,
4407    MR_Q_RETRIEVE,
4408    "u",
4409    USERS_TABLE,
4410    "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",
4411    guau2_fields,
4412    15,
4413    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
4414    1,
4415    "u.login",
4416    &gubu2_validate,
4417  },
4418
4419  {
4420    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v3 */
4421    "get_user_account_by_uid",
4422    "guau",
4423    3,
4424    MR_Q_RETRIEVE,
4425    "u",
4426    USERS_TABLE,
4427    "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",
4428    guau3_fields,
4429    18,
4430    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
4431    1,
4432    "u.login",
4433    &gubu_validate,
4434  },
4435
4436  {
4437    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v11 */
4438    "get_user_account_by_uid",
4439    "guau",
4440    11,
4441    MR_Q_RETRIEVE,
4442    "u",
4443    USERS_TABLE,
4444    "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",
4445    guau11_fields,
4446    20,
4447    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
4448    1,
4449    "u.login",
4450    &gubu_validate,
4451  },
4452
4453  {
4454    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v12 */
4455    "get_user_account_by_uid",
4456    "guau",
4457    12,
4458    MR_Q_RETRIEVE,
4459    "u",
4460    USERS_TABLE,
4461    "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",
4462    guau12_fields,
4463    23,
4464    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
4465    1,
4466    "u.login",
4467    &gubu_validate,
4468  },
4469
4470  {
4471    /* Q_GUAU - GET_USER_ACCOUNT_BY_UID, v14 */
4472    "get_user_account_by_uid",
4473    "guau",
4474    14,
4475    MR_Q_RETRIEVE,
4476    "u",
4477    USERS_TABLE,
4478    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, u.alternate_email, u.alternate_phone, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
4479    guau_fields,
4480    25,
4481    "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
4482    1,
4483    "u.login",
4484    &gubu_validate,
4485  },
4486
4487  {
4488    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v2 */
4489    "get_user_account_by_name",
4490    "guan",
4491    2,
4492    MR_Q_RETRIEVE,
4493    "u",
4494    USERS_TABLE,
4495    "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",
4496    guan2_fields,
4497    15,
4498    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
4499    2,
4500    "u.login",
4501    &guan2_validate,
4502  },
4503
4504  {
4505    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v3 */
4506    "get_user_account_by_name",
4507    "guan",
4508    3,
4509    MR_Q_RETRIEVE,
4510    "u",
4511    USERS_TABLE,
4512    "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",
4513    guan3_fields,
4514    18,
4515    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
4516    2,
4517    "u.login",
4518    &guan_validate,
4519  },
4520
4521  {
4522    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v11 */
4523    "get_user_account_by_name",
4524    "guan",
4525    11,
4526    MR_Q_RETRIEVE,
4527    "u",
4528    USERS_TABLE,
4529    "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",
4530    guan11_fields,
4531    20,
4532    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
4533    2,
4534    "u.login",
4535    &guan_validate,
4536  },
4537
4538  {
4539    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v12 */
4540    "get_user_account_by_name",
4541    "guan",
4542    12,
4543    MR_Q_RETRIEVE,
4544    "u",
4545    USERS_TABLE,
4546    "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",
4547    guan12_fields,
4548    23,
4549    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
4550    2,
4551    "u.login",
4552    &guan_validate,
4553  },
4554
4555  {
4556    /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME, v14 */
4557    "get_user_account_by_name",
4558    "guan",
4559    14,
4560    MR_Q_RETRIEVE,
4561    "u",
4562    USERS_TABLE,
4563    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, u.alternate_email, u.alternate_phone, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
4564    guan_fields,
4565    25,
4566    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
4567    2,
4568    "u.login",
4569    &guan_validate,
4570  },
4571
4572  {
4573    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v2 */
4574    "get_user_account_by_class",
4575    "guac",
4576    2,
4577    MR_Q_RETRIEVE,
4578    "u",
4579    USERS_TABLE,
4580    "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",
4581    guac2_fields,
4582    15,
4583    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
4584    1,
4585    "u.login",
4586    &VDfix_modby,
4587  },
4588
4589  {
4590    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v3 */
4591    "get_user_account_by_class",
4592    "guac",
4593    3,
4594    MR_Q_RETRIEVE,
4595    "u",
4596    USERS_TABLE,
4597    "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",
4598    guac3_fields,
4599    18,
4600    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
4601    1,
4602    "u.login",
4603    &guan_validate,
4604  },
4605
4606  {
4607    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v11 */
4608    "get_user_account_by_class",
4609    "guac",
4610    11,
4611    MR_Q_RETRIEVE,
4612    "u",
4613    USERS_TABLE,
4614    "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",
4615    guac11_fields,
4616    20,
4617    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
4618    1,
4619    "u.login",
4620    &guan_validate,
4621  },
4622
4623  {
4624    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v12 */
4625    "get_user_account_by_class",
4626    "guac",
4627    12,
4628    MR_Q_RETRIEVE,
4629    "u",
4630    USERS_TABLE,
4631    "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",
4632    guac12_fields,
4633    23,
4634    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
4635    1,
4636    "u.login",
4637    &guan_validate,
4638  },
4639
4640  {
4641    /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS, v14 */
4642    "get_user_account_by_class",
4643    "guac",
4644    14,
4645    MR_Q_RETRIEVE,
4646    "u",
4647    USERS_TABLE,
4648    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, u.alternate_email, u.alternate_phone, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
4649    guac_fields,
4650    25,
4651    "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
4652    1,
4653    "u.login",
4654    &guan_validate,
4655  },
4656
4657  {
4658    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v2 */
4659    "get_user_account_by_id",
4660    "guai",
4661    2,
4662    MR_Q_RETRIEVE,
4663    "u",
4664    USERS_TABLE,
4665    "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",
4666    guam2_fields,
4667    15,
4668    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4669    1,
4670    "u.login",
4671    &VDfix_modby,
4672  },
4673
4674  {
4675    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v3 */
4676    "get_user_account_by_id",
4677    "guai",
4678    3,
4679    MR_Q_RETRIEVE,
4680    "u",
4681    USERS_TABLE,
4682    "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",
4683    guam_fields,
4684    18,
4685    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4686    1,
4687    "u.login",
4688    &guan_validate,
4689  },
4690
4691  {
4692    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v11 */
4693    "get_user_account_by_id",
4694    "guai",
4695    11,
4696    MR_Q_RETRIEVE,
4697    "u",
4698    USERS_TABLE,
4699    "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",
4700    guam11_fields,
4701    20,
4702    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4703    1,
4704    "u.login",
4705    &guan_validate,
4706  },
4707
4708  {
4709    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v12 */
4710    "get_user_account_by_id",
4711    "guai",
4712    12,
4713    MR_Q_RETRIEVE,
4714    "u",
4715    USERS_TABLE,
4716    "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",
4717    guam12_fields,
4718    23,
4719    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4720    1,
4721    "u.login",
4722    &guan_validate,
4723  },
4724
4725  {
4726    /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID, v14 */
4727    "get_user_account_by_id",
4728    "guai",
4729    14,
4730    MR_Q_RETRIEVE,
4731    "u",
4732    USERS_TABLE,
4733    "u.login, u.unix_uid, u.shell, u.winconsoleshell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, CHR(0), u.secure, u.winhomedir, u.winprofiledir, u.sponsor_type, u.sponsor_id, u.expiration, u.alternate_email, u.alternate_phone, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith, TO_CHAR(u.created, 'DD-mon-YYYY HH24:MI:SS'), u.creator FROM users u, strings str",
4734    guam_fields,
4735    25,
4736    "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
4737    1,
4738    "u.login",
4739    &guan_validate,
4740  },
4741
4742  {
4743    /* Q_GUAS - GET_USER_ACCOUNT_BY_SPONSOR, v12 */
4744    "get_user_account_by_sponsor",
4745    "guas",
4746    12,
4747    MR_Q_RETRIEVE,
4748    0,
4749    0,
4750    0,
4751    guas_fields,
4752    1,
4753    0,
4754    2,
4755    NULL,
4756    &guas_validate,
4757  },
4758
4759  {
4760    /* Q_GUBL - GET_USER_BY_LOGIN, v2 */
4761    "get_user_by_login",
4762    "gubl",
4763    2,
4764    MR_Q_RETRIEVE,
4765    "u",
4766    USERS_TABLE,
4767    "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",
4768    gubl2_fields,
4769    12,
4770    "u.login LIKE '%s' AND u.users_id != 0",
4771    1,
4772    "u.login",
4773    &gubl2_validate,
4774  },
4775
4776  {
4777    /* Q_GUBL - GET_USER_BY_LOGIN, v3 */
4778    "get_user_by_login",
4779    "gubl",
4780    3,
4781    MR_Q_RETRIEVE,
4782    "u",
4783    USERS_TABLE,
4784    "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",
4785    gubl_fields,
4786    15,
4787    "u.login LIKE '%s' AND u.users_id != 0",
4788    1,
4789    "u.login",
4790    &gubl_validate,
4791  },
4792
4793  {
4794    /* Q_GUBU - GET_USER_BY_UID, v2 */
4795    "get_user_by_uid",
4796    "gubu",
4797    2,
4798    MR_Q_RETRIEVE,
4799    "u",
4800    USERS_TABLE,
4801    "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",
4802    gubu2_fields,
4803    12,
4804    "u.unix_uid = %s AND u.users_id != 0",
4805    1,
4806    "u.login",
4807    &gubu2_validate,
4808  },
4809
4810  {
4811    /* Q_GUBU - GET_USER_BY_UID, v3 */
4812    "get_user_by_uid",
4813    "gubu",
4814    3,
4815    MR_Q_RETRIEVE,
4816    "u",
4817    USERS_TABLE,
4818    "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",
4819    gubu_fields,
4820    15,
4821    "u.unix_uid = %s AND u.users_id != 0",
4822    1,
4823    "u.login",
4824    &gubu_validate,
4825  },
4826
4827  {
4828    /* Q_GUBN - GET_USER_BY_NAME, v2 */
4829    "get_user_by_name",
4830    "gubn",
4831    2,
4832    MR_Q_RETRIEVE,
4833    "u",
4834    USERS_TABLE,
4835    "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",
4836    gubn2_fields,
4837    12,
4838    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
4839    2,
4840    "u.login",
4841    &gubn2_validate,
4842  },
4843
4844  {
4845    /* Q_GUBN - GET_USER_BY_NAME, v3 */
4846    "get_user_by_name",
4847    "gubn",
4848    3,
4849    MR_Q_RETRIEVE,
4850    "u",
4851    USERS_TABLE,
4852    "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",
4853    gubn_fields,
4854    15,
4855    "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
4856    2,
4857    "u.login",
4858    &gubn_validate,
4859  },
4860
4861  {
4862    /* Q_GUBC - GET_USER_BY_CLASS, v2 */
4863    "get_user_by_class",
4864    "gubc",
4865    2,
4866    MR_Q_RETRIEVE,
4867    "u",
4868    USERS_TABLE,
4869    "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",
4870    gubc2_fields,
4871    12,
4872    "u.type = UPPER('%s') AND u.users_id != 0",
4873    1,
4874    "u.login",
4875    &VDfix_modby,
4876  },
4877
4878  {
4879    /* Q_GUBC - GET_USER_BY_CLASS, v3 */
4880    "get_user_by_class",
4881    "gubc",
4882    3,
4883    MR_Q_RETRIEVE,
4884    "u",
4885    USERS_TABLE,
4886    "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",
4887    gubc_fields,
4888    15,
4889    "u.type = UPPER('%s') AND u.users_id != 0",
4890    1,
4891    "u.login",
4892    &guan_validate,
4893  },
4894
4895  {
4896    /* Q_GUBM - GET_USER_BY_MITID, v2 */
4897    "get_user_by_mitid",
4898    "gubm",
4899    2,
4900    MR_Q_RETRIEVE,
4901    "u",
4902    USERS_TABLE,
4903    "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",
4904    gubm2_fields,
4905    12,
4906    "u.clearid LIKE '%s' AND u.users_id != 0",
4907    1,
4908    "u.login",
4909    &VDfix_modby,
4910  },
4911
4912  {
4913    /* Q_GUBM - GET_USER_BY_MITID, v3 */
4914    "get_user_by_mitid",
4915    "gubm",
4916    3,
4917    MR_Q_RETRIEVE,
4918    "u",
4919    USERS_TABLE,
4920    "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",
4921    gubm_fields,
4922    15,
4923    "u.clearid LIKE '%s' AND u.users_id != 0",
4924    1,
4925    "u.login",
4926    &guan_validate,
4927  },
4928
4929  {
4930    /* Q_AUAC - ADD_USER_ACCOUNT, v2 */  /* uses prefetch_value() for users_id */
4931    "add_user_account",
4932    "auac",
4933    2,
4934    MR_Q_APPEND,
4935    "u",
4936    USERS_TABLE,
4937    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
4938     * but using up one argv element.
4939     */
4940    "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)",
4941    auac2_fields,
4942    12,
4943    NULL,
4944    0,
4945    NULL,
4946    &auac2_validate,
4947  },
4948
4949  {
4950    /* Q_AUAC - ADD_USER_ACCOUNT, v3 */  /* uses prefetch_value() for users_id */
4951    "add_user_account",
4952    "auac",
4953    3,
4954    MR_Q_APPEND,
4955    "u",
4956    USERS_TABLE,
4957    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
4958     * but using up one argv element.
4959     */
4960    "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)",
4961    auac3_fields,
4962    13,
4963    NULL,
4964    0,
4965    NULL,
4966    &auac3_validate,
4967  },
4968
4969  {
4970    /* Q_AUAC - ADD_USER_ACCOUNT, v11 */  /* uses prefetch_value() for users_id */
4971    "add_user_account",
4972    "auac",
4973    11,
4974    MR_Q_APPEND,
4975    "u",
4976    USERS_TABLE,
4977    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
4978     * but using up one argv element.
4979     */
4980    "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)",
4981    auac11_fields,
4982    15,
4983    NULL,
4984    0,
4985    NULL,
4986    &auac11_validate,
4987  },
4988
4989  {
4990    /* Q_AUAC - ADD_USER_ACCOUNT, v12 */  /* uses prefetch_value() for users_id */
4991    "add_user_account",
4992    "auac",
4993    12,
4994    MR_Q_APPEND,
4995    "u",
4996    USERS_TABLE,
4997    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
4998     * but using up one argv element.
4999     */
5000    "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)",
5001    auac12_fields,
5002    18,
5003    NULL,
5004    0,
5005    NULL,
5006    &auac12_validate,
5007  },
5008
5009  {
5010    /* Q_AUAC - ADD_USER_ACCOUNT, v14 */  /* uses prefetch_value() for users_id */
5011    "add_user_account",
5012    "auac",
5013    14,
5014    MR_Q_APPEND,
5015    "u",
5016    USERS_TABLE,
5017    /* We set signature to "NVL(CHR(0), '%s')", which is to say, "CHR(0)",
5018     * but using up one argv element.
5019     */
5020    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, alternate_email, alternate_phone, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', %d, NVL(CHR(0), '%s'), %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
5021    auac_fields,
5022    20,
5023    NULL,
5024    0,
5025    NULL,
5026    &auac_validate,
5027  },
5028
5029  {
5030    /* Q_AUSR - ADD_USER, v2 */  /* uses prefetch_value() for users_id */
5031    "add_user",
5032    "ausr",
5033    2,
5034    MR_Q_APPEND,
5035    "u",
5036    USERS_TABLE,
5037    "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)",
5038    auac2_fields,
5039    9,
5040    0,
5041    0,
5042    NULL,
5043    &ausr2_validate,
5044  },
5045
5046  {
5047    /* Q_AUSR - ADD_USER, v3 */  /* uses prefetch_value() for users_id */
5048    "add_user",
5049    "ausr",
5050    3,
5051    MR_Q_APPEND,
5052    "u",
5053    USERS_TABLE,
5054    "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)",
5055    auac3_fields,
5056    10,
5057    0,
5058    0,
5059    NULL,
5060    &ausr3_validate,
5061  },
5062
5063  {
5064    /* Q_AUSR - ADD_USER, v11 */  /* uses prefetch_value() for users_id */
5065    "add_user",
5066    "ausr",
5067    11,
5068    MR_Q_APPEND,
5069    "u",
5070    USERS_TABLE,
5071    "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)",
5072    auac11_fields,
5073    12,
5074    0,
5075    0,
5076    NULL,
5077    &ausr11_validate,
5078  },
5079
5080  {
5081    /* Q_AUSR - ADD_USER, v12 */  /* uses prefetch_value() for users_id */
5082    "add_user",
5083    "ausr",
5084    12,
5085    MR_Q_APPEND,
5086    "u",
5087    USERS_TABLE,
5088    "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)",
5089    auac12_fields,
5090    15,
5091    0,
5092    0,
5093    NULL,
5094    &ausr12_validate,
5095  },
5096
5097  {
5098    /* Q_AUSR - ADD_USER, v14 */  /* uses prefetch_value() for users_id */
5099    "add_user",
5100    "ausr",
5101    14,
5102    MR_Q_APPEND,
5103    "u",
5104    USERS_TABLE,
5105    "INTO users (login, unix_uid, shell, winconsoleshell, last, first, middle, status, clearid, type, comments, signature, secure, winhomedir, winprofiledir, sponsor_type, sponsor_id, expiration, alternate_email, alternate_phone, users_id, created, creator) VALUES ('%s', %s, '%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, NVL('%s', CHR(0)), '%s', 0, CHR(0), 0, NVL('%s', CHR(0)), NVL('%s', CHR(0)), '%s', %d, NVL('%s', CHR(0)), NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s, SYSDATE, %s)",
5106    auac_fields,
5107    17,
5108    0,
5109    0,
5110    NULL,
5111    &ausr_validate,
5112  },
5113
5114  {
5115    /* Q_RUSR - REGISTER_USER */
5116    "register_user",
5117    "rusr",
5118    2,
5119    MR_Q_APPEND,
5120    0,
5121    0,
5122    0,
5123    rusr_fields,
5124    3,
5125    0,
5126    0,
5127    NULL,
5128    &rusr_validate,
5129  },
5130
5131  {
5132    /* Q_UUAC - UPDATE_USER_ACCOUNT, v2 */
5133    "update_user_account",
5134    "uuac",
5135    2,
5136    MR_Q_UPDATE,
5137    "u",
5138    USERS_TABLE,
5139    /* See comment in auac about signature. */
5140    "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",
5141    uuac2_fields,
5142    12,
5143    "users_id = %d",
5144    1,
5145    NULL,
5146    &uuac2_validate,
5147  },
5148
5149  {
5150    /* Q_UUAC - UPDATE_USER_ACCOUNT, v3 */
5151    "update_user_account",
5152    "uuac",
5153    3,
5154    MR_Q_UPDATE,
5155    "u",
5156    USERS_TABLE,
5157    /* See comment in auac about signature. */
5158    "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",
5159    uuac3_fields,
5160    13,
5161    "users_id = %d",
5162    1,
5163    NULL,
5164    &uuac3_validate,
5165  },
5166
5167  {
5168    /* Q_UUAC - UPDATE_USER_ACCOUNT, v11 */
5169    "update_user_account",
5170    "uuac",
5171    11,
5172    MR_Q_UPDATE,
5173    "u",
5174    USERS_TABLE,
5175    /* See comment in auac about signature. */
5176    "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))",
5177    uuac11_fields,
5178    15,
5179    "users_id = %d",
5180    1,
5181    NULL,
5182    &uuac11_validate,
5183  },
5184
5185  {
5186    /* Q_UUAC - UPDATE_USER_ACCOUNT, v12 */
5187    "update_user_account",
5188    "uuac",
5189    12,
5190    MR_Q_UPDATE,
5191    "u",
5192    USERS_TABLE,
5193    /* See comment in auac about signature. */
5194    "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))",
5195    uuac12_fields,
5196    18,
5197    "users_id = %d",
5198    1,
5199    NULL,
5200    &uuac12_validate,
5201  },
5202
5203  {
5204    /* Q_UUAC - UPDATE_USER_ACCOUNT, v14 */
5205    "update_user_account",
5206    "uuac",
5207    14,
5208    MR_Q_UPDATE,
5209    "u",
5210    USERS_TABLE,
5211    /* See comment in auac about signature. */
5212    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)), type = '%s', comments = %d, signature = NVL(CHR(0), '%s'), secure = %s, winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d, expiration = NVL('%s', CHR(0)), alternate_email = NVL('%s', CHR(0)), alternate_phone = NVL('%s', CHR(0))",
5213    uuac_fields,
5214    20,
5215    "users_id = %d",
5216    1,
5217    NULL,
5218    &uuac_validate,
5219  },
5220
5221  {
5222    /* Q_UUSR - UPDATE_USER, v2 */
5223    "update_user",
5224    "uusr",
5225    2,
5226    MR_Q_UPDATE,
5227    "u",
5228    USERS_TABLE,
5229    "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'",
5230    uuac2_fields,
5231    9,
5232    "users_id = %d",
5233    1,
5234    NULL,
5235    &uusr2_validate,
5236  },
5237
5238  {
5239    /* Q_UUSR - UPDATE_USER, v3 */
5240    "update_user",
5241    "uusr",
5242    3,
5243    MR_Q_UPDATE,
5244    "u",
5245    USERS_TABLE,
5246    "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'",
5247    uuac3_fields,
5248    10,
5249    "users_id = %d",
5250    1,
5251    NULL,
5252    &uusr3_validate,
5253  },
5254
5255  {
5256    /* Q_UUSR - UPDATE_USER, v11 */
5257    "update_user",
5258    "uusr",
5259    11,
5260    MR_Q_UPDATE,
5261    "u",
5262    USERS_TABLE,
5263    "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)) ",
5264    uuac11_fields,
5265    12,
5266    "users_id = %d",
5267    1,
5268    NULL,
5269    &uusr11_validate,
5270  },
5271
5272  {
5273    /* Q_UUSR - UPDATE_USER, v12 */
5274    "update_user",
5275    "uusr",
5276    12,
5277    MR_Q_UPDATE,
5278    "u",
5279    USERS_TABLE,
5280    "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)) ",
5281    uuac12_fields,
5282    15,
5283    "users_id = %d",
5284    1,
5285    NULL,
5286    &uusr12_validate,
5287  },
5288
5289  {
5290    /* Q_UUSR - UPDATE_USER, v14 */
5291    "update_user",
5292    "uusr",
5293    14,
5294    MR_Q_UPDATE,
5295    "u",
5296    USERS_TABLE,
5297    "users SET login = '%s', unix_uid = %s, shell = '%s', winconsoleshell = '%s', last = NVL('%s', CHR(0)), first = NVL('%s', CHR(0)), middle = NVL('%s', CHR(0)), status = %s, clearid = NVL('%s', CHR(0)),  type = '%s', winhomedir = NVL('%s', CHR(0)), winprofiledir = NVL('%s', CHR(0)), sponsor_type = '%s', sponsor_id = %d, expiration = NVL('%s', CHR(0)), alternate_email = NVL('%s', CHR(0)), alternate_phone = NVL('%s', CHR(0)) ",
5298    uuac_fields,
5299    17,
5300    "users_id = %d",
5301    1,
5302    NULL,
5303    &uusr_validate,
5304  },
5305
5306  {
5307    /* Q_UUSH - UPDATE_USER_SHELL */
5308    "update_user_shell",
5309    "uush",
5310    2,
5311    MR_Q_UPDATE,
5312    "u",
5313    USERS_TABLE,
5314    "users SET shell = '%s'",
5315    uush_fields,
5316    1,
5317    "users_id = %d",
5318    1,
5319    NULL,
5320    &uush_validate,
5321  },
5322
5323  {
5324    /* Q_UUWS - UPDATE_USER_WINDOWS_SHELL */
5325    "update_user_windows_shell",
5326    "uuws",
5327    2,
5328    MR_Q_UPDATE,
5329    "u",
5330    USERS_TABLE,
5331    "users SET winconsoleshell = '%s'",
5332    uuws_fields,
5333    1,
5334    "users_id = %d",
5335    1,
5336    NULL,
5337    &uuws_validate,
5338  },
5339
5340  {
5341    /* Q_UUST - UPDATE_USER_STATUS */
5342    "update_user_status",
5343    "uust",
5344    2,
5345    MR_Q_UPDATE,
5346    "u",
5347    USERS_TABLE,
5348    "users SET status = %s",
5349    uust_fields,
5350    1,
5351    "users_id = %d",
5352    1,
5353    NULL,
5354    &uust_validate,
5355  },
5356
5357  {
5358    /* Q_UUSS - UPDATE_USER_SECURITY_STATUS */
5359    "update_user_security_status",
5360    "uuss",
5361    2,
5362    MR_Q_UPDATE,
5363    "u",
5364    USERS_TABLE,
5365    "users SET secure = %s",
5366    uuss_fields,
5367    1,
5368    "users_id = %d",
5369    1,
5370    NULL,
5371    &uust_validate,
5372  },
5373
5374  {
5375    /* Q_DUSR - DELETE_USER */
5376    "delete_user",
5377    "dusr",
5378    2,
5379    MR_Q_DELETE,
5380    "u",
5381    USERS_TABLE,
5382    NULL,
5383    dusr_fields,
5384    0,
5385    "users_id = %d",
5386    1,
5387    NULL,
5388    &dusr_validate,
5389  },
5390
5391  {
5392    /* Q_AURV - ADD_USER_RESERVATION */
5393    "add_user_reservation",
5394    "aurv",
5395    2,
5396    MR_Q_UPDATE,
5397    0,
5398    USERS_TABLE,
5399    0,
5400    aurv_fields,
5401    2,
5402    0,
5403    0,
5404    NULL,
5405    &aurv_validate,
5406  },
5407
5408  {
5409    /* Q_GURV - GET_USER_RESERVATIONS */
5410    "get_user_reservations",
5411    "gurv",
5412    2,
5413    MR_Q_RETRIEVE,
5414    0,
5415    USERS_TABLE,
5416    0,
5417    gurv_fields,
5418    2,
5419    0,
5420    1,
5421    NULL,
5422    &gurv_validate,
5423  },
5424
5425  {
5426    /* Q_GUBR - GET_USER_BY_RESERVATION */
5427    "get_user_by_reservation",
5428    "gubr",
5429    2,
5430    MR_Q_RETRIEVE,
5431    0,
5432    USERS_TABLE,
5433    0,
5434    gubr_fields,
5435    1,
5436    0,
5437    1,
5438    NULL,
5439    &gubr_validate,
5440  },
5441
5442  {
5443    /* Q_DURV - DELETE_USER_RESERVATION */
5444    "delete_user_reservation",
5445    "durv",
5446    2,
5447    MR_Q_UPDATE,
5448    0,
5449    USERS_TABLE,
5450    0,
5451    aurv_fields,
5452    2,
5453    0,
5454    0,
5455    NULL,
5456    &aurv_validate,
5457  },
5458
5459  {
5460    /* Q_GKUM - GET_KERBEROS_USER_MAP */
5461    "get_kerberos_user_map",
5462    "gkum",
5463    2,
5464    MR_Q_RETRIEVE,
5465    "k",
5466    KRBMAP_TABLE,
5467    "u.login, str.string FROM krbmap km, users u, strings str",
5468    gkum_fields,
5469    2,
5470    "u.login LIKE '%s' AND str.string LIKE '%s' AND km.users_id = u.users_id AND km.string_id = str.string_id",
5471    2,
5472    "u.login, str.string",
5473    NULL,
5474  },
5475
5476  {
5477    /* Q_AKUM - ADD_KERBEROS_USER_MAP */
5478    "add_kerberos_user_map",
5479    "akum",
5480    2,
5481    MR_Q_APPEND,
5482    "k",
5483    KRBMAP_TABLE,
5484    "INTO krbmap (users_id, string_id) VALUES (%d, %d)",
5485    akum_fields,
5486    2,
5487    0,
5488    0,
5489    NULL,
5490    &akum_validate,
5491  },
5492
5493  {
5494    /* Q_DKUM - DELETE_KERBEROS_USER_MAP */
5495    "delete_kerberos_user_map",
5496    "dkum",
5497    2,
5498    MR_Q_DELETE,
5499    "k",
5500    KRBMAP_TABLE,
5501    0,
5502    akum_fields,
5503    0,
5504    "users_id = %d AND string_id = %d",
5505    2,
5506    NULL,
5507    &dkum_validate,
5508  },
5509
5510  {
5511    /* Q_GFBL - GET_FINGER_BY_LOGIN */
5512    "get_finger_by_login",
5513    "gfbl",
5514    2,
5515    MR_Q_RETRIEVE,
5516    "u",
5517    USERS_TABLE,
5518    "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",
5519    gfbl_fields,
5520    12,
5521    "users_id = %d",
5522    1,
5523    "login",
5524    &gfbl_validate,
5525  },
5526
5527  {
5528    /* Q_UFBL - UPDATE_FINGER_BY_LOGIN */
5529    "update_finger_by_login",
5530    "ufbl",
5531    2,
5532    MR_Q_UPDATE,
5533    "u",
5534    USERS_TABLE,
5535    "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))",
5536    ufbl_fields,
5537    8,
5538    "users_id = %d",
5539    1,
5540    NULL,
5541    &ufbl_validate,
5542  },
5543
5544  {
5545    /* Q_GPOB - GET_POBOX */
5546    "get_pobox",
5547    "gpob",
5548    2,
5549    MR_Q_RETRIEVE,
5550    "u",
5551    USERS_TABLE,
5552    "login, potype, users_id, CHR(0), TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
5553    gpob_fields,
5554    7,
5555    "users_id = %d",
5556    1,
5557    "login",
5558    &gpob_validate,
5559  },
5560
5561  {
5562    /* Q_GAPO - GET_ALL_POBOXES */
5563    "get_all_poboxes",
5564    "gapo",
5565    2,
5566    MR_Q_RETRIEVE,
5567    "u",
5568    USERS_TABLE,
5569    "login, potype, pop_id || ':' || box_id FROM users",
5570    gpox_fields,
5571    3,
5572    "potype != 'NONE'",
5573    0,
5574    "login",
5575    &gpox_validate,
5576  },
5577
5578  {
5579    /* Q_GPOP - GET_POBOXES_POP */
5580    "get_poboxes_pop",
5581    "gpop",
5582    2,
5583    MR_Q_RETRIEVE,
5584    "u",
5585    USERS_TABLE,
5586    "login, potype, users_id FROM users",
5587    gpox_fields,
5588    3,
5589    "potype = 'POP'",
5590    0,
5591    "login",
5592    &gpox_validate
5593  },
5594
5595  {
5596    /* Q_GPOF - GET_POBOXES_SMTP */
5597    "get_poboxes_smtp",
5598    "gpos",
5599    2,
5600    MR_Q_RETRIEVE,
5601    "u",
5602    USERS_TABLE,
5603    "login, potype, users_id FROM users",
5604    gpox_fields,
5605    3,
5606    "potype = 'SMTP'",
5607    0,
5608    "login",
5609    &gpox_validate
5610  },
5611
5612  {
5613    /* Q_SPOB - SET_POBOX */
5614    "set_pobox",
5615    "spob",
5616    2,
5617    MR_Q_UPDATE,
5618    0,
5619    USERS_TABLE,
5620    0,
5621    spob_fields,
5622    3,
5623    NULL,
5624    0,
5625    NULL,
5626    &spob_validate,
5627  },
5628
5629  {
5630    /* Q_SPOP - SET_POBOX_POP */
5631    "set_pobox_pop",
5632    "spop",
5633    2,
5634    MR_Q_UPDATE,
5635    0,
5636    USERS_TABLE,
5637    0,
5638    spob_fields,
5639    1,
5640    NULL,
5641    0,
5642    NULL,
5643    &spop_validate,
5644  },
5645
5646  {
5647    /* Q_DPOB - DELETE_POBOX */
5648    "delete_pobox",
5649    "dpob",
5650    2,
5651    MR_Q_UPDATE,
5652    "u",
5653    USERS_TABLE,
5654    "users SET potype = 'NONE'",
5655    spob_fields,
5656    0,
5657    "users_id = %d",
5658    1,
5659    NULL,
5660    &dpob_validate,
5661  },
5662
5663  {
5664    /* Q_GHST - GET_HOST, v2 */
5665    "get_host",
5666    "ghst",
5667    2,
5668    MR_Q_RETRIEVE,
5669    "m",
5670    MACHINE_TABLE,
5671    "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",
5672    ghst2_fields,
5673    21,
5674    "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",
5675    4,
5676    "m.name",
5677    &ghst_validate,
5678  },
5679
5680  {
5681    /* Q_GHST - GET_HOST, v6 */
5682    "get_host",
5683    "ghst",
5684    6,
5685    MR_Q_RETRIEVE,
5686    "m",
5687    MACHINE_TABLE,
5688    "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",
5689    ghst6_fields,
5690    22,
5691    "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",
5692    4,
5693    "m.name",
5694    &ghst_validate,
5695  },
5696
5697  {
5698    /* Q_GHST - GET_HOST, v8 */
5699    "get_host",
5700    "ghst",
5701    8,
5702    MR_Q_RETRIEVE,
5703    "m",
5704    MACHINE_TABLE,
5705    "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",
5706    ghst_fields,
5707    23,
5708    "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",
5709    4,
5710    "m.name",
5711    &ghst_validate,
5712  },
5713
5714  {
5715    /* Q_GHBH - GET_HOST_BY_HWADDR, v2 */
5716    "get_host_by_hwaddr",
5717    "ghbh",
5718    2,
5719    MR_Q_RETRIEVE,
5720    "m",
5721    MACHINE_TABLE,
5722    "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",
5723    ghbh2_fields,
5724    21,
5725    "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
5726    1,
5727    "m.name",
5728    &ghst_validate,
5729  },
5730
5731  {
5732    /* Q_GHBH - GET_HOST_BY_HWADDR, v6 */
5733    "get_host_by_hwaddr",
5734    "ghbh",
5735    6,
5736    MR_Q_RETRIEVE,
5737    "m",
5738    MACHINE_TABLE,
5739    "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",
5740    ghbh6_fields,
5741    22,
5742    "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
5743    1,
5744    "m.name",
5745    &ghst_validate,
5746  },
5747
5748  {
5749    /* Q_GHBH - GET_HOST_BY_HWADDR, v8 */
5750    "get_host_by_hwaddr",
5751    "ghbh",
5752    8,
5753    MR_Q_RETRIEVE,
5754    "m",
5755    MACHINE_TABLE,
5756    "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",
5757    ghbh_fields,
5758    23,
5759    "m.hwaddr LIKE LOWER('%s') AND m.mach_id != 0 AND s.snet_id = m.snet_id",
5760    1,
5761    "m.name",
5762    &ghst_validate,
5763  },
5764
5765  {
5766    /* Q_GHBA - GET_HOST_BY_ACCOUNT_NUMBER, v8 */
5767    "get_host_by_account_number",
5768    "ghba",
5769    8,
5770    MR_Q_RETRIEVE,
5771    "m",
5772    MACHINE_TABLE,
5773    "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",   
5774    ghba_fields,
5775    23,
5776    "m.account_number LIKE '%s' AND m.mach_id != 0 and s.snet_id = m.snet_id",
5777    1,
5778    "m.name",
5779    &ghst_validate,
5780  },
5781
5782  {
5783    /* Q_GHHA - GET_HOST_HWADDR */
5784    "get_host_hwaddr",
5785    "ghha",
5786    2,
5787    MR_Q_RETRIEVE,
5788    "m",
5789    MACHINE_TABLE,
5790    "m.hwaddr FROM machine m",
5791    ghha_fields,
5792    1,
5793    "m.name LIKE UPPER('%s')",
5794    1,
5795    NULL,
5796    NULL,
5797  },
5798
5799  {
5800    /* Q_AHST - ADD_HOST, v2 */ /* uses prefetch_value() for mach_id */
5801    "add_host",
5802    "ahst",
5803    2,
5804    MR_Q_APPEND,
5805    "m",
5806    MACHINE_TABLE,
5807    "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)",
5808    ahst2_fields,
5809    14,
5810    0,
5811    0,
5812    NULL,
5813    &ahst2_validate,
5814  },
5815
5816  {
5817    /* Q_AHST - ADD_HOST, v6 */ /* uses prefetch_value() for mach_id */
5818    "add_host",
5819    "ahst",
5820    6,
5821    MR_Q_APPEND,
5822    "m",
5823    MACHINE_TABLE,
5824    "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)",
5825    ahst6_fields,
5826    15,
5827    0,
5828    0,
5829    NULL,
5830    &ahst6_validate,
5831  },
5832
5833  {
5834    /* Q_AHST - ADD_HOST, v8 */ /* Uses prefetch_value() for mach_id */
5835    "add_host",
5836    "ahst",
5837    8,
5838    MR_Q_APPEND,
5839    "m",
5840    MACHINE_TABLE,
5841    "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)",
5842    ahst_fields,
5843    16,
5844    0,
5845    0,
5846    NULL,
5847    &ahst_validate,
5848  },
5849
5850  {
5851    /* Q_UHST - UPDATE_HOST, v2 */
5852    "update_host",
5853    "uhst",
5854    2,
5855    MR_Q_UPDATE,
5856    "m",
5857    MACHINE_TABLE,
5858    "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",
5859    uhst2_fields,
5860    14,
5861    "mach_id = %d",
5862    1,
5863    NULL,
5864    &uhst2_validate,
5865  },
5866
5867  {
5868    /* Q_UHST - UPDATE_HOST, v6 */
5869    "update_host",
5870    "uhst",
5871    6,
5872    MR_Q_UPDATE,
5873    "m",
5874    MACHINE_TABLE,
5875    "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",
5876    uhst6_fields,
5877    15,
5878    "mach_id = %d",
5879    1,
5880    NULL,
5881    &uhst6_validate,
5882  },
5883
5884  {
5885    /* Q_UHST - UPDATE_HOST, v8 */
5886    "update_host",
5887    "uhst",
5888    8,
5889    MR_Q_UPDATE,
5890    "m",
5891    MACHINE_TABLE,
5892    "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",
5893    uhst_fields,
5894    16,
5895    "mach_id = %d",
5896    1,
5897    NULL,
5898    &uhst_validate,
5899  },
5900
5901  {
5902    /* Q_UHHA - UPDATE_HOST_HWADDR */
5903    "update_host_hwaddr",
5904    "uhha",
5905    2,
5906    MR_Q_UPDATE,
5907    "m",
5908    MACHINE_TABLE,
5909    "machine SET hwaddr = NVL('%s', CHR(0))",
5910    uhha_fields,
5911    1,
5912    "mach_id = %d",
5913    1,
5914    NULL,
5915    &uhha_validate,
5916  },
5917
5918  {
5919    /* Q_DHST - DELETE_HOST */
5920    "delete_host",
5921    "dhst",
5922    2,
5923    MR_Q_DELETE,
5924    "m",
5925    MACHINE_TABLE,
5926    NULL,
5927    dhst_fields,
5928    0,
5929    "mach_id = %d",
5930    1,
5931    NULL,
5932    &dhst_validate,
5933  },
5934
5935  {
5936    /* Q_GMAC - GET_MACHINE */
5937    "get_machine",
5938    "gmac",
5939    2,
5940    MR_Q_RETRIEVE,
5941    "m",
5942    MACHINE_TABLE,
5943    "name, vendor, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM machine",
5944    gmac_fields,
5945    5,
5946    "name LIKE UPPER('%s') AND mach_id != 0",
5947    1,
5948    "name",
5949    &VDfix_modby,
5950  },
5951
5952  {
5953    /* Q_GHAL - GET_HOSTALIAS */
5954    "get_hostalias",
5955    "ghal",
5956    2,
5957    MR_Q_RETRIEVE,
5958    "a",
5959    HOSTALIAS_TABLE,
5960    "a.name, m.name FROM hostalias a, machine m",
5961    ghal_fields,
5962    2,
5963    "m.mach_id = a.mach_id and a.name LIKE UPPER('%s') AND m.name LIKE UPPER('%s')",
5964    2,
5965    "a.name",
5966    &ghal_validate,
5967  },
5968
5969  {
5970    /* Q_AHAL - ADD_HOSTALIAS */
5971    "add_hostalias",
5972    "ahal",
5973    2,
5974    MR_Q_APPEND,
5975    "a",
5976    HOSTALIAS_TABLE,
5977    "INTO hostalias (name, mach_id) VALUES (UPPER('%s'), %d)",
5978    ghal_fields,
5979    2,
5980    0,
5981    0,
5982    NULL,
5983    &ahal_validate,
5984  },
5985
5986  {
5987    /* Q_DHAL - DELETE_HOSTALIAS */
5988    "delete_hostalias",
5989    "dhal",
5990    2,
5991    MR_Q_DELETE,
5992    "a",
5993    HOSTALIAS_TABLE,
5994    NULL,
5995    ghal_fields,
5996    0,
5997    "name = UPPER('%s') AND mach_id = %d",
5998    2,
5999    NULL,
6000    &dhal_validate,
6001  },
6002
6003  {
6004    /* Q_GSNT - GET_SUBNET, v2 */
6005    "get_subnet",
6006    "gsnt",
6007    2,
6008    MR_Q_RETRIEVE,
6009    "s",
6010    SUBNET_TABLE,
6011    "name, description, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
6012    gsnt2_fields,
6013    12,
6014    "name LIKE UPPER('%s')",
6015    1,
6016    "name",
6017    &gsnt_validate,
6018  },
6019
6020  {
6021    /* Q_GSNT - GET_SUBNET, v8 */
6022    "get_subnet",
6023    "gsnt",
6024    8,
6025    MR_Q_RETRIEVE,
6026    "s",
6027    SUBNET_TABLE,
6028    "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",
6029    gsnt_fields,
6030    15,
6031    "name LIKE UPPER('%s')",
6032    1,
6033    "name",
6034    &gsnt_validate,
6035  },
6036
6037  {
6038    /* Q_ASNT - ADD_SUBNET, v2 */
6039    "add_subnet",
6040    "asnt",
6041    2,
6042    MR_Q_APPEND,
6043    "s",
6044    SUBNET_TABLE,
6045    "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)",
6046    asnt2_fields,
6047    9,
6048    0,
6049    0,
6050    NULL,
6051    &asnt2_validate,
6052  },
6053
6054  {
6055    /* Q_ASNT - ADD_SUBNET, v8 */
6056    "add_subnet",
6057    "asnt",
6058    8,
6059    MR_Q_APPEND,
6060    "s",
6061    SUBNET_TABLE,
6062    "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)",
6063    asnt_fields,
6064    12,
6065    0,
6066    0,
6067    NULL,
6068    &asnt_validate,
6069  },
6070
6071  {
6072    /* Q_USNT - UPDATE_SUBNET, v2 */
6073    "update_subnet",
6074    "usnt",
6075    2,
6076    MR_Q_UPDATE,
6077    "s",
6078    SUBNET_TABLE,
6079    "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",
6080    usnt2_fields,
6081    9,
6082    "snet_id = %d",
6083    1,
6084    NULL,
6085    &usnt2_validate,
6086  },
6087
6088  {
6089    /* Q_USNT - UPDATE_SUBNET, v8 */
6090    "update_subnet",
6091    "usnt",
6092    8,
6093    MR_Q_UPDATE,
6094    "s",
6095    SUBNET_TABLE,
6096    "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",
6097    usnt_fields,
6098    12,
6099    "snet_id = %d",
6100    1,
6101    NULL,
6102    &usnt_validate,
6103  },
6104
6105  {
6106    /* Q_DSNT - DELETE_SUBNET */
6107    "delete_subnet",
6108    "dsnt",
6109    2,
6110    MR_Q_DELETE,
6111    "s",
6112    SUBNET_TABLE,
6113    NULL,
6114    dsnt_fields,
6115    0,
6116    "snet_id = %d",
6117    1,
6118    NULL,
6119    &dsnt_validate,
6120  },
6121
6122  {
6123    /* Q_GCLU - GET_CLUSTER */
6124    "get_cluster",
6125    "gclu",
6126    2,
6127    MR_Q_RETRIEVE,
6128    "c",
6129    CLUSTERS_TABLE,
6130    "name, description, location, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM clusters",
6131    gclu_fields,
6132    6,
6133    "name LIKE '%s' AND clu_id != 0",
6134    1,
6135    "name",
6136    &VDfix_modby,
6137  },
6138
6139  {
6140    /* Q_ACLU - ADD_CLUSTER */ /* uses prefetch_value() for clu_id */
6141    "add_cluster",
6142    "aclu",
6143    2,
6144    MR_Q_APPEND,
6145    "c",
6146    CLUSTERS_TABLE,
6147    "INTO clusters (name, description, location, clu_id) VALUES ('%s', NVL('%s', CHR(0)), NVL('%s', CHR(0)), %s)",
6148    aclu_fields,
6149    3,
6150    0,
6151    0,
6152    NULL,
6153    &aclu_validate,
6154  },
6155
6156  {
6157    /* Q_UCLU - UPDATE_CLUSTER */
6158    "update_cluster",
6159    "uclu",
6160    2,
6161    MR_Q_UPDATE,
6162    "c",
6163    CLUSTERS_TABLE,
6164    "clusters SET name = '%s', description = NVL('%s', CHR(0)), location = NVL('%s', CHR(0))",
6165    uclu_fields,
6166    3,
6167    "clu_id = %d",
6168    1,
6169    NULL,
6170    &uclu_validate,
6171  },
6172
6173  {
6174    /* Q_DCLU - DELETE_CLUSTER */
6175    "delete_cluster",
6176    "dclu",
6177    2,
6178    MR_Q_DELETE,
6179    "c",
6180    CLUSTERS_TABLE,
6181    NULL,
6182    dclu_fields,
6183    0,
6184    "clu_id = %d",
6185    1,
6186    NULL,
6187    &dclu_validate,
6188  },
6189
6190  {
6191    /* Q_GMCM - GET_MACHINE_TO_CLUSTER_MAP */
6192    "get_machine_to_cluster_map",
6193    "gmcm",
6194    2,
6195    MR_Q_RETRIEVE,
6196    "mcm",
6197    MCMAP_TABLE,
6198    "m.name, c.name FROM machine m, clusters c, mcmap mcm",
6199    gmcm_fields,
6200    2,
6201    "m.name LIKE UPPER('%s') AND c.name LIKE '%s' AND mcm.clu_id = c.clu_id AND mcm.mach_id = m.mach_id",
6202    2,
6203    "m.name",
6204    NULL,
6205  },
6206
6207  {
6208    /* Q_AMTC - ADD_MACHINE_TO_CLUSTER */
6209    "add_machine_to_cluster",
6210    "amtc",
6211    2,
6212    MR_Q_APPEND,
6213    "mcm",
6214    MCMAP_TABLE,
6215    "INTO mcmap (mach_id, clu_id) VALUES (%d, %d)",
6216    gmcm_fields,
6217    2,
6218    0,
6219    0,
6220    NULL,
6221    &amtc_validate,
6222  },
6223
6224  {
6225    /* Q_DMFC - DELETE_MACHINE_FROM_CLUSTER */
6226    "delete_machine_from_cluster",
6227    "dmfc",
6228    2,
6229    MR_Q_DELETE,
6230    "mcm",
6231    MCMAP_TABLE,
6232    0,
6233    gmcm_fields,
6234    0,
6235    "mach_id = %d AND clu_id = %d",
6236    2,
6237    NULL,
6238    &amtc_validate,
6239  },
6240
6241  {
6242    /* Q_GCLD - GET_CLUSTER_DATA */
6243    "get_cluster_data",
6244    "gcld",
6245    2,
6246    MR_Q_RETRIEVE,
6247    "svc",
6248    SVC_TABLE,
6249    "c.name, svc.serv_label, svc.serv_cluster FROM svc svc, clusters c",
6250    gcld_fields,
6251    3,
6252    "c.clu_id = svc.clu_id AND c.name LIKE '%s' AND svc.serv_label LIKE '%s'",
6253    2,
6254    "c.name, svc.serv_label",
6255    NULL,
6256  },
6257
6258  {
6259    /* Q_ACLD - ADD_CLUSTER_DATA */
6260    "add_cluster_data",
6261    "acld",
6262    2,
6263    MR_Q_APPEND,
6264    "svc",
6265    SVC_TABLE,
6266    "INTO svc (clu_id, serv_label, serv_cluster) VALUES (%d, '%s', '%s')",
6267    acld_fields,
6268    3,
6269    NULL,
6270    0,
6271    NULL,
6272    &acld_validate,
6273  },
6274
6275  {
6276    /* Q_DCLD - DELETE_CLUSTER_DATA */
6277    "delete_cluster_data",
6278    "dcld",
6279    2,
6280    MR_Q_DELETE,
6281    "svc",
6282    SVC_TABLE,
6283    NULL,
6284    acld_fields,
6285    0,
6286    "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
6287    3,
6288    NULL,
6289    &dcld_validate,
6290  },
6291
6292  {
6293    /* Q_GLIN - GET_LIST_INFO, v2 */
6294    "get_list_info",
6295    "glin",
6296    2,
6297    MR_Q_RETRIEVE,
6298    "l",
6299    LIST_TABLE,
6300    "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",
6301    glin2_fields,
6302    13,
6303    "name LIKE '%s'",
6304    1,
6305    "name",
6306    &glin_validate,
6307  },
6308
6309  {
6310    /* Q_GLIN - GET_LIST_INFO, v3 */
6311    "get_list_info",
6312    "glin",
6313    3,
6314    MR_Q_RETRIEVE,
6315    "l",
6316    LIST_TABLE,
6317    "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",
6318    glin3_fields,
6319    14,
6320    "name LIKE '%s'",
6321    1,
6322    "name",
6323    &glin_validate,
6324  },
6325
6326  {
6327    /* Q_GLIN - GET_LIST_INFO, v4 */
6328    "get_list_info",
6329    "glin",
6330    4,
6331    MR_Q_RETRIEVE,
6332    "l",
6333    LIST_TABLE,
6334    "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",
6335    glin4_fields,
6336    16,
6337    "name LIKE '%s'",
6338    1,
6339    "name",
6340    &glin_validate,
6341  },
6342
6343  {
6344    /* Q_GLIN - GET_LIST_INFO, v10 */
6345    "get_list_info",
6346    "glin",
6347    10,
6348    MR_Q_RETRIEVE,
6349    "l",
6350    LIST_TABLE,
6351    "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",
6352    glin_fields,
6353    18,
6354    "l.name LIKE '%s' AND m.mach_id = l.mailman_id",
6355    1,
6356    "l.name",
6357    &glin_validate,
6358  },
6359
6360  {
6361    /* Q_EXLN - EXPAND_LIST_NAMES */
6362    "expand_list_names",
6363    "exln",
6364    2,
6365    MR_Q_RETRIEVE,
6366    "l",
6367    LIST_TABLE,
6368    "name FROM list",
6369    glin_fields,
6370    1,
6371    "name LIKE '%s' AND list_id != 0",
6372    1,
6373    "name",
6374    NULL,
6375  },
6376
6377  {
6378    /* Q_ALIS - ADD_LIST, v2 */ /* uses prefetch_value() for list_id */
6379    "add_list",
6380    "alis",
6381    2,
6382    MR_Q_APPEND,
6383    "l",
6384    LIST_TABLE,
6385    "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)",
6386    alis2_fields,
6387    10,
6388    0,
6389    0,
6390    NULL,
6391    &alis2_validate,
6392  },
6393
6394  {
6395    /* Q_ALIS - ADD_LIST, v3 */ /* uses prefetch_value() for list_id */
6396    "add_list",
6397    "alis",
6398    3,
6399    MR_Q_APPEND,
6400    "l",
6401    LIST_TABLE,
6402    "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)",
6403    alis3_fields,
6404    11,
6405    0,
6406    0,
6407    NULL,
6408    &alis3_validate,
6409  },
6410
6411  {
6412    /* Q_ALIS - ADD_LIST, v4 */ /* uses prefetch_value() for list_id */
6413    "add_list",
6414    "alis",
6415    4,
6416    MR_Q_APPEND,
6417    "l",
6418    LIST_TABLE,
6419    "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)",
6420    alis4_fields,
6421    13,
6422    0,
6423    0,
6424    NULL,
6425    &alis4_validate,
6426  },
6427
6428  {
6429    /* Q_ALIS - ADD_LIST, v10 */ /* uses prefetch_value() for list_id */
6430    "add_list",
6431    "alis",
6432    10,
6433    MR_Q_APPEND,
6434    "l",
6435    LIST_TABLE,
6436    "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)",
6437    alis_fields,
6438    15,
6439    0,
6440    0,
6441    NULL,
6442    &alis_validate,
6443  },
6444
6445  {
6446    /* Q_ULIS - UPDATE_LIST, v2 */
6447    "update_list",
6448    "ulis",
6449    2,
6450    MR_Q_UPDATE,
6451    "l",
6452    LIST_TABLE,
6453    "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))",
6454    ulis2_fields,
6455    10,
6456    "list_id = %d",
6457    1,
6458    NULL,
6459    &ulis2_validate,
6460  },
6461
6462  {
6463    /* Q_ULIS - UPDATE_LIST, v3 */
6464    "update_list",
6465    "ulis",
6466    3,
6467    MR_Q_UPDATE,
6468    "l",
6469    LIST_TABLE,
6470    "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))",
6471    ulis3_fields,
6472    11,
6473    "list_id = %d",
6474    1,
6475    NULL,
6476    &ulis3_validate,
6477  },
6478
6479  {
6480    /* Q_ULIS, UPDATE_LIST, v4 */
6481    "update_list",
6482    "ulis",
6483    4,
6484    MR_Q_UPDATE,
6485    "l",
6486    LIST_TABLE,
6487    "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))",
6488    ulis4_fields,
6489    13,
6490    "list_id = %d",
6491    1,
6492    NULL,
6493    &ulis4_validate,
6494  },
6495
6496  {
6497    /* Q_ULIS, UPDATE_LIST, v10 */
6498    "update_list",
6499    "ulis",
6500    10,
6501    MR_Q_UPDATE,
6502    "l",
6503    LIST_TABLE,
6504    "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))",
6505    ulis_fields,
6506    15,
6507    "list_id = %d",
6508    1,
6509    NULL,
6510    &ulis_validate,
6511  },
6512
6513  {
6514    /* Q_DLIS - DELETE_LIST */
6515    "delete_list",
6516    "dlis",
6517    2,
6518    MR_Q_DELETE,
6519    "l",
6520    LIST_TABLE,
6521    NULL,
6522    dlis_fields,
6523    0,
6524    "list_id = %d",
6525    1,
6526    NULL,
6527    &dlis_validate,
6528  },
6529
6530  {
6531    /* Q_AMTL - ADD_MEMBER_TO_LIST */
6532    "add_member_to_list",
6533    "amtl",
6534    2,
6535    MR_Q_APPEND,
6536    0,
6537    IMEMBERS_TABLE,
6538    0,
6539    amtl_fields,
6540    3,
6541    NULL,
6542    0,
6543    NULL,
6544    &amtl_validate,
6545  },
6546
6547  {
6548    /* Q_ATML - ADD_TAGGED_MEMBER_TO_LIST */
6549    "add_tagged_member_to_list",
6550    "atml",
6551    2,
6552    MR_Q_APPEND,
6553    0,
6554    IMEMBERS_TABLE,
6555    0,
6556    atml_fields,
6557    4,
6558    NULL,
6559    0,
6560    NULL,
6561    &atml_validate,
6562  },
6563
6564  {
6565    /* Q_TMOL - TAG_MEMBER_OF_LIST */
6566    "tag_member_of_list",
6567    "tmol",
6568    2,
6569    MR_Q_UPDATE,
6570    0,
6571    IMEMBERS_TABLE,
6572    0,
6573    atml_fields,
6574    1,
6575    0,
6576    3,
6577    NULL,
6578    &tmol_validate,
6579  },
6580
6581  {
6582    /* Q_DMFL - DELETE_MEMBER_FROM_LIST */
6583    "delete_member_from_list",
6584    "dmfl",
6585    2,
6586    MR_Q_DELETE,
6587    0,
6588    IMEMBERS_TABLE,
6589    NULL,
6590    amtl_fields,
6591    0,
6592    0,
6593    3,
6594    NULL,
6595    &dmfl_validate,
6596  },
6597
6598  {
6599    /* Q_GAUS - GET_ACE_USE */
6600    "get_ace_use",
6601    "gaus",
6602    2,
6603    MR_Q_RETRIEVE,
6604    0,
6605    0,
6606    0,
6607    gaus_fields,
6608    2,
6609    0,
6610    2,
6611    NULL,
6612    &gaus_validate,
6613  },
6614
6615  {
6616    /* Q_GHBO - GET_HOST_BY_OWNER */
6617    "get_host_by_owner",
6618    "ghbo",
6619    2,
6620    MR_Q_RETRIEVE,
6621    0,
6622    0,
6623    0,
6624    ghbo_fields,
6625    1,
6626    0,
6627    2,
6628    NULL,
6629    &ghbo_validate,
6630  },
6631
6632  {
6633    /* Q_QGLI - QUALIFIED_GET_LISTS */
6634    "qualified_get_lists",
6635    "qgli",
6636    2,
6637    MR_Q_RETRIEVE,
6638    0,
6639    LIST_TABLE,
6640    0,
6641    qgli_fields,
6642    1,
6643    0,
6644    5,
6645    NULL,
6646    &qgli_validate,
6647  },
6648
6649  {
6650    /* Q_GMOL - GET_MEMBERS_OF_LIST */
6651    "get_members_of_list",
6652    "gmol",
6653    2,
6654    MR_Q_RETRIEVE,
6655    NULL,
6656    IMEMBERS_TABLE,
6657    NULL,
6658    gmol_fields,
6659    2,
6660    NULL,
6661    1,
6662    NULL,
6663    &gmol_validate,
6664  },
6665
6666  {
6667    /* Q_GEML - GET_END_MEMBERS_OF_LIST */
6668    "get_end_members_of_list",
6669    "geml",
6670    2,
6671    MR_Q_RETRIEVE,
6672    NULL,
6673    IMEMBERS_TABLE,
6674    NULL,
6675    gmol_fields,
6676    2,
6677    NULL,
6678    1,
6679    NULL,
6680    &gmol_validate,
6681  },
6682
6683  {
6684    /* Q_GTML - GET_TAGGED_MEMBERS_OF_LIST */
6685    "get_tagged_members_of_list",
6686    "gtml",
6687    2,
6688    MR_Q_RETRIEVE,
6689    NULL,
6690    IMEMBERS_TABLE,
6691    NULL,
6692    gtml_fields,
6693    3,
6694    NULL,
6695    1,
6696    NULL,
6697    &gmol_validate,
6698  },
6699
6700  {
6701    /* Q_GLOM - GET_LISTS_OF_MEMBER */
6702    "get_lists_of_member",
6703    "glom",
6704    2,
6705    MR_Q_RETRIEVE,
6706    0,
6707    IMEMBERS_TABLE,
6708    0,
6709    glom_fields,
6710    6,
6711    0,
6712    2,
6713    NULL,
6714    &glom_validate,
6715  },
6716
6717  {
6718    /* Q_CMOL - COUNT_MEMBERS_OF_LIST */
6719    "count_members_of_list",
6720    "cmol",
6721    2,
6722    MR_Q_RETRIEVE,
6723    0,
6724    IMEMBERS_TABLE,
6725    0,
6726    cmol_fields,
6727    1,
6728    0,
6729    1,
6730    NULL,
6731    &cmol_validate,
6732  },
6733
6734  {
6735    /* Q_GSIN - GET_SERVER_INFO */
6736    "get_server_info",
6737    "gsin",
6738    2,
6739    MR_Q_RETRIEVE,
6740    "s",
6741    SERVERS_TABLE,
6742    "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",
6743    gsin_fields,
6744    16,
6745    "name LIKE UPPER('%s')",
6746    1,
6747    "name",
6748    &gsin_validate,
6749  },
6750
6751  {
6752    /* Q_QGSV - QUALIFIED_GET_SERVER */
6753    "qualified_get_server",
6754    "qgsv",
6755    2,
6756    MR_Q_RETRIEVE,
6757    0,
6758    SERVERS_TABLE,
6759    0,
6760    qgsv_fields,
6761    1,
6762    0,
6763    3,
6764    NULL,
6765    &qgsv_validate,
6766  },
6767
6768  {
6769    /* Q_ASIN - ADD_SERVER_INFO */
6770    "add_server_info",
6771    "asin",
6772    2,
6773    MR_Q_APPEND,
6774    "s",
6775    SERVERS_TABLE,
6776    "INTO servers (name, update_int, target_file, script, type, enable, acl_type, acl_id) VALUES (UPPER('%s'), %s, '%s', '%s', '%s', %s, '%s', %d)",
6777    asin_fields,
6778    8,
6779    NULL,
6780    0,
6781    NULL,
6782    &asin_validate,
6783  },
6784
6785  {
6786    /* Q_USIN - UPDATE_SERVER_INFO */
6787    "update_server_info",
6788    "usin",
6789    2,
6790    MR_Q_UPDATE,
6791    "s",
6792    SERVERS_TABLE,
6793    "servers SET update_int = %s, target_file = '%s', script = '%s', type = '%s', enable = %s, acl_type = '%s', acl_id = %d",
6794    asin_fields,
6795    7,
6796    "name = UPPER('%s')",
6797    1,
6798    NULL,
6799    &asin_validate,
6800  },
6801
6802  {
6803    /* Q_RSVE - RESET_SERVER_ERROR */
6804    "reset_server_error",
6805    "rsve",
6806    2,
6807    MR_Q_UPDATE,
6808    "s",
6809    SERVERS_TABLE,
6810    "servers SET harderror = 0, dfcheck = dfgen",
6811    dsin_fields,
6812    0,
6813    "name = UPPER('%s')",
6814    1,
6815    NULL,
6816    &rsve_validate,
6817  },
6818
6819  {
6820    /* Q_SSIF - SET_SERVER_INTERNAL_FLAGS */
6821    "set_server_internal_flags",
6822    "ssif",
6823    2,
6824    MR_Q_UPDATE,
6825    "s",
6826    SERVERS_TABLE,
6827    "servers SET dfgen = %s, dfcheck = %s, inprogress = %s, harderror = %s, errmsg = NVL('%s', CHR(0))",
6828    ssif_fields,
6829    5,
6830    "name = UPPER('%s')",
6831    1,
6832    NULL,
6833    &ssif_validate,
6834  },
6835
6836  {
6837    /* Q_DSIN - DELETE_SERVER_INFO */
6838    "delete_server_info",
6839    "dsin",
6840    2,
6841    MR_Q_DELETE,
6842    "s",
6843    SERVERS_TABLE,
6844    NULL,
6845    dsin_fields,
6846    0,
6847    "name = UPPER('%s')",
6848    1,
6849    NULL,
6850    &dsin_validate,
6851  },
6852
6853  {
6854    /* Q_GSHI - GET_SERVER_HOST_INFO */
6855    "get_server_host_info",
6856    "gshi",
6857    2,
6858    MR_Q_RETRIEVE,
6859    "sh",
6860    SERVERHOSTS_TABLE,
6861    "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",
6862    gshi_fields,
6863    16,
6864    "sh.service LIKE UPPER('%s') AND m.name LIKE UPPER('%s') AND m.mach_id = sh.mach_id",
6865    2,
6866    "sh.service, m.name",
6867    &gshi_validate,
6868  },
6869
6870  {
6871    /* Q_QGSH - QUALIFIED_GET_SERVER_HOST */
6872    "qualified_get_server_host",
6873    "qgsh",
6874    2,
6875    MR_Q_RETRIEVE,
6876    0,
6877    SERVERHOSTS_TABLE,
6878    0,
6879    qgsh_fields,
6880    2,
6881    0,
6882    6,
6883    NULL,
6884    &qgsh_validate,
6885  },
6886
6887  {
6888    /* Q_ASHI - ADD_SERVER_HOST_INFO */
6889    "add_server_host_info",
6890    "ashi",
6891    2,
6892    MR_Q_APPEND,
6893    "sh",
6894    SERVERHOSTS_TABLE,
6895    "INTO serverhosts (service, mach_id, enable, value1, value2, value3) VALUES (UPPER('%s'), %d, %s, %s, %s, NVL('%s', CHR(0)))",
6896    ashi_fields,
6897    6,
6898    NULL,
6899    0,
6900    NULL,
6901    &ashi_validate,
6902  },
6903
6904  {
6905    /* Q_USHI - UPDATE_SERVER_HOST_INFO */
6906    "update_server_host_info",
6907    "ushi",
6908    2,
6909    MR_Q_UPDATE,
6910    "sh",
6911    SERVERHOSTS_TABLE,
6912    "serverhosts SET enable = %s, value1 = %s, value2 = %s, value3 = NVL('%s', CHR(0))",
6913    ashi_fields,
6914    4,
6915    "service = UPPER('%s') AND mach_id = %d",
6916    2,
6917    NULL,
6918    &ashi_validate,
6919  },
6920
6921  {
6922    /* Q_RSHE - RESET_SERVER_HOST_ERROR */
6923    "reset_server_host_error",
6924    "rshe",
6925    2,
6926    MR_Q_UPDATE,
6927    "sh",
6928    SERVERHOSTS_TABLE,
6929    "serverhosts SET hosterror = 0",
6930    dshi_fields,
6931    0,
6932    "service = UPPER('%s') AND mach_id = %d",
6933    2,
6934    NULL,
6935    &rshe_validate,
6936  },
6937
6938  {
6939    /* Q_SSHO - SET_SERVER_HOST_OVERRIDE */
6940    "set_server_host_override",
6941    "ssho",
6942    2,
6943    MR_Q_UPDATE,
6944    "sh",
6945    SERVERHOSTS_TABLE,
6946    "serverhosts SET override = 1",
6947    dshi_fields,
6948    0,
6949    "service = UPPER('%s') AND mach_id = %d",
6950    2,
6951    NULL,
6952    &ssho_validate,
6953  },
6954
6955  {
6956    /* Q_SSHI - SET_SERVER_HOST_INTERNAL */
6957    "set_server_host_internal",
6958    "sshi",
6959    2,
6960    MR_Q_UPDATE,
6961    "s",
6962    SERVERHOSTS_TABLE,
6963    "serverhosts SET override = %s, success = %s, inprogress = %s, hosterror = %s, hosterrmsg = NVL('%s', CHR(0)), ltt = %s, lts = %s",
6964    sshi_fields,
6965    7,
6966    "service = UPPER('%s') AND mach_id = %d",
6967    2,
6968    NULL,
6969    &sshi_validate,
6970  },
6971
6972  {
6973    /* Q_DSHI - DELETE_SERVER_HOST_INFO */
6974    "delete_server_host_info",
6975    "dshi",
6976    2,
6977    MR_Q_DELETE,
6978    "sh",
6979    SERVERHOSTS_TABLE,
6980    NULL,
6981    dshi_fields,
6982    0,
6983    "service = UPPER('%s') AND mach_id = %d",
6984    2,
6985    NULL,
6986    &dshi_validate,
6987  },
6988
6989  {
6990    /* Q_GSLO - GET_SERVER_LOCATIONS */
6991    "get_server_locations",
6992    "gslo",
6993    2,
6994    MR_Q_RETRIEVE,
6995    "sh",
6996    SERVERHOSTS_TABLE,
6997    "sh.service, m.name FROM serverhosts sh, machine m",
6998    gslo_fields,
6999    2,
7000    "sh.service LIKE UPPER('%s') AND sh.mach_id = m.mach_id",
7001    1,
7002    "sh.service, m.name",
7003    NULL,
7004  },
7005
7006  {
7007    /* Q_GFSL - GET_FILESYS_BY_LABEL */
7008    "get_filesys_by_label",
7009    "gfsl",
7010    2,
7011    MR_Q_RETRIEVE,
7012    "fs",
7013    FILESYS_TABLE,
7014    "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",
7015    gfsl_fields,
7016    14,
7017    "fs.label LIKE '%s' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
7018    1,
7019    "fs.label",
7020    &gfsl_validate,
7021  },
7022
7023  {
7024    /* Q_GFSM - GET_FILESYS_BY_MACHINE */
7025    "get_filesys_by_machine",
7026    "gfsm",
7027    2,
7028    MR_Q_RETRIEVE,
7029    "fs",
7030    FILESYS_TABLE,
7031    "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",
7032    gfsm_fields,
7033    14,
7034    "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
7035    1,
7036    "fs.label",
7037    &gfsm_validate,
7038  },
7039
7040  {
7041    /* Q_GFSN - GET_FILESYS_BY_NFSPHYS */
7042    "get_filesys_by_nfsphys",
7043    "gfsn",
7044    2,
7045    MR_Q_RETRIEVE,
7046    "fs",
7047    FILESYS_TABLE,
7048    "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",
7049    gfsn_fields,
7050    14,
7051    "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id AND np.nfsphys_id = fs.phys_id AND np.dir LIKE '%s'",
7052    2,
7053    "fs.label",
7054    &gfsn_validate,
7055  },
7056
7057  {
7058    /* Q_GFSG - GET_FILESYS_BY_GROUP */
7059    "get_filesys_by_group",
7060    "gfsg",
7061    2,
7062    MR_Q_RETRIEVE,
7063    "fs",
7064    FILESYS_TABLE,
7065    "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",
7066    gfsg_fields,
7067    14,
7068    "fs.owners = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
7069    1,
7070    "fs.label",
7071    &gfsg_validate,
7072  },
7073
7074  {
7075    /* Q_GFSP - GET_FILESYS_BY_PATH */
7076    "get_filesys_by_path",
7077    "gfsp",
7078    2,
7079    MR_Q_RETRIEVE,
7080    "fs",
7081    FILESYS_TABLE,
7082    "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",
7083    gfsp_fields,
7084    14,
7085    "fs.name LIKE '%s' AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = list_id",
7086    1,
7087    "fs.label",
7088    &VDfix_modby,
7089  },
7090
7091  {
7092    /* Q_AFIL - ADD_FILESYS */ /* uses prefetch_value() for filsys_id */
7093    "add_filesys",
7094    "afil",
7095    2,
7096    MR_Q_APPEND,
7097    "fs",
7098    FILESYS_TABLE,
7099    "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)",
7100    afil_fields,
7101    11,
7102    0,
7103    0,
7104    NULL,
7105    &afil_validate,
7106  },
7107
7108  {
7109    /* Q_UFIL - UPDATE_FILESYS */
7110    "update_filesys",
7111    "ufil",
7112    2,
7113    MR_Q_UPDATE,
7114    "fs",
7115    FILESYS_TABLE,
7116    "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'",
7117    ufil_fields,
7118    11,
7119    "filsys_id = %d",
7120    1,
7121    NULL,
7122    &ufil_validate,
7123  },
7124
7125  {
7126    /* Q_DFIL - DELETE_FILESYS */
7127    "delete_filesys",
7128    "dfil",
7129    2,
7130    MR_Q_DELETE,
7131    "fs",
7132    FILESYS_TABLE,
7133    NULL,
7134    dfil_fields,
7135    0,
7136    "filsys_id = %d",
7137    1,
7138    NULL,
7139    &dfil_validate,
7140  },
7141
7142  {
7143    /* Q_GFGM - GET_FSGROUP_MEMBERS */
7144    "get_fsgroup_members",
7145    "gfgm",
7146    2,
7147    MR_Q_RETRIEVE,
7148    "fg",
7149    FSGROUP_TABLE,
7150    "fs.label, fg.key FROM fsgroup fg, filesys fs",
7151    gfgm_fields,
7152    2,
7153    "fg.group_id = %d AND fs.filsys_id = fg.filsys_id",
7154    1,
7155    "fs.label, fg.key",
7156    &gfgm_validate,
7157  },
7158
7159  {
7160    /* Q_AFTG - ADD_FILESYS_TO_FSGROUP */
7161    "add_filesys_to_fsgroup",
7162    "aftg",
7163    2,
7164    MR_Q_APPEND,
7165    "fg",
7166    FSGROUP_TABLE,
7167    "INTO fsgroup (group_id, filsys_id, key) VALUES (%d, %d, '%s')",
7168    gfgm_fields,
7169    3,
7170    NULL,
7171    0,
7172    NULL,
7173    &aftg_validate,
7174  },
7175
7176  {
7177    /* Q_RFFG - REMOVE_FILESYS_FROM_FSGROUP */
7178    "remove_filesys_from_fsgroup",
7179    "rffg",
7180    2,
7181    MR_Q_DELETE,
7182    "fg",
7183    FSGROUP_TABLE,
7184    NULL,
7185    gfgm_fields,
7186    0,
7187    "group_id = %d AND filsys_id = %d",
7188    2,
7189    NULL,
7190    &aftg_validate,
7191  },
7192
7193  {
7194    /* Q_GANF - GET_ALL_NFSPHYS */
7195    "get_all_nfsphys",
7196    "ganf",
7197    2,
7198    MR_Q_RETRIEVE,
7199    "np",
7200    NFSPHYS_TABLE,
7201    "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",
7202    ganf_fields,
7203    9,
7204    "m.mach_id = np.mach_id",
7205    0,
7206    "m.name, np.dir",
7207    &VDfix_modby,
7208  },
7209
7210  {
7211    /* Q_GNFP - GET_NFSPHYS */
7212    "get_nfsphys",
7213    "gnfp",
7214    2,
7215    MR_Q_RETRIEVE,
7216    "np",
7217    NFSPHYS_TABLE,
7218    "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",
7219    gnfp_fields,
7220    9,
7221    "np.mach_id = %d AND np.dir LIKE '%s' AND m.mach_id = np.mach_id",
7222    2,
7223    "m.name, np.dir",
7224    &gnfp_validate,
7225  },
7226
7227  {
7228    /* Q_ANFP - ADD_NFSPHYS */ /* uses prefetch_value() for nfsphys_id */
7229    "add_nfsphys",
7230    "anfp",
7231    2,
7232    MR_Q_APPEND,
7233    "np",
7234    NFSPHYS_TABLE,
7235    "INTO nfsphys (mach_id, dir, device, status, allocated, partsize, nfsphys_id) VALUES (%d, '%s', NVL('%s', CHR(0)), %s, %s, %s, %s)",
7236    ganf_fields,
7237    6,
7238    0,
7239    0,
7240    NULL,
7241    &anfp_validate,
7242  },
7243
7244  {
7245    /* Q_UNFP - UPDATE_NFSPHYS */
7246    "update_nfsphys",
7247    "unfp",
7248    2,
7249    MR_Q_UPDATE,
7250    "np",
7251    NFSPHYS_TABLE,
7252    "nfsphys SET device = NVL('%s', CHR(0)), status = %s, allocated = %s, partsize = %s",
7253    ganf_fields,
7254    4,
7255    "mach_id = %d AND dir = '%s'",
7256    2,
7257    NULL,
7258    &unfp_validate,
7259  },
7260
7261  {
7262    /* Q_AJNF - ADJUST_NFSPHYS_ALLOCATION */
7263    "adjust_nfsphys_allocation",
7264    "ajnf",
7265    2,
7266    MR_Q_UPDATE,
7267    "np",
7268    NFSPHYS_TABLE,
7269    "nfsphys SET allocated = allocated + %s",
7270    ajnf_fields,
7271    1,
7272    "mach_id = %d AND dir = '%s'",
7273    2,
7274    NULL,
7275    &ajnf_validate,
7276  },
7277
7278  {
7279    /* Q_DNFP - DELETE_NFSPHYS */
7280    "delete_nfsphys",
7281    "dnfp",
7282    2,
7283    MR_Q_DELETE,
7284    "np",
7285    NFSPHYS_TABLE,
7286    NULL,
7287    dnfp_fields,
7288    0,
7289    "mach_id = %d AND dir = '%s'",
7290    2,
7291    NULL,
7292    &dnfp_validate,
7293  },
7294
7295  {
7296    /* Q_GQOT - GET_QUOTA */
7297    "get_quota",
7298    "gqot",
7299    2,
7300    MR_Q_RETRIEVE,
7301    "q",
7302    QUOTA_TABLE,
7303    "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",
7304    gqot_fields,
7305    9,
7306    "fs.label LIKE '%s' AND q.type = '%s' AND q.entity_id = %d AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
7307    3,
7308    NULL,
7309    &gqot_validate,
7310  },
7311
7312  {
7313    /* Q_GQBF - GET_QUOTA_BY_FILESYS */
7314    "get_quota_by_filesys",
7315    "gqbf",
7316    2,
7317    MR_Q_RETRIEVE,
7318    "q",
7319    QUOTA_TABLE,
7320    "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",
7321    gqbf_fields,
7322    9,
7323    "fs.label LIKE '%s' AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
7324    1,
7325    "fs.label, q.type",
7326    &gqbf_validate,
7327  },
7328
7329  {
7330    /* Q_AQOT - ADD_QUOTA */ /* prefetch_filsys() gets last 1 value */
7331    "add_quota",
7332    "aqot",
7333    2,
7334    MR_Q_APPEND,
7335    0,
7336    QUOTA_TABLE,
7337    "INTO quota (filsys_id, type, entity_id, quota, phys_id) VALUES ('%s', %d, %d, %s, %s)",
7338    aqot_fields,
7339    4,
7340    NULL,
7341    0,
7342    NULL,
7343    &aqot_validate,
7344  },
7345
7346  {
7347    /* Q_UQOT - UPDATE_QUOTA */
7348    "update_quota",
7349    "uqot",
7350    2,
7351    MR_Q_UPDATE,
7352    0,
7353    QUOTA_TABLE,
7354    "quota SET quota = %s",
7355    aqot_fields,
7356    1,
7357    0,
7358    3,
7359    NULL,
7360    &uqot_validate,
7361  },
7362
7363  {
7364    /* Q_DQOT - DELETE_QUOTA */
7365    "delete_quota",
7366    "dqot",
7367    2,
7368    MR_Q_DELETE,
7369    0,
7370    QUOTA_TABLE,
7371    NULL,
7372    aqot_fields,
7373    0,
7374    0,
7375    3,
7376    NULL,
7377    &dqot_validate,
7378  },
7379
7380  {
7381    /* Q_GNFQ - GET_NFS_QUOTAS */
7382    "get_nfs_quota",
7383    "gnfq",
7384    2,
7385    MR_Q_RETRIEVE,
7386    "q",
7387    QUOTA_TABLE,
7388    "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",
7389    gnfq_fields,
7390    8,
7391    "fs.label LIKE '%s' AND q.type = 'USER' AND q.entity_id = u.users_id AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id AND u.login = '%s'",
7392    2,
7393    "fs.label, u.login",
7394    &gnfq_validate,
7395  },
7396
7397  {
7398    /* Q_GNQP - GET_NFS_QUOTAS_BY_PARTITION */
7399    "get_nfs_quotas_by_partition",
7400    "gnqp",
7401    2,
7402    MR_Q_RETRIEVE,
7403    "q",
7404    QUOTA_TABLE,
7405    "fs.label, u.login, q.quota, np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
7406    gnqp_fields,
7407    5,
7408    "np.mach_id = %d AND np.dir LIKE '%s' AND q.phys_id = np.nfsphys_id AND fs.filsys_id = q.filsys_id AND q.type = 'USER' AND u.users_id = q.entity_id AND m.mach_id = np.mach_id",
7409    2,
7410    "fs.label",
7411    NULL,
7412  },
7413
7414  {
7415    /* Q_ANFQ - ADD_NFS_QUOTA */ /* prefetch_filsys() gets last 1 value */
7416    "add_nfs_quota",
7417    "anfq",
7418    2,
7419    MR_Q_APPEND,
7420    0,
7421    QUOTA_TABLE,
7422    "INTO quota (type, filsys_id, entity_id, quota, phys_id ) VALUES ('USER', %d, %d, %s, %s)",
7423    anfq_fields,
7424    3,
7425    NULL,
7426    0,
7427    NULL,
7428    &anfq_validate,
7429  },
7430
7431  {
7432    /* Q_UNFQ - UPDATE_NFS_QUOTA */
7433    "update_nfs_quota",
7434    "unfq",
7435    2,
7436    MR_Q_UPDATE,
7437    0,
7438    QUOTA_TABLE,
7439    "quota SET quota = %s",
7440    anfq_fields,
7441    1,
7442    0,
7443    2,
7444    NULL,
7445    &unfq_validate,
7446  },
7447
7448  {
7449    /* Q_DNFQ - DELETE_NFS_QUOTA */
7450    "delete_nfs_quota",
7451    "dnfq",
7452    2,
7453    MR_Q_DELETE,
7454    0,
7455    QUOTA_TABLE,
7456    NULL,
7457    anfq_fields,
7458    0,
7459    0,
7460    2,
7461    NULL,
7462    &dnfq_validate,
7463  },
7464
7465  {
7466    /* Q_GZCL - GET_ZEPHYR_CLASS, v2 */
7467    "get_zephyr_class",
7468    "gzcl",
7469    2,
7470    MR_Q_RETRIEVE,
7471    "z",
7472    ZEPHYR_TABLE,
7473    "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",
7474    gzcl2_fields,
7475    12,
7476    "class LIKE '%s'",
7477    1,
7478    "class",
7479    &gzcl_validate,
7480  },
7481
7482  {
7483    /* Q_GZCL - GET_ZEPHYR_CLASS, v5 */
7484    "get_zephyr_class",
7485    "gzcl",
7486    5,
7487    MR_Q_RETRIEVE,
7488    "z",
7489    ZEPHYR_TABLE,
7490    "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",
7491    gzcl_fields,
7492    14,
7493    "class LIKE '%s'",
7494    1,
7495    "class",
7496    &gzcl_validate,
7497  },
7498
7499  {
7500    /* Q_AZCL - ADD_ZEPHYR_CLASS, v2 */
7501    "add_zephyr_class",
7502    "azcl",
7503    2,
7504    MR_Q_APPEND,
7505    "z",
7506    ZEPHYR_TABLE,
7507    "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)",
7508    azcl2_fields,
7509    9,
7510    0,
7511    0,
7512    NULL,
7513    &azcl2_validate,
7514  },
7515
7516  {
7517    /* Q_AZCL - ADD_ZEPHYR_CLASS, v5 */
7518    "add_zephyr_class",
7519    "azcl",
7520    5,
7521    MR_Q_APPEND,
7522    "z",
7523    ZEPHYR_TABLE,
7524    "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)",
7525    azcl_fields,
7526    11,
7527    0,
7528    0,
7529    NULL,
7530    &azcl_validate,
7531  },
7532
7533  {
7534    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v2 */
7535    "update_zephyr_class",
7536    "uzcl",
7537    2,
7538    MR_Q_UPDATE,
7539    "z",
7540    ZEPHYR_TABLE,
7541    "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",
7542    uzcl2_fields,
7543    9,
7544    "class = '%s'",
7545    1,
7546    NULL,
7547    &uzcl2_validate,
7548  },
7549
7550  {
7551    /* Q_UZCL - UPDATE_ZEPHYR_CLASS, v5 */
7552    "update_zephyr_class",
7553    "uzcl",
7554    5,
7555    MR_Q_UPDATE,
7556    "z",
7557    ZEPHYR_TABLE,
7558    "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",
7559    uzcl_fields,
7560    11,
7561    "class = '%s'",
7562    1,
7563    NULL,
7564    &uzcl_validate,
7565  },
7566
7567  {
7568    /* Q_DZCL - DELETE_ZEPHYR_CLASS */
7569    "delete_zephyr_class",
7570    "dzcl",
7571    2,
7572    MR_Q_DELETE,
7573    "z",
7574    ZEPHYR_TABLE,
7575    0,
7576    uzcl_fields,
7577    0,
7578    "class = '%s'",
7579    1,
7580    NULL,
7581    &dzcl_validate,
7582  },
7583
7584  {
7585    /* Q_GSHA - GET_SERVER_HOST_ACCESS */
7586    "get_server_host_access",
7587    "gsha",
7588    2,
7589    MR_Q_RETRIEVE,
7590    "ha",
7591    HOSTACCESS_TABLE,
7592    "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",
7593    gsha_fields,
7594    6,
7595    "m.name LIKE UPPER('%s') AND ha.mach_id = m.mach_id",
7596    1,
7597    "m.name",
7598    &gsha_validate,
7599  },
7600
7601  {
7602    /* Q_ASHA - ADD_SERVER_HOST_ACCESS */
7603    "add_server_host_access",
7604    "asha",
7605    2,
7606    MR_Q_APPEND,
7607    "ha",
7608    HOSTACCESS_TABLE,
7609    "INTO hostaccess (mach_id, acl_type, acl_id) VALUES (%d, '%s', %d)",
7610    asha_fields,
7611    3,
7612    0,
7613    0,
7614    NULL,
7615    &asha_validate,
7616  },
7617
7618  {
7619    /* Q_USHA - UPDATE_SERVER_HOST_ACCESS */
7620    "update_server_host_access",
7621    "usha",
7622    2,
7623    MR_Q_UPDATE,
7624    "ha",
7625    HOSTACCESS_TABLE,
7626    "hostaccess SET acl_type = '%s', acl_id = %d",
7627    asha_fields,
7628    2,
7629    "mach_id = %d",
7630    1,
7631    NULL,
7632    &asha_validate,
7633  },
7634
7635  {
7636    /* Q_DSHA - DELETE_SERVER_HOST_ACCESS */
7637    "delete_server_host_access",
7638    "dsha",
7639    2,
7640    MR_Q_DELETE,
7641    "ha",
7642    HOSTACCESS_TABLE,
7643    0,
7644    asha_fields,
7645    0,
7646    "mach_id = %d",
7647    1,
7648    NULL,
7649    &VDmach,
7650  },
7651
7652  {
7653    /* Q_GACL - GET_ACL */
7654    "get_acl",
7655    "gacl",
7656    2,
7657    MR_Q_RETRIEVE,
7658    "ac",
7659    ACL_TABLE,
7660    "m.name, ac.target, ac.kind, l.name FROM acl ac, machine m, list l",
7661    gacl_fields,
7662    4,
7663    "m.mach_id = %d AND m.mach_id = ac.mach_id AND ac.target LIKE '%s' AND l.list_id = ac.list_id",
7664    2,
7665    "m.name, ac.target, ac.kind",
7666    &gacl_validate,
7667  },
7668
7669  {
7670    /* Q_AACL - ADD_ACL */
7671    "add_acl",
7672    "aacl",
7673    2,
7674    MR_Q_APPEND,
7675    "ac",
7676    ACL_TABLE,
7677    "INTO acl (mach_id, target, kind, list_id) VALUES (%d, '%s', '%s', %d)",
7678    aacl_fields,
7679    4,
7680    0,
7681    0,
7682    NULL,
7683    &aacl_validate,
7684  },
7685
7686  {
7687    /* Q_DACL - DELETE_ACL */
7688    "delete_acl",
7689    "dacl",
7690    2,
7691    MR_Q_DELETE,
7692    "ac",
7693    ACL_TABLE,
7694    0,
7695    dacl_fields,
7696    0,
7697    "mach_id = %d AND target = '%s'",
7698    2,
7699    NULL,
7700    &gacl_validate,
7701  },
7702
7703  {
7704    /* Q_GSVC - GET_SERVICE */
7705    "get_service",
7706    "gsvc",
7707    2,
7708    MR_Q_RETRIEVE,
7709    "ss",
7710    SERVICES_TABLE,
7711    "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
7712    gsvc_fields,
7713    7,
7714    "name LIKE '%s' AND protocol LIKE '%s'",
7715    2,
7716    "name",
7717    &VDfix_modby,
7718  },
7719
7720  {
7721    /* Q_ASVC - ADD_SERVICE */
7722    "add_service",
7723    "asvc",
7724    2,
7725    MR_Q_APPEND,
7726    "ss",
7727    SERVICES_TABLE,
7728    "INTO services (name, protocol, port, description) VALUES ('%s', '%s', %s, NVL('%s', CHR(0)))",
7729    asvc_fields,
7730    4,
7731    NULL,
7732    0,
7733    NULL,
7734    &asvc_validate,
7735  },
7736
7737  {
7738    /* Q_DSVC - DELETE_SERVICE */
7739    "delete_service",
7740    "dsvc",
7741    2,
7742    MR_Q_DELETE,
7743    "ss",
7744    SERVICES_TABLE,
7745    0,
7746    dsvc_fields,
7747    0,
7748    "name = '%s' AND protocol = '%s'",
7749    2,
7750    NULL,
7751    &dsvc_validate,
7752  },
7753
7754  {
7755    /* Q_GPRN - GET_PRINTER, v2 */
7756    "get_printer",
7757    "gprn",
7758    2,
7759    MR_Q_RETRIEVE,
7760    "pr",
7761    PRINTERS_TABLE,
7762    "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",
7763    gprn2_fields,
7764    19,
7765    "pr.name LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7766    1,
7767    "pr.name",
7768    &VDfix_modby,
7769  },
7770
7771  {
7772    /* Q_GPRN - GET_PRINTER, v13 */
7773    "get_printer",
7774    "gprn",
7775    13,
7776    MR_Q_RETRIEVE,
7777    "pr",
7778    PRINTERS_TABLE,
7779    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7780    gprn_fields,
7781    23,
7782    "pr.name LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7783    1,
7784    "pr.name",
7785    &VDfix_modby,
7786  },
7787
7788
7789  {
7790    /* Q_GPBD - GET_PRINTER_BY_DUPLEXNAME, v2 */
7791    "get_printer_by_duplexname",
7792    "gpbd",
7793    2,
7794    MR_Q_RETRIEVE,
7795    "pr",
7796    PRINTERS_TABLE,
7797    "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",
7798    gpbd2_fields,
7799    19,
7800    "pr.duplexname LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7801    1,
7802    "pr.name",
7803    &VDfix_modby,
7804  },
7805
7806  {
7807    /* Q_GPBD - GET_PRINTER_BY_DUPLEXNAME, v13 */
7808    "get_printer_by_duplexname",
7809    "gpbd",
7810    13,
7811    MR_Q_RETRIEVE,
7812    "pr",
7813    PRINTERS_TABLE,
7814    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7815    gpbd_fields,
7816   23,
7817    "pr.duplexname LIKE '%s' AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7818    1,
7819    "pr.name",
7820    &VDfix_modby,
7821  },
7822
7823  {
7824    /* Q_GPBE - GET_PRINTER_BY_ETHERNET, v2 */
7825    "get_printer_by_ethernet",
7826    "gpbe",
7827    2,
7828    MR_Q_RETRIEVE,
7829    "pr",
7830    PRINTERS_TABLE,
7831    "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",
7832    gpbd2_fields,
7833    19,
7834    "m1.hwaddr LIKE LOWER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7835    1,
7836    "pr.name",
7837    &VDfix_modby,
7838  },
7839
7840  {
7841    /* Q_GPBE - GET_PRINTER_BY_ETHERNET, v13 */
7842    "get_printer_by_ethernet",
7843    "gpbe",
7844    13,
7845    MR_Q_RETRIEVE,
7846    "pr",
7847    PRINTERS_TABLE,
7848    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7849    gpbd_fields,
7850    23,
7851    "m1.hwaddr LIKE LOWER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7852    1,
7853    "pr.name",
7854    &VDfix_modby,
7855  },
7856
7857  {
7858    /* Q_GPBH - GET_PRINTER_BY_HOSTNAME, v2 */
7859    "get_printer_by_hostname",
7860    "gpbh",
7861    2,
7862    MR_Q_RETRIEVE,
7863    "pr",
7864    PRINTERS_TABLE,
7865    "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",
7866    gpbh2_fields,
7867    19,
7868    "m1.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7869    1,
7870    "pr.name",
7871    &VDfix_modby,
7872  },
7873
7874  {
7875    /* Q_GPBH - GET_PRINTER_BY_HOSTNAME, v13 */
7876    "get_printer_by_hostname",
7877    "gpbh",
7878    13,
7879    MR_Q_RETRIEVE,
7880    "pr",
7881    PRINTERS_TABLE,
7882    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7883    gpbh_fields,
7884    23,
7885    "m1.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7886    1,
7887    "pr.name",
7888    &VDfix_modby,
7889  },
7890
7891  {
7892    /* Q_GPBR - GET_PRINTER_BY_RM, v2 */
7893    "get_printer_by_rm",
7894    "gpbr",
7895    2,
7896    MR_Q_RETRIEVE,
7897    "pr",
7898    PRINTERS_TABLE,
7899    "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",
7900    gpbr2_fields,
7901    19,
7902    "m3.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7903    1,
7904    "pr.name",
7905    &VDfix_modby,
7906  },
7907
7908  {
7909    /* Q_GPBR - GET_PRINTER_BY_RM, v13 */
7910    "get_printer_by_rm",
7911    "gpbr",
7912    13,
7913    MR_Q_RETRIEVE,
7914    "pr",
7915    PRINTERS_TABLE,
7916    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7917    gpbr_fields,
7918    23,
7919    "m3.name LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7920    1,
7921    "pr.name",
7922    &VDfix_modby,
7923  },
7924
7925  {
7926    /* Q_GPBL - GET_PRINTER_BY_LOCATION, v2 */
7927    "get_printer_by_location",
7928    "gpbl",
7929    2,
7930    MR_Q_RETRIEVE,
7931    "pr",
7932    PRINTERS_TABLE,
7933    "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",
7934    gpbl2_fields,
7935    19,
7936    "UPPER(pr.location) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7937    1,
7938    "pr.name",
7939    &VDfix_modby,
7940  },
7941
7942  {
7943    /* Q_GPBL - GET_PRINTER_BY_LOCATION, v13 */
7944    "get_printer_by_location",
7945    "gpbl",
7946    13,
7947    MR_Q_RETRIEVE,
7948    "pr",
7949    PRINTERS_TABLE,
7950    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7951    gpbl_fields,
7952    23,
7953    "UPPER(pr.location) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7954    1,
7955    "pr.name",
7956    &VDfix_modby,
7957  },
7958
7959  {
7960    /* Q_GPBC - GET_PRINTER_BY_CONTACT, v2 */
7961    "get_printer_by_contact",
7962    "gpbc",
7963    2,
7964    MR_Q_RETRIEVE,
7965    "pr",
7966    PRINTERS_TABLE,
7967    "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",
7968    gpbc2_fields,
7969    19,
7970    "UPPER(pr.contact) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl",
7971    1,
7972    "pr.name",
7973    &VDfix_modby,
7974  },
7975
7976  {
7977    /* Q_GPBC - GET_PRINTER_BY_CONTACT, v13 */
7978    "get_printer_by_contact",
7979    "gpbc",
7980    13,
7981    MR_Q_RETRIEVE,
7982    "pr",
7983    PRINTERS_TABLE,
7984    "pr.name, pr.type, pr.hwtype, pr.duplexname, pr.duplexdefault, pr.holddefault, pr.status, m1.name, m2.name, m3.name, pr.rp, m4.name, pr.ka, pr.pc, l1.name, l2.name, l3.name, pr.banner, pr.location, pr.contact, TO_CHAR(pr.modtime, 'DD-mon-YYYY HH24:MI:SS'), pr.modby, pr.modwith FROM printers pr, machine m1, machine m2, machine m3, machine m4, list l1, list l2, list l3",
7985    gpbc_fields,
7986    23,
7987    "UPPER(pr.contact) LIKE UPPER('%s') AND m1.mach_id = pr.mach_id AND m2.mach_id = pr.loghost AND m3.mach_id = pr.rm AND m4.mach_id = pr.rq AND l1.list_id = pr.ac AND l2.list_id = pr.lpc_acl AND l3.list_id = pr.report_list",
7988    1,
7989    "pr.name",
7990    &VDfix_modby,
7991  },
7992
7993  {
7994    /* Q_APRN - ADD_PRINTER, v2 */
7995    "add_printer",
7996    "aprn",
7997    2,
7998    MR_Q_APPEND,
7999    "pr",
8000    PRINTERS_TABLE,
8001    "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)))",
8002    aprn2_fields,
8003    16,
8004    0,
8005    0,
8006    NULL,
8007    &aprn2_validate,
8008  },
8009
8010  {
8011    /* Q_APRN - ADD_PRINTER, v13 */
8012    "add_printer",
8013    "aprn",
8014    13,
8015    MR_Q_APPEND,
8016    "pr",
8017    PRINTERS_TABLE,
8018    "INTO printers (name, type, hwtype, duplexname, duplexdefault, holddefault, status, mach_id, loghost, rm, rp, rq, ka, pc, ac, lpc_acl, report_list, banner, location, contact) VALUES ('%s', '%s', '%s', NVL('%s', CHR(0)), %s, %s, %s, %d, %d, %d, NVL('%s', CHR(0)), %d, %s, %s, %d, %d, %d, %s, NVL('%s', CHR(0)), NVL('%s', CHR(0)))",
8019    aprn_fields,
8020    20,
8021    0,
8022    0,
8023    NULL,
8024    &aprn_validate,
8025  },
8026
8027  {
8028    /* Q_UPRN - UPDATE_PRINTER, v2 */
8029    "update_printer",
8030    "uprn",
8031    2,
8032    MR_Q_UPDATE,
8033    "pr",
8034    PRINTERS_TABLE,
8035    "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))",
8036    uprn2_fields,
8037    16,
8038    "name = '%s'",
8039    1,
8040    NULL,
8041    &uprn2_validate,
8042  },
8043
8044  {
8045    /* Q_UPRN - UPDATE_PRINTER, v13 */
8046    "update_printer",
8047    "uprn",
8048    13,
8049    MR_Q_UPDATE,
8050    "pr",
8051    PRINTERS_TABLE,
8052    "printers SET name = '%s', type = '%s', hwtype = '%s', duplexname = NVL('%s', CHR(0)), duplexdefault = %s, holddefault = %s, status = %s, mach_id = %d, loghost = %d, rm = %d, rp = NVL('%s', CHR(0)), rq = %d, ka = %s, pc = %s, ac = %d, lpc_acl = %d, report_list = %d, banner = %s, location = NVL('%s', CHR(0)), contact = NVL('%s', CHR(0))",
8053    uprn_fields,
8054    20,
8055    "name = '%s'",
8056    1,
8057    NULL,
8058    &uprn_validate,
8059  },
8060
8061  {
8062    /* Q_DPRN - DELETE_PRINTER */
8063    "delete_printer",
8064    "dprn",
8065    2,
8066    MR_Q_DELETE,
8067    "pr",
8068    PRINTERS_TABLE,
8069    0,
8070    aprn_fields,
8071    0,
8072    "name = '%s'",
8073    1,
8074    NULL,
8075    &dprn_validate,
8076  },
8077
8078  {
8079    /* Q_GPSV - GET_PRINT_SERVER */
8080    "get_print_server",
8081    "gpsv",
8082    2,
8083    MR_Q_RETRIEVE,
8084    "ps",
8085    PRINTSERVERS_TABLE,
8086    "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",
8087    gpsv_fields,
8088    9,
8089    "ps.mach_id = %d AND m.mach_id = ps.mach_id AND s.string_id = ps.printer_types AND l.list_id = ps.lpc_acl",
8090    1,
8091    NULL,
8092    &gpsv_validate,
8093  },
8094
8095  {
8096    /* Q_APSV - ADD_PRINT_SERVER */
8097    "add_print_server",
8098    "apsv",
8099    2,
8100    MR_Q_APPEND,
8101    "ps",
8102    PRINTSERVERS_TABLE,
8103    "INTO printservers (mach_id, kind, printer_types, owner_type, owner_id, lpc_acl) VALUES (%d, '%s', %d, '%s', %d, %d)",
8104    apsv_fields,
8105    6,
8106    0,
8107    0,
8108    NULL,
8109    &apsv_validate,
8110  },
8111
8112  {
8113    /* Q_UPSV - UPDATE_PRINT_SERVER */
8114    "update_print_server",
8115    "upsv",
8116    2,
8117    MR_Q_UPDATE,
8118    "ps",
8119    PRINTSERVERS_TABLE,
8120    "printservers SET kind = '%s', printer_types = %d, owner_type = '%s', owner_id = %d, lpc_acl = %d",
8121    apsv_fields,
8122    5,
8123    "mach_id = %d",
8124    1,
8125    NULL,
8126    &apsv_validate,
8127  },
8128
8129  {
8130    /* Q_DPSV - DELETE_PRINT_SERVER */
8131    "delete_print_server",
8132    "dpsv",
8133    2,
8134    MR_Q_DELETE,
8135    "ps",
8136    PRINTSERVERS_TABLE,
8137    0,
8138    dpsv_fields,
8139    0,
8140    "mach_id = %d",
8141    1,
8142    NULL,
8143    &dpsv_validate,
8144  },
8145
8146  {
8147    /* Q_GALI - GET_ALIAS */
8148    "get_alias",
8149    "gali",
8150    2,
8151    MR_Q_RETRIEVE,
8152    "a",
8153    ALIAS_TABLE,
8154    "name, type, trans FROM alias",
8155    gali_fields,
8156    3,
8157    "name LIKE '%s' AND type LIKE '%s' AND trans LIKE '%s'",
8158    3,
8159    "type, name, trans",
8160    NULL,
8161  },
8162
8163  {
8164    /* Q_AALI - ADD_ALIAS */
8165    "add_alias",
8166    "aali",
8167    2,
8168    MR_Q_APPEND,
8169    "a",
8170    ALIAS_TABLE,
8171    "INTO alias (name, type, trans) VALUES ('%s', '%s', '%s')",
8172    aali_fields,
8173    3,
8174    NULL,
8175    0,
8176    NULL,
8177    &aali_validate,
8178  },
8179
8180  {
8181    /* Q_DALI - DELETE_ALIAS */
8182    "delete_alias",
8183    "dali",
8184    2,
8185    MR_Q_DELETE,
8186    "a",
8187    ALIAS_TABLE,
8188    NULL,
8189    aali_fields,
8190    0,
8191    "name = '%s' AND type = '%s' AND  trans = '%s'",
8192    3,
8193    NULL,
8194    &dali_validate,
8195  },
8196
8197  {
8198    /* Q_GVAL - GET_VALUE */
8199    "get_value",
8200    "gval",
8201    2,
8202    MR_Q_RETRIEVE,
8203    "val",
8204    NUMVALUES_TABLE,
8205    "value FROM numvalues",
8206    gval_fields,
8207    1,
8208    "name = '%s'",
8209    1,
8210    NULL,
8211    &gval_validate,
8212  },
8213
8214  {
8215    /* Q_AVAL - ADD_VALUE */
8216    "add_value",
8217    "aval",
8218    2,
8219    MR_Q_APPEND,
8220    "val",
8221    NUMVALUES_TABLE,
8222    "INTO numvalues (name, value) VALUES ('%s', %s)",
8223    aval_fields,
8224    2,
8225    NULL,
8226    0,
8227    NULL,
8228    &aval_validate,
8229  },
8230
8231  {
8232    /* Q_UVAL - UPDATE_VALUE */
8233    "update_value",
8234    "uval",
8235    2,
8236    MR_Q_UPDATE,
8237    "val",
8238    NUMVALUES_TABLE,
8239    "numvalues SET value = %s",
8240    aval_fields,
8241    1,
8242    "name = '%s'",
8243    1,
8244    NULL,
8245    &aval_validate,
8246  },
8247
8248  {
8249    /* Q_DVAL - DELETE_VALUE */
8250    "delete_value",
8251    "dval",
8252    2,
8253    MR_Q_DELETE,
8254    "val",
8255    NUMVALUES_TABLE,
8256    NULL,
8257    dval_fields,
8258    0,
8259    "name = '%s'",
8260    1,
8261    NULL,
8262    &aval_validate,
8263  },
8264
8265  {
8266    /* Q_GATS - GET_ALL_TABLE_STATS */
8267    "get_all_table_stats",
8268    "gats",
8269    2,
8270    MR_Q_RETRIEVE,
8271    "tbs",
8272    TBLSTATS_TABLE,
8273    "table_name, appends, updates, deletes, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS') FROM tblstats",
8274    gats_fields,
8275    5,
8276    NULL,
8277    0,
8278    "table_name",
8279    0,
8280  },
8281
8282  {
8283    /* Q__SDL - _SET_DEBUG_LEVEL */
8284    "_set_debug_level",
8285    "_sdl",
8286    2,
8287    MR_Q_UPDATE,
8288    NULL,
8289    0,
8290    NULL,
8291    _sdl_fields,
8292    1,
8293    NULL,
8294    0,
8295    NULL,
8296    &_sdl_validate,
8297  },
8298
8299  {
8300    /* Q_GCON - GET_CONTAINER, v7 */
8301    "get_container",
8302    "gcon",
8303    7,
8304    MR_Q_RETRIEVE,
8305    "c",
8306    CONTAINERS_TABLE,
8307    "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",
8308    gcon7_fields,
8309    11,
8310    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
8311    1,
8312    NULL,
8313    &gcon_validate,
8314  },
8315
8316  {
8317    /* Q_GCON - GET_CONTAINER, v9 */
8318    "get_container",
8319    "gcon",
8320    9,
8321    MR_Q_RETRIEVE,
8322    "c",
8323    CONTAINERS_TABLE,
8324    "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",
8325    gcon_fields,
8326    12,
8327    "LOWER(name) LIKE LOWER('%s') AND cnt_id != 0",
8328    1,
8329    NULL,
8330    &gcon_validate,
8331  },
8332
8333  {
8334    /* Q_ACON - ADD_CONTAINER, v7 */ /* uses prefetch_value() for cnt_id */
8335    "add_container",
8336    "acon",
8337    7,
8338    MR_Q_APPEND,
8339    "c",
8340    CONTAINERS_TABLE,
8341    "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)",
8342    acon7_fields,
8343    8,
8344    0,
8345    0,
8346    NULL,
8347    &acon7_validate,
8348  },
8349
8350  {
8351    /* Q_ACON - ADD_CONTAINER, v9 */ /* uses prefetch_value() for cnt_id */
8352    "add_container",
8353    "acon",
8354    9,
8355    MR_Q_APPEND,
8356    "c",
8357    CONTAINERS_TABLE,
8358    "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)",
8359    acon_fields,
8360    9,
8361    0,
8362    0,
8363    NULL,
8364    &acon_validate,
8365  },
8366
8367  {
8368    /* Q_UCON - UPDATE_CONTAINER, v7 */
8369    "update_container",
8370    "ucon",
8371    7,
8372    MR_Q_UPDATE,
8373    0,
8374    CONTAINERS_TABLE,
8375    0,
8376    ucon7_fields,
8377    8,
8378    0,
8379    1,
8380    NULL,
8381    &ucon7_validate,
8382  },
8383
8384  {
8385    /* Q_UCON - UPDATE_CONTAINER, v9 */
8386    "update_container",
8387    "ucon",
8388    9,
8389    MR_Q_UPDATE,
8390    0,
8391    CONTAINERS_TABLE,
8392    0,
8393    ucon_fields,
8394    9,
8395    0,
8396    1,
8397    NULL,
8398    &ucon_validate,
8399  },
8400
8401  {
8402    /* Q_DCON - DELETE_CONTAINER, v7 */
8403    "delete_container",
8404    "dcon",
8405    7,
8406    MR_Q_DELETE,
8407    "c",
8408    CONTAINERS_TABLE,
8409    NULL,
8410    dcon_fields,
8411    0,
8412    "cnt_id = %d",
8413    1,
8414    NULL,
8415    &dcon_validate,
8416  },
8417
8418  {
8419    /* Q_AMCN - ADD_MACHINE_TO_CONTAINER, v7 */
8420    "add_machine_to_container",
8421    "amcn",
8422    7,
8423    MR_Q_APPEND,
8424    "mcn",
8425    MCNTMAP_TABLE,
8426    "INTO mcntmap (mach_id, cnt_id) VALUES (%d, %d)",
8427    amcn_fields,
8428    2,
8429    0,
8430    0,
8431    NULL,
8432    &amcn_validate,
8433  },
8434
8435  {
8436    /* Q_DMCN - DELETE_MACHINE_FROM_CONTAINER, v7 */
8437    "delete_machine_from_container",
8438    "dmcn",
8439    7,
8440    MR_Q_DELETE,
8441    "mcn",
8442    MCNTMAP_TABLE,
8443    0,
8444    amcn_fields,
8445    0,
8446    "mach_id = %d AND cnt_id = %d",
8447    2,
8448    NULL,
8449    &dmcn_validate,
8450  },
8451
8452  {
8453    /* Q_GMNM - GET_MACHINE_TO_CONTAINER_MAP, v7 */
8454    "get_machine_to_container_map",
8455    "gmnm",
8456    7,
8457    MR_Q_RETRIEVE,
8458    "mcn",
8459    MCNTMAP_TABLE,
8460    "m.name, c.name FROM machine m, containers c, mcntmap mcn",
8461    gmnm_fields,
8462    2,
8463    "m.name LIKE UPPER('%s') AND mcn.cnt_id = c.cnt_id AND mcn.mach_id = m.mach_id",
8464    1,
8465    NULL,
8466    NULL,
8467  },
8468
8469  {
8470    /* Q_GMOC - GET_MACHINES_OF_CONTAINER, v7 */
8471    "get_machines_of_container",
8472    "gmoc",
8473    7,
8474    MR_Q_RETRIEVE,
8475    NULL,
8476    MCNTMAP_TABLE,
8477    NULL,
8478    gmoc_fields,
8479    2,
8480    NULL,
8481    2,
8482    NULL,
8483    &gmoc_validate,
8484  },
8485
8486  {
8487    /* Q_GSOC - GET_SUBCONTAINERS_OF_CONTAINER, v7 */
8488    "get_subcontainers_of_container",
8489    "gsoc",
8490    7,
8491    MR_Q_RETRIEVE,
8492    NULL,
8493    CONTAINERS_TABLE,
8494    NULL,
8495    gsoc_fields,
8496    1,
8497    NULL,
8498    2,
8499    NULL,
8500    &gsoc_validate,
8501  },
8502
8503  {
8504    /* Q_GTLC - GET_TOPLEVEL_CONTAINERS, v7 */
8505    "get_toplevel_containers",
8506    "gtlc",
8507    7,
8508    MR_Q_RETRIEVE,
8509    "c",
8510    CONTAINERS_TABLE,
8511    "name FROM containers",
8512    gtlc_fields,
8513    1,
8514    "name NOT LIKE '%%/%%'",
8515    0,
8516    "name",
8517    NULL,
8518  },
8519
8520  {
8521    /* Q_SCLI - SET_CONTAINER_LIST, v9 */
8522    "set_container_list",
8523    "scli",
8524    9,
8525    MR_Q_UPDATE,
8526    0,
8527    CONTAINERS_TABLE,
8528    0,
8529    scli_fields,
8530    1,
8531    0,
8532    1,
8533    NULL,
8534    &scli_validate,
8535  },
8536
8537  {
8538    /* Q_GCLI - GET_CONTAINER_LIST, v9 */
8539    "get_container_list",
8540    "gcli",
8541    9,
8542    MR_Q_RETRIEVE,
8543    "c",
8544    CONTAINERS_TABLE,
8545    "c.name, l.name FROM containers c, list l",
8546    gcli_fields,
8547    2,
8548    "LOWER(c.name) = LOWER('%s') AND c.list_id = l.list_id AND c.list_id != 0",
8549    1,
8550    NULL,
8551    NULL,
8552  },
8553
8554  {
8555    /* G_GLIC - GET_LIST_CONTAINER, v9 */
8556    "get_list_container",
8557    "glic",
8558    9,
8559    MR_Q_RETRIEVE,
8560    "c",
8561    CONTAINERS_TABLE,
8562    "c.name, l.name FROM containers c, list l",
8563    glic_fields,
8564    2,
8565    "l.list_id = %d AND l.list_id = c.list_id and c.list_id != 0",
8566    1,
8567    NULL,
8568    &glic_validate,
8569  },
8570
8571};
8572
8573int QueryCount = (sizeof(Queries) / sizeof(struct query));
Note: See TracBrowser for help on using the repository browser.