]> andersk Git - moira.git/blob - server/queries2.c
1961e294f581b68b35c487bc0d54c9c02f40f67b
[moira.git] / server / queries2.c
1 /* This file defines the query dispatch table for version 2 of the protocol
2  *
3  * $Header$
4  *
5  * Copyright 1987, 1988 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 #include "mr_et.h"
14
15 /* Specialized Support Query Routines */
16
17 /* Special Access Check Routines */
18 int access_user();
19 int access_login();
20 int access_list();
21 int access_visible_list();
22 int access_vis_list_by_name();
23 int access_member();
24 int access_qgli();
25 int access_service();
26 int access_filesys();
27 int access_host();
28 int access_ahal();
29 int access_snt();
30
31 /* Query Setup Routines */
32 int prefetch_value();
33 int prefetch_filesys();
34 int setup_ausr();
35 int setup_dusr();
36 int setup_spop();
37 int setup_dpob();
38 int setup_dmac();
39 int setup_dsnet();
40 int setup_dclu();
41 int setup_alis();
42 int setup_dlis();
43 int setup_dsin();
44 int setup_dshi();
45 int setup_afil();
46 int setup_ufil();
47 int setup_dfil();
48 int setup_aftg();
49 int setup_dnfp();
50 int setup_dqot();
51 int setup_akum();
52 int setup_dsnt();
53 int setup_ahst();
54 int setup_ahal();
55
56 /* Query Followup Routines */
57 int followup_fix_modby();
58 int followup_ausr();
59 int followup_gpob();
60 int followup_glin();
61 int followup_aqot();
62 int followup_dqot();
63 int followup_gzcl();
64 int followup_gsha();
65 int followup_gqot();
66 int followup_gpce();
67 int followup_guax();
68 int followup_uuac();
69 int followup_gsnt();
70 int followup_ghst();
71
72 int set_modtime();
73 int set_modtime_by_id();
74 int set_finger_modtime();
75 int set_pobox_modtime();
76 int set_uppercase_modtime();
77 int set_mach_modtime_by_id();
78 int set_cluster_modtime_by_id();
79 int set_serverhost_modtime();
80 int set_nfsphys_modtime();
81 int set_filesys_modtime();
82 int set_zephyr_modtime();
83
84 /* Special Queries */
85 int set_pobox();
86 int get_list_info();
87 int add_member_to_list();
88 int delete_member_from_list();
89 int get_ace_use();
90 int qualified_get_lists();
91 int get_members_of_list();
92 int get_end_members_of_list();
93 int qualified_get_server();
94 int qualified_get_serverhost();
95 int trigger_dcm();
96 int count_members_of_list();
97 int get_lists_of_member();
98 int register_user();
99 int _sdl_followup();
100
101
102 \f
103 /* Table Names */
104 char *table_name[] = {
105   "none", "users", "krbmap", "machine", "hostalias", "subnet", "cluster",
106   "mcmap", "svc", "list", "imembers", "servers", "serverhosts", "filesys",
107   "fsgroup", "nfsphys", "quota", "zephyr", "hostaccess", "strings", "services",
108   "printcap", "palladium", "capacls", "alias", "numvalues", "tblstats",
109   "incremental"};
110 int num_tables = 27;
111
112
113 /* VALOBJS
114  * These are commonly used validation objects, defined here so that they
115  * can be shared.
116  */
117
118 static struct valobj VOuser0[] = {
119   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
120 };
121
122 static struct valobj VOmach0[] = {
123   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
124 };
125
126 static struct valobj VOclu0[] = {
127   {V_ID, 0, CLUSTER_TABLE, "name", "clu_id", MR_CLUSTER},
128 };
129
130 static struct valobj VOsnet0[] = {
131   {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_CLUSTER},
132 };
133
134 static struct valobj VOlist0[] = {
135   {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
136 };
137
138 static struct valobj VOfilsys0[] = {
139   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
140 };
141
142 static struct valobj VOchar0[] = {
143   {V_CHAR, 0},
144 };
145
146
147 /* Validations
148  * Commonly used validation records defined here so that they may
149  * be shared.
150  */
151
152 static struct validate VDmach = { VOmach0, 1 };
153 static struct validate VDfixmodby = { 
154   0,
155   0,
156   0,
157   0,
158   0,
159   0,
160   0,
161   0,
162   followup_fix_modby,
163 };
164
165
166 /* Query data */
167
168 static char *galo_fields[] = {
169   "login", "uid", "shell", "last", "first", "middle",
170 };
171
172 static char *gual_fields[] = {
173   "login",
174   "login", "uid", "shell", "last", "first", "middle", "status",
175   "clearid", "class", "comments", "signature", "secure", "modtime", "modby", "modwith",
176 };
177
178 static char *gubl_fields[] = {
179   "login",
180   "login", "uid", "shell", "last", "first", "middle", "status", 
181   "clearid", "class", "modtime", "modby", "modwith",
182 };
183
184 static struct validate gubl_validate =  
185 {
186   0,
187   0,
188   0,
189   0,
190   0,
191   0,
192   access_login,
193   0,
194   followup_guax,
195 };
196
197 static char *guau_fields[] = {
198   "uid",
199   "login", "uid", "shell", "last", "first", "middle", "status",
200   "clearid", "class", "comments", "signature", "secure", "modtime", "modby", "modwith",
201 };
202
203 static char *guan_fields[] = {
204   "first", "last",
205   "login", "uid", "shell", "last", "first", "middle", "status",
206   "clearid", "class", "comments", "signature", "secure", "modtime", "modby", "modwith",
207 };
208
209 static struct validate guan_validate =  
210 {
211   0,
212   0,
213   0,
214   0,
215   0,
216   0,
217   0,
218   0,
219   followup_guax,
220 };
221
222 static char *guac_fields[] = {
223   "class",
224   "login", "uid", "shell", "last", "first", "middle", "status",
225   "clearid", "class", "comments", "signature", "secure", "modtime", "modby", "modwith",
226 };
227
228 static char *guam_fields[] = {
229   "clearid",
230   "login", "uid", "shell", "last", "first", "middle", "status",
231   "clearid", "class", "comments", "signature", "secure", "modtime", "modby", "modwith",
232 };
233
234 static char *gubu_fields[] = {
235   "uid",
236   "login", "uid", "shell", "last", "first", "middle", "status", 
237   "clearid", "class", "modtime", "modby", "modwith",
238 };
239
240 static struct valobj gubu_valobj[] = {
241   {V_NUM, 0}
242 };
243
244 static struct validate gubu_validate =  
245 {
246   gubu_valobj,
247   1,
248   0,
249   0,
250   0,
251   0,
252   access_login,
253   0,
254   followup_fix_modby,
255 };
256
257 static char *gubn_fields[] = {
258   "first", "last",
259   "login", "uid", "shell", "last", "first", "middle", "status", 
260   "clearid", "class", "modtime", "modby", "modwith",
261 };
262
263 static struct validate gubn_validate =
264 {
265   0,
266   0,
267   0,
268   0,
269   0,
270   0,
271   0,
272   0,
273   followup_fix_modby,
274 };
275
276 static char *gubc_fields[] = {
277   "class",
278   "login", "uid", "shell", "last", "first", "middle", "status", 
279   "clearid", "class", "modtime", "modby", "modwith",
280 };
281
282 static char *gubm_fields[] = {
283   "clearid",
284   "login", "uid", "shell", "last", "first", "middle", "status", 
285   "clearid", "class", "modtime", "modby", "modwith",
286 };
287
288 static char *gudf_fields[] = {
289   "login",
290   "dirsuppress", "dirremote"
291 };
292
293 static struct validate gudf_validate =  
294 {
295   VOuser0,
296   2,
297   0,
298   0,
299   0,
300   0,
301   access_user,
302   0,
303   0,
304 };
305
306 static char *auac_fields[] = {
307   "login", "uid", "shell", "last", "first", "middle", "status", 
308   "clearid", "class", "comments", "signature", "secure",
309 };
310
311 static struct valobj auac_valobj[] = {
312   {V_CHAR, 0, USERS_TABLE, "login"},
313   {V_NUM, 1},
314   {V_CHAR, 2, USERS_TABLE, "shell"},
315   {V_CHAR, 3, USERS_TABLE, "last"},
316   {V_CHAR, 4, USERS_TABLE, "first"},
317   {V_CHAR, 5, USERS_TABLE, "middle"},
318   {V_NUM, 6},
319   {V_CHAR, 7, USERS_TABLE, "clearid"},
320   {V_TYPE, 8, 0, "class", 0, MR_BAD_CLASS},
321   {V_ID, 9, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
322   {V_NUM, 10}
323 };
324
325 static struct validate auac_validate = {
326   auac_valobj,
327   11,
328   "login",
329   "login = '%s'",
330   1,
331   "users_id",
332   0,
333   setup_ausr,
334   followup_ausr,
335 };
336
337 static struct validate ausr_validate = {
338   auac_valobj,
339   9,
340   "login",
341   "login = '%s'",
342   1,
343   "users_id",
344   0,
345   setup_ausr,
346   followup_ausr,
347 };
348
349 static char *rusr_fields[] = {
350   "uid", "login", "fs_type"
351 };
352
353 static struct valobj rusr_valobj[] = {
354   {V_NUM, 0},
355   {V_CHAR, 1},
356   {V_NUM, 2},
357 };
358
359 static struct validate rusr_validate = {
360   rusr_valobj,
361   3,
362   0,
363   0,
364   0,
365   0,
366   0,
367   register_user,
368   0,
369 };
370
371 static char *uuac_fields[] = {
372   "login",
373   "newlogin", "uid", "shell", "last", "first", "middle", "status", 
374   "clearid", "class", "comments", "signature", "secure",
375 };
376
377 static struct valobj uuac_valobj[] = {
378   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
379   {V_RENAME, 1, USERS_TABLE, "login", "users_id", MR_NOT_UNIQUE},
380   {V_NUM, 2},
381   {V_CHAR, 3, USERS_TABLE, "shell"},
382   {V_CHAR, 4, USERS_TABLE, "first"},
383   {V_CHAR, 5, USERS_TABLE, "last"},
384   {V_CHAR, 6, USERS_TABLE, "middle"},
385   {V_NUM, 7},
386   {V_CHAR, 8, USERS_TABLE, "clearid"},
387   {V_TYPE, 9, 0, "class", 0, MR_BAD_CLASS},
388   {V_ID, 10, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
389   {V_NUM, 12},
390 };
391
392 static struct validate uuac_validate = {
393   uuac_valobj,
394   12,
395   0,
396   0,
397   0,
398   "users_id",
399   0,
400   setup_ausr,
401   followup_uuac,
402 };
403
404 static struct validate uusr_validate = {
405   uuac_valobj,
406   11,
407   0,
408   0,
409   0,
410   "users_id",
411   0,
412   setup_ausr,
413   set_modtime_by_id,
414 };
415
416 static char *uush_fields[] = {
417   "login",
418   "shell",
419 };
420
421 static struct valobj uush_valobj[] = {
422   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
423   {V_CHAR, 1, USERS_TABLE, "shell"},
424 };
425
426 static struct validate uush_validate = {
427   uush_valobj,
428   2,
429   0,
430   0,
431   0,
432   "users_id",
433   access_user,
434   0,
435   set_modtime_by_id,
436 };
437
438 static char *uust_fields[] = {
439   "login",
440   "status",
441 };
442
443 static char *uuss_fields[] = {
444   "login",
445   "secure",
446 };
447
448 static struct valobj uust_valobj[] = {
449   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
450   {V_NUM, 1},
451   {V_NUM, 2},
452 };
453
454 static struct validate uust_validate = {
455   uust_valobj,
456   2,
457   0,
458   0,
459   0,
460   "users_id",
461   0,
462   0,
463   set_modtime_by_id,
464 };
465
466 static char *uudf_fields[] = {
467   "login",
468   "dirsuppress", "dirremote"
469 };
470
471 static struct validate uudf_validate = {
472   uust_valobj,
473   3,
474   0,
475   0,
476   0,
477   "users_id",
478   access_user,
479   0,
480   set_modtime_by_id,
481 };
482
483 static char *dusr_fields[] = {
484   "login",
485 };
486
487 static struct validate dusr_validate = {
488   VOuser0,
489   1,
490   0,
491   0,
492   0,
493   0,
494   0,
495   setup_dusr,
496   0,
497 };
498
499 static char *dubu_fields[] = {
500   "uid",
501 };
502
503 static struct valobj dubu_valobj[] = {
504   {V_ID, 0, USERS_TABLE, "uid", "users_id", MR_USER}
505 };
506
507 static struct validate dubu_validate = {
508   dubu_valobj,
509   1,
510   0,
511   0,
512   0,
513   0,
514   0,
515   setup_dusr,
516   0,
517 };
518
519 static char *gkum_fields[] = { "login", "kerberos",
520                                    "login", "kerberos" };
521
522 static char *akum_fields[] = { "login", "kerberos" };
523
524 static struct valobj akum_valobj[] =
525 {
526   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
527   {V_ID, 1, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
528 };
529
530 static struct validate akum_validate =
531 {
532   akum_valobj,
533   2,
534   "users_id",
535   "users_id = %d or string_id = %d",
536   2,
537   "users_id",
538   access_user,
539   setup_akum,
540   0,
541 };
542
543 static struct validate dkum_validate =
544 {
545   akum_valobj,
546   2,
547   "users_id",
548   "users_id = %d and string_id = %d",
549   2,
550   "users_id",
551   access_user,
552   0,
553   0,
554 };
555
556 static char *gfbl_fields[] = {
557   "login",
558   "login", "fullname", "nickname", "home_addr",
559   "home_phone", "office_addr", "office_phone", "department", 
560   "affiliation", "modtime", "modby", "modwith",
561 };
562
563 static struct validate gfbl_validate = {
564   VOuser0,
565   1,
566   0,
567   0,
568   0,
569   0,
570   access_user,
571   0,
572   followup_fix_modby,
573 };
574
575 static char *ufbl_fields[] = {
576   "login",
577   "fullname", "nickname", "home_addr",
578   "home_phone", "office_addr", "office_phone", "department", 
579   "affiliation",
580 };
581
582 static struct valobj ufbl_valobj[] = {
583   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
584   {V_LEN, 1, USERS_TABLE, "fullname"},
585   {V_LEN, 2, USERS_TABLE, "nickname"},
586   {V_LEN, 3, USERS_TABLE, "home_addr"},
587   {V_LEN, 4, USERS_TABLE, "home_phone"},
588   {V_LEN, 5, USERS_TABLE, "office_addr"},
589   {V_LEN, 6, USERS_TABLE, "office_phone"},
590   {V_LEN, 7, USERS_TABLE, "department"},
591   {V_LEN, 8, USERS_TABLE, "affiliation"},
592 };
593
594 static struct validate ufbl_validate = {
595   ufbl_valobj,
596   9,
597   0,
598   0,
599   0,
600   0,
601   access_user,
602   0,
603   set_finger_modtime,
604 };
605
606 static char *gpob_fields[] = {
607   "login",
608   "login", "type", "box", "modtime", "modby", "modwith",
609 };
610
611 static struct validate gpob_validate = {
612   VOuser0,
613   1,
614   "potype",
615   "potype != 'NONE' and users_id=%d",
616   1,
617   0,
618   access_user,
619   0,
620   followup_gpob,
621 };
622
623 static char *gpox_fields[] = {
624   "login", "type", "box",
625 };
626
627 static struct validate gpox_validate = {
628   0,
629   0,
630   0,
631   0,
632   0,
633   0,
634   0,
635   0,
636   followup_gpob,
637 };
638
639 static char *spob_fields[] = {
640   "login", "type", "box",
641 };
642
643 static struct valobj spob_valobj[] = {
644   {V_ID, 0, USERS_TABLE, "login", "users_id", MR_USER},
645   {V_TYPE, 1, 0, "pobox", 0, MR_TYPE},
646 };
647
648 static struct validate spob_validate =  /* SET_POBOX */
649 {
650   spob_valobj,
651   2,
652   0,
653   0,
654   0,
655   0,
656   access_user,
657   0,
658   set_pobox,
659 };
660
661 static struct validate spop_validate =  /* SET_POBOX_POP */
662 {
663   VOuser0,
664   1,
665   0,
666   0,
667   0,
668   0,
669   access_user,
670   setup_spop,
671   set_pobox_modtime,
672 };
673
674 static struct validate dpob_validate =  /* DELETE_POBOX */
675 {
676   VOuser0,
677   1,
678   0,
679   0,
680   0,
681   0,
682   access_user,
683   setup_dpob,
684   set_pobox_modtime,
685 };
686
687 static char *gmac_fields[] = {
688   "name",
689   "name", "type", "modtime", "modby", "modwith",
690 };
691
692 static char *ghst_fields[] = {
693   "name", "address", "location", "network",
694   "name", "vendor", "model", "os", "location", "contact", "use", "status", "status_change", "network", "address", "ace_type", "ace_name", "admin_comment", "ops_comment", "created", "creator", "inuse", "modtime", "modby", "modwith",
695 };
696
697 static struct validate ghst_validate = { 
698   0,
699   0,
700   0,
701   0,
702   0,
703   0,
704   access_host,
705   0,
706   followup_ghst,
707 };
708
709 static char *ahst_fields[] = {
710   "name", "vendor", "model", "os", "location", "contact", "use", "status", "subnet", "address", "ace_type", "ace_name", "admin_comment", "ops_comment",
711 };
712
713 static struct valobj ahst_valobj[] = {
714   {V_CHAR, 0, MACHINE_TABLE, "name"},
715   {V_CHAR, 1, MACHINE_TABLE, "vendor"},
716   {V_CHAR, 2, MACHINE_TABLE, "model"},
717   {V_CHAR, 3, MACHINE_TABLE, "os"},
718   {V_CHAR, 4, MACHINE_TABLE, "location"},
719   {V_CHAR, 5, MACHINE_TABLE, "contact"},
720   {V_NUM, 6},
721   {V_NUM, 7},
722   {V_ID, 8, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
723   {V_TYPE, 10, 0, "ace_type", 0, MR_ACE},
724   {V_TYPEDATA, 11, 0, 0, 0, MR_ACE},
725   {V_ID, 12, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
726   {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
727 };
728
729 static struct validate ahst_validate = {
730   ahst_valobj,
731   13,
732   "name",
733   "name = UPPER('%s')",
734   1,
735   "mach_id",
736   access_host,
737   setup_ahst,
738   set_uppercase_modtime,
739 };
740
741 static char *uhst_fields[] = {
742   "name",
743   "newname", "vendor", "model", "os", "location", "contact", "use", "status", "subnet", "address", "ace_type", "ace_name", "admin_comment", "ops_comment",
744 };
745
746 static struct valobj uhst_valobj[] = {
747   {V_CHAR, 0, MACHINE_TABLE, "name"},
748   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
749   {V_RENAME, 1, MACHINE_TABLE, "name", "mach_id", MR_NOT_UNIQUE},
750   {V_CHAR, 2, MACHINE_TABLE, "vendor"},
751   {V_CHAR, 3, MACHINE_TABLE, "model"},
752   {V_CHAR, 4, MACHINE_TABLE, "os"},
753   {V_CHAR, 5, MACHINE_TABLE, "location"},
754   {V_CHAR, 6, MACHINE_TABLE, "contact"},
755   {V_NUM, 7},
756   {V_NUM, 8},
757   {V_ID, 9, SUBNET_TABLE, "name", "snet_id", MR_SUBNET},
758   {V_TYPE, 11, 0, "ace_type", 0, MR_ACE},
759   {V_TYPEDATA, 12, 0, 0, 0, MR_ACE},
760   {V_ID, 13, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
761   {V_ID, 14, STRINGS_TABLE, "string", "string_id", MR_NO_MATCH},
762 };
763
764 static struct validate uhst_validate = {
765   uhst_valobj,
766   15,
767   0,
768   0,
769   0,
770   "mach_id",
771   access_host,
772   setup_ahst,
773   set_modtime_by_id,
774 };
775
776 static char *dhst_fields[] = {
777   "name",
778 };
779
780 static struct validate dhst_validate = {
781   VOmach0,
782   1,
783   0,
784   0,
785   0,
786   0,
787   0,
788   setup_dmac,
789   0,
790 };
791
792 static char *ghal_fields[] = {
793     "alias", "canonical_hostname",
794     "alias", "canonical_hostname"
795 };
796
797 static struct validate ghal_validate = {
798   0,
799   0,
800   0,
801   0,
802   0,
803   0,
804   access_ahal,
805   0,
806   0,
807 };
808
809 static struct valobj ahal_valobj[] = {
810   {V_CHAR, 0, HOSTALIAS_TABLE, "name"},
811   {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
812 };
813
814 static struct validate ahal_validate = {
815   ahal_valobj,
816   2,
817   "name",
818   "name = '%s'",
819   1,
820   "mach_id",
821   access_ahal,
822   setup_ahal,
823   0,
824 };
825
826 static struct valobj dhal_valobj[] = {
827   {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
828 };
829
830 static struct validate dhal_validate = {
831   dhal_valobj,
832   1,
833   "name",
834   "name = '%s' AND mach_id = %d",
835   2,
836   "mach_id",
837   access_ahal,
838   0,
839   0,
840 };
841
842 static char *gsnt_fields[] = {
843     "name",
844     "name", "description", "address", "mask", "low", "high", "prefix", "ace_type", "ace_name",
845     "modtime", "modby", "modwith"
846 };
847
848 static struct validate gsnt_validate = {
849   0,
850   0,
851   0,
852   0,
853   0,
854   0,
855   access_snt,
856   0,
857   followup_gsnt,
858 };
859
860 static char *asnt_fields[] = {
861     "name", "description", "address", "mask", "low", "high", "prefix", "ace_type", "ace_name",
862 };
863
864 static struct valobj asnt_valobj[] = {
865   {V_CHAR, 0, SUBNET_TABLE, "name"},
866   {V_LEN, 1, SUBNET_TABLE, "description"},
867   {V_NUM, 2},
868   {V_NUM, 3},
869   {V_NUM, 4},
870   {V_NUM, 5},
871   {V_LEN, 6, SUBNET_TABLE, "prefix"},
872   {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
873   {V_TYPEDATA, 8, 0, 0, 0, MR_ACE},
874 };
875
876 static struct validate asnt_validate = 
877 {
878     asnt_valobj,
879     9,
880     "name",
881     "name = UPPER('%s')",
882     1,
883     "snet_id",
884     0,
885     prefetch_value,
886     set_uppercase_modtime,
887 };
888
889 static char *usnt_fields[] = {
890     "name",
891     "newname", "description", "address", "mask", "low", "high", "prefix", "ace_type", "ace_name",
892 };
893
894 static struct valobj usnt_valobj[] = {
895   {V_ID, 0, SUBNET_TABLE, "name", "snet_id", MR_NO_MATCH},
896   {V_RENAME, 1, SUBNET_TABLE, "name", "snet_id", MR_NOT_UNIQUE},
897   {V_LEN, 2, SUBNET_TABLE, "description"},
898   {V_NUM, 3},
899   {V_NUM, 4},
900   {V_NUM, 5},
901   {V_NUM, 6},
902   {V_LEN, 7, SUBNET_TABLE, "prefix"},
903   {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
904   {V_TYPEDATA, 9, 0, 0, 0, MR_ACE},
905 };
906
907 static struct validate usnt_validate = 
908 {
909     usnt_valobj,
910     10,
911     "name",
912     "snet_id = %d",
913     1,
914     "snet_id",
915     0,
916     0,
917     set_modtime_by_id,
918 };
919
920 static char *dsnt_fields[] = {
921   "name",
922 };
923
924 static struct validate dsnt_validate = {
925   VOsnet0,
926   1,
927   0,
928   0,
929   0,
930   0,
931   0,
932   setup_dsnt,
933   0,
934 };
935
936 static char *gclu_fields[] = {
937   "name",
938   "name", "description", "location", "modtime", "modby", "modwith", 
939 };
940
941 static char *aclu_fields[] = {
942   "name", "description", "location",
943 };
944
945 static struct valobj aclu_valobj[] = {
946   {V_CHAR, 0, CLUSTER_TABLE, "name"},
947   {V_LEN, 1, CLUSTER_TABLE, "description"},
948   {V_LEN, 2, CLUSTER_TABLE, "location"},
949 };
950
951 static struct validate aclu_validate =  
952 {
953   aclu_valobj,
954   3,
955   "name",
956   "name = '%s'",
957   1,
958   "clu_id",
959   0,
960   prefetch_value,
961   set_modtime,
962 };
963
964 static char *uclu_fields[] = {
965   "name",
966   "newname", "description", "location",
967 };
968
969 static struct valobj uclu_valobj[] = {
970   {V_ID, 0, CLUSTER_TABLE, "name", "clu_id", MR_CLUSTER},
971   {V_RENAME, 1, CLUSTER_TABLE, "name", "clu_id", MR_NOT_UNIQUE},
972   {V_LEN, 2, CLUSTER_TABLE, "description"},
973   {V_LEN, 3, CLUSTER_TABLE, "location"},
974 };
975
976 static struct validate uclu_validate = {
977   uclu_valobj,
978   4,
979   0,
980   0,
981   0,
982   "clu_id",
983   0,
984   0,
985   set_modtime_by_id,
986 };
987
988 static char *dclu_fields[] = {
989   "name",
990 };
991
992 static struct validate dclu_validate = {
993   VOclu0,
994   1,
995   0,
996   0,
997   0,
998   0,
999   0,
1000   setup_dclu,
1001   0,
1002 };
1003
1004 static char *gmcm_fields[] = {
1005   "machine", "cluster",
1006   "machine", "cluster",
1007 };
1008
1009 static struct valobj amtc_valobj[] =    /* ADD_MACHINE_TO_CLUSTER */
1010 {                                       /* DELETE_MACHINE_FROM_CLUSTER */
1011   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1012   {V_ID, 1, CLUSTER_TABLE, "name", "clu_id", MR_CLUSTER},
1013 };
1014
1015 static struct validate amtc_validate = /* for amtc and dmfc */
1016 {
1017   amtc_valobj,
1018   2,
1019   "mach_id",
1020   "mach_id = %d and clu_id = %d",
1021   2,
1022   0,
1023   0,
1024   0,
1025   set_mach_modtime_by_id,
1026 };
1027
1028 static char *gcld_fields[] = {
1029   "cluster", "serv_label",
1030   "cluster", "serv_label", "serv_cluster",
1031 };
1032
1033 static char *acld_fields[] = {
1034   "cluster", "serv_label", "serv_cluster",
1035 };
1036
1037 static struct valobj acld_valobj[] =
1038 {
1039   {V_ID, 0, CLUSTER_TABLE, "name", "clu_id", MR_CLUSTER},
1040   {V_CHAR, 1, SVC_TABLE, "serv_label"},
1041   {V_CHAR, 2, SVC_TABLE, "serv_cluster"}
1042 };
1043
1044 static struct validate acld_validate =  
1045 {                                       
1046   acld_valobj,
1047   3,
1048   "clu_id",
1049   "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
1050   3,
1051   0,
1052   0,
1053   0,
1054   set_cluster_modtime_by_id,
1055 };
1056
1057 static struct valobj dcld_valobj[] =
1058 {
1059   {V_ID, 0, CLUSTER_TABLE, "name", "clu_id", MR_CLUSTER},
1060 };
1061
1062 static struct validate dcld_validate =  
1063 {                                       
1064   dcld_valobj,
1065   1,
1066   "clu_id",
1067   "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",
1068   3,
1069   0,
1070   0,
1071   0,
1072   set_cluster_modtime_by_id,
1073 };
1074
1075 static char *glin_fields[] = {
1076   "name",
1077   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1078   "ace_type", "ace_name", "description", "modtime", "modby", "modwith",
1079 };
1080
1081 static struct validate glin_validate = {
1082   0,
1083   0,
1084   0,
1085   0,
1086   0,
1087   0,
1088   access_vis_list_by_name,
1089   0,
1090   get_list_info,
1091 };
1092
1093 static char *alis_fields[] = {
1094   "name", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1095   "ace_type", "ace_name", "description",
1096 };
1097
1098 static struct valobj alis_valobj[] = {
1099   {V_CHAR, 0, LIST_TABLE, "name"},
1100   {V_NUM, 1},
1101   {V_NUM, 2},
1102   {V_NUM, 3},
1103   {V_NUM, 4},
1104   {V_NUM, 5},
1105   {V_NUM, 6},
1106   {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
1107   {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
1108   {V_LEN, 9, LIST_TABLE, "description"},
1109 };
1110
1111 static struct validate alis_validate = {
1112   alis_valobj,
1113   10,
1114   "name",
1115   "name = '%s'",
1116   1,
1117   "list_id",
1118   0,
1119   setup_alis,
1120   set_modtime,
1121 };
1122
1123 static char *ulis_fields[] = {
1124   "name",
1125   "newname", "active", "publicflg", "hidden", "maillist", "grouplist", "gid",
1126   "ace_type", "ace_name", "description",
1127 };
1128
1129 static struct valobj ulis_valobj[] = {
1130   {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
1131   {V_RENAME, 1, LIST_TABLE, "name", "list_id", MR_NOT_UNIQUE},
1132   {V_NUM, 2},
1133   {V_NUM, 3},
1134   {V_NUM, 4},
1135   {V_NUM, 5},
1136   {V_NUM, 6},
1137   {V_NUM, 7},
1138   {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
1139   {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
1140   {V_LEN, 10, LIST_TABLE, "description"},
1141 };
1142
1143 static struct validate ulis_validate = {
1144   ulis_valobj,
1145   11,
1146   "name",
1147   "list_id = %d",
1148   1,
1149   "list_id",
1150   access_list,
1151   setup_alis,
1152   set_modtime_by_id,
1153 };
1154
1155 static char *dlis_fields[] = {
1156   "name",
1157 };
1158
1159 static struct validate dlis_validate = {
1160   VOlist0,
1161   1,
1162   "name",
1163   "list_id = %d",
1164   1,
1165   0,
1166   access_list,
1167   setup_dlis,
1168   0,
1169 };
1170
1171 static char *amtl_fields[] = {
1172   "list_name", "member_type", "member_name",
1173 };
1174
1175 static struct valobj amtl_valobj[] = {
1176   {V_ID, 0, LIST_TABLE, "name", "list_id", MR_LIST},
1177   {V_TYPE, 1, 0, "member", 0, MR_TYPE},
1178   {V_TYPEDATA, 2, 0, 0, 0, MR_NO_MATCH},
1179 };
1180
1181 static struct validate amtl_validate =
1182 {
1183   amtl_valobj,
1184   3,
1185   0,
1186   0,
1187   0,
1188   0,
1189   access_list,
1190   0,
1191   add_member_to_list,
1192 };
1193
1194 static struct validate dmfl_validate =
1195 {
1196   amtl_valobj,
1197   3,
1198   0,
1199   0,
1200   0,
1201   0,
1202   access_list,
1203   0,
1204   delete_member_from_list,
1205 };
1206
1207 static char *gaus_fields[] = {
1208   "ace_type", "ace_name",
1209   "use_type", "use_name",
1210 };
1211
1212 static struct valobj gaus_valobj[] = {
1213   {V_TYPE, 0, 0, "gaus", 0, MR_TYPE},
1214   {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
1215 };
1216
1217 static struct validate gaus_validate = {
1218   gaus_valobj,
1219   2,
1220   0,
1221   0,
1222   0,
1223   0,
1224   access_member,
1225   0,
1226   get_ace_use,
1227 };
1228
1229 static char *qgli_fields[] = {
1230   "active", "publicflg", "hidden", "maillist", "grouplist",
1231   "list",
1232 };
1233
1234 static struct valobj qgli_valobj[] = {
1235   {V_TYPE, 0, 0, "boolean", 0, MR_TYPE},
1236   {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
1237   {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
1238   {V_TYPE, 3, 0, "boolean", 0, MR_TYPE},
1239   {V_TYPE, 4, 0, "boolean", 0, MR_TYPE},
1240 };
1241
1242 static struct validate qgli_validate = {
1243   qgli_valobj,
1244   5,
1245   0,
1246   0,
1247   0,
1248   0,
1249   access_qgli,
1250   0,
1251   qualified_get_lists,
1252 };
1253
1254 static char *gmol_fields[] = {
1255   "list_name",
1256   "member_type", "member_name",
1257 };
1258
1259 static struct validate gmol_validate = {
1260   VOlist0,
1261   1,
1262   0,
1263   0,
1264   0,
1265   0,
1266   access_visible_list,
1267   0,
1268   get_members_of_list,
1269 };
1270
1271 static struct validate geml_validate = {
1272   VOlist0,
1273   1,
1274   0,
1275   0,
1276   0,
1277   0,
1278   access_visible_list,
1279   0,
1280   get_end_members_of_list,
1281 };
1282
1283 static char *glom_fields[] = {
1284   "member_type", "member_name",
1285   "list_name", "active", "publicflg", "hidden", "maillist", "grouplist",
1286 };
1287
1288 static struct valobj glom_valobj[] = {
1289    {V_TYPE, 0, 0, "rmember", 0, MR_TYPE},
1290    {V_TYPEDATA, 1, 0, 0, 0, MR_NO_MATCH},
1291 };
1292
1293 static struct validate glom_validate = {
1294   glom_valobj,
1295   2,
1296   0,
1297   0,
1298   0,
1299   0,
1300   access_member,
1301   0,
1302   get_lists_of_member,
1303 };
1304
1305 static char *cmol_fields[] = {
1306   "list_name",
1307   "count",
1308 };
1309
1310 static struct validate cmol_validate = {
1311   VOlist0,
1312   1,
1313   0,
1314   0,
1315   0,
1316   0,
1317   access_visible_list,
1318   0,
1319   count_members_of_list,
1320 };
1321
1322 static char *gsin_fields[] = {
1323   "service",
1324   "service", "update_int", "target_file", "script", "dfgen", "dfcheck",
1325   "type", "enable", "inprogress", "harderror", "errmsg",
1326   "ace_type", "ace_name", "modtime", "modby", "modwith",
1327 };
1328
1329 static struct validate gsin_validate = 
1330 {
1331   0,
1332   0,
1333   0,
1334   0,
1335   0,
1336   0,
1337   access_service,
1338   0,
1339   followup_glin,
1340 };
1341
1342 static char *qgsv_fields[] = {
1343   "enable", "inprogress", "harderror",
1344   "service",
1345 };
1346
1347 static struct valobj qgsv_valobj[] = {
1348   {V_TYPE, 0, 0, "boolean", 0, MR_TYPE},
1349   {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
1350   {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
1351 };
1352
1353 static struct validate qgsv_validate = {
1354   qgsv_valobj,
1355   3,
1356   0,
1357   0,
1358   0,
1359   0,
1360   0,
1361   0,
1362   qualified_get_server,
1363 };
1364
1365 static char *asin_fields[] = {
1366   "service", "update_int", "target_file", "script", "type", "enable",
1367   "ace_type", "ace_name",
1368 };
1369
1370 static struct valobj asin_valobj[] = {
1371   {V_CHAR, 0, SERVERS_TABLE, "name"},
1372   {V_NUM, 1},
1373   {V_LEN, 2, SERVERS_TABLE, "target_file"},
1374   {V_LEN, 3, SERVERS_TABLE, "script"},
1375   {V_TYPE, 4, 0, "service", 0, MR_TYPE},
1376   {V_NUM, 5},
1377   {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
1378   {V_TYPEDATA, 7, 0, 0, 0, MR_ACE},
1379 };
1380
1381 static struct validate asin_validate =  /* for asin, usin */
1382 {
1383   asin_valobj,
1384   8,
1385   "name",
1386   "name = UPPER('%s')",
1387   1,
1388   0,
1389   0,
1390   0,
1391   set_uppercase_modtime,
1392 };
1393
1394 static struct validate rsve_validate = {
1395   asin_valobj,
1396   1,
1397   "name",
1398   "name = UPPER('%s')",
1399   1,
1400   0,
1401   access_service,
1402   0,
1403   set_uppercase_modtime,
1404 };
1405
1406 static char *ssif_fields[] = {
1407   "service", "dfgen", "dfcheck", "inprogress", "harderror", "errmsg",
1408 };
1409
1410 static struct valobj ssif_valobj[] = {
1411   {V_NUM, 1},
1412   {V_NUM, 2},
1413   {V_NUM, 3},
1414   {V_NUM, 4},
1415   {V_LEN, 5, SERVERS_TABLE, "errmsg"},
1416 };
1417
1418 static struct validate ssif_validate = {
1419   ssif_valobj,
1420   5,
1421   "name",
1422   "name = UPPER('%s')",
1423   1,
1424   0,
1425   0,
1426   0,
1427   0,
1428 };
1429
1430 static char *dsin_fields[] = {
1431   "service",
1432 };
1433
1434 static struct validate dsin_validate = {
1435   asin_valobj,
1436   1,
1437   "name",
1438   "name = UPPER('%s')",
1439   1,
1440   0,
1441   0,
1442   setup_dsin,
1443   0,
1444 };
1445
1446 static char *gshi_fields[] = {
1447   "service", "machine",
1448   "service", "machine", "enable", "override", "success", "inprogress",
1449   "hosterror", "hosterrormsg", "ltt", "lts", "value1", "value2",
1450   "value3", "modtime", "modby", "modwith", 
1451 };
1452
1453 static struct validate gshi_validate = {
1454   0,
1455   0,
1456   0,
1457   0,
1458   0,
1459   0,
1460   access_service,
1461   0,
1462   followup_fix_modby,
1463 };
1464
1465 static char *qgsh_fields[] = {
1466   "service", "enable", "override", "success", "inprogress", "hosterror",
1467   "service", "machine",
1468 };
1469
1470 static struct valobj qgsh_valobj[] = {
1471   {V_TYPE, 1, 0, "boolean", 0, MR_TYPE},
1472   {V_TYPE, 2, 0, "boolean", 0, MR_TYPE},
1473   {V_TYPE, 3, 0, "boolean", 0, MR_TYPE},
1474   {V_TYPE, 4, 0, "boolean", 0, MR_TYPE},
1475   {V_TYPE, 5, 0, "boolean", 0, MR_TYPE},
1476 };
1477
1478 static struct validate qgsh_validate = {
1479   qgsh_valobj,
1480   5,
1481   0,
1482   0,
1483   0,
1484   0,
1485   0,
1486   0,
1487   qualified_get_serverhost,
1488 };
1489
1490 static char *ashi_fields[] = {
1491   "service", "machine", "enable", "value1", "value2", "value3",
1492 };
1493
1494 static struct valobj ashi_valobj[] = {
1495   {V_NAME, 0, SERVERS_TABLE, "name", 0, MR_SERVICE},
1496   {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1497   {V_NUM, 2},
1498   {V_NUM, 3},
1499   {V_NUM, 4},
1500   {V_LEN, 5, SERVERHOSTS_TABLE, "value3"},
1501 };
1502
1503 static struct validate ashi_validate = /* ashi & ushi */
1504 {
1505   ashi_valobj,
1506   6,
1507   "service",
1508   "service = UPPER('%s') AND mach_id = %d",
1509   2,
1510   0,
1511   access_service,
1512   0,
1513   set_serverhost_modtime,
1514 };
1515
1516 static struct validate rshe_validate =  
1517 {
1518   ashi_valobj,
1519   2,
1520   "service",
1521   "service = UPPER('%s') AND mach_id = %d",
1522   2,
1523   0,
1524   access_service,
1525   0,
1526   set_serverhost_modtime,
1527 };
1528
1529 static struct validate ssho_validate =  
1530 {
1531   ashi_valobj,
1532   2,
1533   "service",
1534   "service = UPPER('%s') AND mach_id = %d",
1535   2,
1536   0,
1537   access_service,
1538   0,
1539   trigger_dcm,
1540 };
1541
1542 static char *sshi_fields[] = {
1543   "service", "machine", "override", "success", "inprogress",
1544   "hosterror", "errmsg", "ltt", "lts",
1545 };
1546
1547 static struct valobj sshi_valobj[] = {
1548   {V_NAME, 0, SERVERS_TABLE, "name", 0, MR_SERVICE},
1549   {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1550   {V_NUM, 2},
1551   {V_NUM, 3},
1552   {V_NUM, 4},
1553   {V_NUM, 5},
1554   {V_LEN, 6, SERVERS_TABLE, "errmsg"},
1555   {V_NUM, 7},
1556   {V_NUM, 8},
1557 };
1558
1559 static struct validate sshi_validate =  
1560 {
1561   sshi_valobj,
1562   9,
1563   0,
1564   0,
1565   0,
1566   0,
1567   0,
1568   0,
1569   0,
1570 };
1571
1572 static char *dshi_fields[] = {
1573   "service", "machine",
1574 };
1575
1576 static struct validate dshi_validate =  
1577 {
1578   ashi_valobj,
1579   2,
1580   "service",
1581   "service = UPPER('%s') AND mach_id = %d",
1582   2,
1583   0,
1584   access_service,
1585   setup_dshi,
1586   0,
1587 };
1588
1589 static char *gslo_fields[] = {
1590   "server",
1591   "server", "machine",
1592 };
1593
1594 static char *gfsl_fields[] = {
1595   "label",
1596   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1597   "create", "lockertype", "modtime", "modby", "modwith",
1598 };
1599
1600 static char *gfsm_fields[] = {
1601   "machine",
1602   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1603   "create", "lockertype", "modtime", "modby", "modwith",
1604 };
1605
1606 static struct validate gfsm_validate = {
1607   VOmach0,
1608   1,
1609   0,
1610   0,
1611   0,
1612   0,
1613   0,
1614   0,
1615   followup_fix_modby,
1616 };
1617
1618 static char *gfsn_fields[] = {
1619   "machine", "parition",
1620   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1621   "create", "lockertype", "modtime", "modby", "modwith",
1622 };
1623
1624 static struct validate gfsn_validate = {
1625   VOmach0,
1626   1,
1627   0,
1628   0,
1629   0,
1630   0,
1631   0,
1632   0,
1633   followup_fix_modby,
1634 };
1635
1636 static char *gfsp_fields[] = {
1637   "path",
1638   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1639   "create", "lockertype", "modtime", "modby", "modwith",
1640 };
1641
1642 static char *gfsg_fields[] = {
1643   "list",
1644   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1645   "create", "lockertype", "modtime", "modby", "modwith",
1646 };
1647
1648 static struct validate gfsg_validate = {
1649   VOlist0,
1650   1,
1651   0,
1652   0,
1653   0,
1654   0,
1655   access_list,
1656   0,
1657   followup_fix_modby,
1658 };
1659
1660 static char *afil_fields[] = {
1661   "label", "type", "machine", "name", "mount", "access", "comments", "owner", "owners",
1662   "create", "lockertype",
1663 };
1664
1665 static struct valobj afil_valobj[] = {
1666   {V_CHAR, 0, FILESYS_TABLE, "label"},
1667   {V_TYPE, 1, 0, "filesys", 0, MR_FSTYPE},
1668   {V_ID, 2, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1669   {V_CHAR, 3, FILESYS_TABLE, "name"},
1670   {V_LEN, 4, FILESYS_TABLE, "mount"},
1671   {V_LEN, 5, FILESYS_TABLE, "rwaccess"},
1672   {V_LEN, 6, FILESYS_TABLE, "comments"},
1673   {V_ID, 7, USERS_TABLE, "login", "users_id", MR_USER},
1674   {V_ID, 8, LIST_TABLE, "name", "list_id", MR_LIST},
1675   {V_NUM, 9},
1676   {V_TYPE, 10, 0, "lockertype", 0, MR_TYPE},
1677 };
1678
1679 static struct validate afil_validate = {
1680   afil_valobj,
1681   11,
1682   "label",
1683   "label = '%s'",
1684   1,
1685   "filsys_id",
1686   0,
1687   setup_afil,
1688   set_filesys_modtime,
1689 };
1690
1691 static char *ufil_fields[] = {
1692   "label", "newlabel", "type", "machine", "name", "mount", "access", "comments",
1693   "owner", "owners", "create", "lockertype",
1694 };
1695
1696 static struct valobj ufil_valobj[] = {
1697   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
1698   {V_RENAME, 1, FILESYS_TABLE, "label", "filsys_id", MR_NOT_UNIQUE},
1699   {V_TYPE, 2, 0, "filesys", 0, MR_FSTYPE},
1700   {V_ID, 3, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1701   {V_CHAR, 4, FILESYS_TABLE, "name"},
1702   {V_LEN, 5, FILESYS_TABLE, "mount"},
1703   {V_LEN, 6, FILESYS_TABLE, "rwaccess"},
1704   {V_LEN, 7, FILESYS_TABLE, "comments"},
1705   {V_ID, 8, USERS_TABLE, "login", "users_id", MR_USER},
1706   {V_ID, 9, LIST_TABLE, "name", "list_id", MR_LIST},
1707   {V_NUM, 10},
1708   {V_TYPE, 11, 0, "lockertype", 0, MR_TYPE},
1709 };
1710
1711 static struct validate ufil_validate = {
1712   ufil_valobj,
1713   12,
1714   "label",
1715   "filsys_id = %d",
1716   1,
1717   "filsys_id",
1718   0,
1719   setup_ufil,
1720   set_filesys_modtime,
1721 };
1722
1723 static char *dfil_fields[] = {
1724   "label",
1725 };
1726
1727 static struct validate dfil_validate = {
1728   VOfilsys0,
1729   1,
1730   "label",
1731   "filsys_id = %d",
1732   1,
1733   0,
1734   0,
1735   setup_dfil,
1736   0,
1737 };
1738
1739 static char *gfgm_fields[] = {
1740   "fsgroup", "filesys", "sortkey"
1741 };
1742
1743 static struct validate gfgm_validate = {
1744   VOfilsys0,
1745   1,
1746   0,
1747   0,
1748   0,
1749   0,
1750   0,
1751   0,
1752   0,
1753 };
1754
1755 static struct valobj aftg_valobj[] = {
1756   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
1757   {V_ID, 1, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
1758 };
1759
1760 static struct validate aftg_validate = {
1761   aftg_valobj,
1762   2,
1763   "group_id",
1764   "group_id = %d and filsys_id = %d",
1765   2,
1766   0,
1767   0,
1768   0,
1769   0,
1770 };
1771
1772 static char *ganf_fields[] = {
1773   "machine", "dir", "device", "status", "allocated", "size", "modtime", "modby", "modwith",
1774 };
1775
1776 static char *gnfp_fields[] = {
1777   "machine", "dir",
1778   "machine", "dir", "device", "status", "allocated", "size", "modtime", "modby", "modwith",
1779 };
1780
1781 static struct validate gnfp_validate = {
1782   VOmach0,
1783   1,
1784   0,
1785   0,
1786   0,
1787   0,
1788   0,
1789   0,
1790   followup_fix_modby,
1791 };
1792
1793 static struct valobj anfp_valobj[] = {
1794   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1795   {V_CHAR, 1, NFSPHYS_TABLE, "dir"},
1796   {V_LEN, 2, NFSPHYS_TABLE, "device"},
1797   {V_NUM, 3},
1798   {V_NUM, 4},
1799   {V_NUM, 5},
1800 };
1801
1802 static struct validate anfp_validate = {
1803   anfp_valobj,
1804   6,
1805   "dir",
1806   "mach_id = %d and dir = '%s'",
1807   2,
1808   "nfsphys_id",
1809   0,
1810   prefetch_value,
1811   set_nfsphys_modtime,
1812 };
1813
1814 static struct validate unfp_validate = {
1815   anfp_valobj,
1816   6,
1817   "dir",
1818   "mach_id = %d and dir = '%s'",
1819   2,
1820   "nfsphys_id",
1821   0,
1822   0,
1823   set_nfsphys_modtime,
1824 };
1825
1826 static char *ajnf_fields[] = {
1827   "machine", "dir", "adjustment",
1828 };
1829
1830 static struct valobj ajnf_valobj[] = {
1831   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
1832   {V_CHAR, 1, NFSPHYS_TABLE, "dir"},
1833   {V_NUM, 2},
1834 };
1835
1836 static struct validate ajnf_validate = {
1837   ajnf_valobj,
1838   3,
1839   "dir",
1840   "mach_id = %d and dir = '%s'",
1841   2,
1842   "nfsphys_id",
1843   0,
1844   0,
1845   set_nfsphys_modtime,
1846 };
1847
1848 static char *dnfp_fields[] = {
1849   "machine", "dir",
1850 };
1851
1852 static struct validate dnfp_validate = {
1853   VOmach0,
1854   1,
1855   "dir",
1856   "mach_id = %d and dir = '%s'",
1857   2,
1858   "nfsphys_id",
1859   0,
1860   setup_dnfp,
1861   set_nfsphys_modtime,
1862 };
1863
1864 static char *gqot_fields[] = {
1865   "filesys", "type", "name",
1866   "filesys", "type", "name", "quota", "dir", "machine", "modtime", "modby", "modwith",
1867 };
1868
1869 static struct valobj gqot_valobj[] = {
1870   {V_TYPE, 1, 0, "quota_type", 0, MR_TYPE},
1871   {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
1872 };
1873
1874 static struct validate gqot_validate = {
1875   gqot_valobj,
1876   2,
1877   0,
1878   0,
1879   0,
1880   0,
1881   0,
1882   0,
1883   followup_gqot,
1884 };
1885
1886 static char *gqbf_fields[] = {
1887   "filesys",
1888   "filesys", "type", "name", "quota", "dir", "machine", "modtime", "modby", "modwith",
1889 };
1890
1891 static struct validate gqbf_validate = {
1892   0,
1893   0,
1894   0,
1895   0,
1896   0,
1897   0,
1898   access_filesys,
1899   0,
1900   followup_gqot,
1901 };
1902
1903 static char *aqot_fields[] = {
1904   "filesys", "type", "name", "quota",
1905 };
1906
1907 static struct valobj aqot_valobj[] = {
1908   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
1909   {V_TYPE, 1, 0, "quota_type", 0, MR_TYPE},
1910   {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
1911   {V_NUM, 3},
1912 };
1913
1914 static struct validate aqot_validate = {
1915   aqot_valobj,
1916   4,
1917   "filsys_id",
1918   "filsys_id = %d and type = '%s' and entity_id = %d",
1919   3,
1920   0,
1921   0,
1922   prefetch_filesys,
1923   followup_aqot,
1924 };
1925
1926 static struct validate uqot_validate = {
1927   aqot_valobj,
1928   4,
1929   "filsys_id",
1930   "filsys_id = %d AND type = '%s' AND entity_id = %d",
1931   3,
1932   0,
1933   0,
1934   setup_dqot,
1935   followup_aqot,
1936 };
1937
1938 static struct validate dqot_validate = {
1939   aqot_valobj,
1940   3,
1941   "filsys_id",
1942   "filsys_id = %d AND type = '%s' AND entity_id = %d",
1943   3,
1944   0,
1945   0,
1946   setup_dqot,
1947   followup_dqot,
1948 };
1949
1950 static char *gnfq_fields[] = {
1951   "filesys", "login",
1952   "filesys", "login", "quota", "dir", "machine", "modtime", "modby", "modwith",
1953 };
1954
1955 static struct validate gnfq_validate = {
1956   0,
1957   0,
1958   0,
1959   0,
1960   0,
1961   0,
1962   access_filesys,
1963   0,
1964   followup_gqot,
1965 };
1966
1967 static char *gnqp_fields[] = {
1968   "machine", "dir",
1969   "filesys", "login", "quota", "dir", "machine", "modtime", "modby", "modwith",
1970 };
1971
1972 static char *anfq_fields[] = {
1973   "filesys", "login", "quota",
1974 };
1975
1976 static struct valobj anfq_valobj[] = {
1977   {V_ID, 0, FILESYS_TABLE, "label", "filsys_id", MR_FILESYS},
1978   {V_ID, 1, USERS_TABLE, "login", "users_id", MR_USER},
1979   {V_NUM, 2},
1980 };
1981
1982 static struct validate anfq_validate = {
1983   anfq_valobj,
1984   3,
1985   "filsys_id",
1986   "filsys_id = %d AND type = 'USER' AND entity_id = %d",
1987   2,
1988   0, /* object ? */
1989   0,
1990   prefetch_filesys,
1991   followup_aqot,
1992 };
1993
1994 static struct validate unfq_validate = {
1995   anfq_valobj,
1996   3,
1997   "filsys_id",
1998   "filsys_id = %d AND type = 'USER' AND entity_id = %d",
1999   2,
2000   0,
2001   0,
2002   setup_dqot,
2003   followup_aqot,
2004 };
2005
2006 static struct validate dnfq_validate = {
2007   anfq_valobj,
2008   2,
2009   "filsys_id",
2010   "filsys_id = %d AND entity_id = %d",
2011   2,
2012   0,
2013   0,
2014   setup_dqot,
2015   followup_dqot,
2016 };
2017
2018 static char *gzcl_fields[] = {
2019   "class",
2020   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
2021   "iws_type", "iws_name", "iui_type", "iui_name", "modtime", "modby", "modwith", 
2022 };
2023
2024 static struct validate gzcl_validate = {
2025   0,
2026   0,
2027   0,
2028   0,
2029   0,
2030   0,
2031   0,
2032   0,
2033   followup_gzcl,
2034 };
2035
2036 static char *azcl_fields[] = {
2037   "class", "xmt_type", "xmt_name", "sub_type", "sub_name",
2038   "iws_type", "iws_name", "iui_type", "iui_name",
2039 };
2040
2041 static struct valobj azcl_valobj[] = {
2042   {V_CHAR, 0, ZEPHYR_TABLE, "class"},
2043   {V_TYPE, 1, 0, "ace_type", 0, MR_ACE},
2044   {V_TYPEDATA, 2, 0, 0, "list_id", MR_ACE},
2045   {V_TYPE, 3, 0, "ace_type", 0, MR_ACE},
2046   {V_TYPEDATA, 4, 0, 0, "list_id", MR_ACE},
2047   {V_TYPE, 5, 0, "ace_type", 0, MR_ACE},
2048   {V_TYPEDATA, 6, 0, 0, "list_id", MR_ACE},
2049   {V_TYPE, 7, 0, "ace_type", 0, MR_ACE},
2050   {V_TYPEDATA, 8, 0, 0, "list_id", MR_ACE},
2051 };
2052
2053 static struct validate azcl_validate = {
2054   azcl_valobj,
2055   9,
2056   "class",
2057   "class = '%s'",
2058   1,
2059   0,
2060   0,
2061   0,
2062   set_zephyr_modtime,
2063 };
2064
2065 static char *uzcl_fields[] = {
2066   "class", "newclass", "xmt_type", "xmt_name", "sub_type", "sub_name",
2067   "iws_type", "iws_name", "iui_type", "iui_name",
2068 };
2069
2070 static struct valobj uzcl_valobj[] = {
2071   {V_RENAME, 1, ZEPHYR_TABLE, "class", 0, MR_NOT_UNIQUE},
2072   {V_TYPE, 2, 0, "ace_type", 0, MR_ACE},
2073   {V_TYPEDATA, 3, 0, 0, "list_id", MR_ACE},
2074   {V_TYPE, 4, 0, "ace_type", 0, MR_ACE},
2075   {V_TYPEDATA, 5, 0, 0, "list_id", MR_ACE},
2076   {V_TYPE, 6, 0, "ace_type", 0, MR_ACE},
2077   {V_TYPEDATA, 7, 0, 0, "list_id", MR_ACE},
2078   {V_TYPE, 8, 0, "ace_type", 0, MR_ACE},
2079   {V_TYPEDATA, 9, 0, 0, "list_id", MR_ACE},
2080 };
2081
2082 static struct validate uzcl_validate = {
2083   uzcl_valobj,
2084   9,
2085   "class",
2086   "class = '%s'",
2087   1,
2088   0,
2089   0,
2090   0,
2091   set_zephyr_modtime,
2092 };
2093
2094 static struct validate dzcl_validate = {
2095   0,
2096   0,
2097   "class",
2098   "class = '%s'",
2099   1,
2100   0,
2101   0,
2102   0,
2103   0,
2104 };
2105
2106 static char *gsha_fields[] = {
2107   "machine",
2108   "machine", "ace_type", "ace_name", "modtime", "modby", "modwith",
2109 };
2110
2111 static struct validate gsha_validate =  
2112 {
2113   0,
2114   0,
2115   0,
2116   0,
2117   0,
2118   0,
2119   0,
2120   0,
2121   followup_gsha,
2122 };
2123
2124 static char *asha_fields[] = {
2125   "machine", "ace_type", "ace_name",
2126 };
2127
2128 static struct valobj asha_valobj[] = {
2129   {V_ID, 0, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2130   {V_TYPE, 1, 0, "ace_type", 0, MR_ACE},
2131   {V_TYPEDATA, 2, 0, 0, 0, MR_ACE},
2132 };
2133
2134 static struct validate asha_validate =  
2135 {
2136   asha_valobj,
2137   3,
2138   "mach_id",
2139   "mach_id = %d",
2140   1,
2141   "mach_id",
2142   0,
2143   0,
2144   set_modtime_by_id,
2145 };
2146
2147 static char *gsvc_fields[] = {
2148   "service",
2149   "service", "protocol", "port", "description", "modtime", "modby", "modwith",
2150 };
2151
2152 static char *asvc_fields[] = {
2153   "service", "protocol", "port", "description",
2154 };
2155
2156 static struct valobj asvc_valobj[] = {
2157   {V_CHAR, 0, SERVICES_TABLE, "name"},
2158   {V_CHAR, 1, SERVICES_TABLE, "protocol"},
2159   {V_NUM, 2},
2160   {V_CHAR, 3, SERVICES_TABLE, "description"},
2161 };
2162
2163 static struct validate asvc_validate = {
2164   asvc_valobj,
2165   4,
2166   "name",
2167   "name = '%s'",
2168   1,
2169   0,
2170   0,
2171   0,
2172   set_modtime,
2173 };
2174
2175 static char *gpce_fields[] = {
2176   "printer",
2177   "printer", "spooling_host", "spool_directory", "rprinter",
2178   "quotaserver", "authenticate", "price", "comments",
2179   "modtime", "modby", "modwith",
2180 };
2181
2182 static struct validate gpce_validate = {
2183   0,
2184   0,
2185   0,
2186   0,
2187   0,
2188   0,
2189   0,
2190   0,
2191   followup_gpce,
2192 };
2193
2194 static char *apce_fields[] = {
2195   "printer", "spooling_host", "spool_directory", "rprinter",
2196   "quotaserver", "authenticate", "price", "comments",
2197   "modtime", "modby", "modwith",
2198 };
2199
2200 static struct valobj apce_valobj[] = {
2201   {V_CHAR, 0, PRINTCAP_TABLE, "name"},
2202   {V_ID, 1, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2203   {V_LEN, 2, PRINTCAP_TABLE, "dir"},
2204   {V_LEN, 3, PRINTCAP_TABLE, "rp"},
2205   {V_ID, 4, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2206   {V_NUM, 5},
2207   {V_NUM, 6},
2208   {V_CHAR, 7, PRINTCAP_TABLE, "comments"},
2209 };
2210
2211 static struct validate apce_validate = {
2212   apce_valobj,
2213   8,
2214   "name",
2215   "name = '%s'",
2216   1,
2217   0,
2218   0,
2219   0,
2220   set_modtime,
2221 };
2222
2223 static struct validate dpce_validate = {
2224   0,
2225   0,
2226   "name",
2227   "name = '%s'",
2228   1,
2229   0,
2230   0,
2231   0,
2232   0,
2233 };
2234
2235 static char *gpcp_fields[] = {
2236   "printer",
2237   "printer", "spooling_host", "spool_directory", "rprinter", "comments",
2238   "modtime", "modby", "modwith",
2239 };
2240
2241 static char *gpdm_fields[] = {
2242   "name",
2243   "name", "rpcnum", "host", "modtime", "modby", "modwith",
2244 };
2245
2246 static char *apdm_fields[] = {
2247   "name", "rpcnum", "host"
2248 };
2249
2250 static struct valobj apdm_valobj[] = {
2251   {V_CHAR, 0, PALLADIUM_TABLE, "name"},
2252   {V_NUM, 1},
2253   {V_ID, 2, MACHINE_TABLE, "name", "mach_id", MR_MACHINE},
2254 };
2255
2256 static struct validate apdm_validate = {
2257   apdm_valobj,
2258   3,
2259   "name",
2260   "name = '%s'",
2261   1,
2262   0,
2263   0,
2264   0,
2265   set_modtime,
2266 };
2267
2268 static struct validate dpdm_validate = {
2269   0,
2270   0,
2271   "name",
2272   "name = '%s'",
2273   1,
2274   0,
2275   0,
2276   0,
2277   0,
2278 };
2279
2280 static char *gali_fields[] = {
2281   "name", "type", "trans",
2282   "name", "type", "trans",
2283 };
2284
2285 static char *aali_fields[] = {
2286   "name", "type", "trans",
2287 };
2288
2289 static struct valobj aali_valobj[] = {
2290   {V_CHAR, 0, ALIAS_TABLE, "name"},
2291   {V_TYPE, 1, 0, "alias", 0, MR_TYPE},
2292   {V_CHAR, 2, ALIAS_TABLE, "trans"},
2293 };
2294
2295 static struct validate aali_validate = {
2296   aali_valobj,
2297   3,
2298   "trans",
2299   "name = '%s' and type = '%s' and trans = '%s'",
2300   3,
2301   0,
2302   0,
2303   0,
2304   0,
2305 };
2306
2307 static struct validate dali_validate =  /* DELETE_ALIAS */
2308 {
2309   0,
2310   0,
2311   "trans",
2312   "name = '%s' and type = '%s' and trans = '%s'",
2313   3,
2314   0,
2315   0,
2316   0,
2317   0,
2318 };
2319
2320 static char *gval_fields[] = {
2321   "name", "value",
2322 };
2323
2324 static struct valobj gval_valobj[] = {
2325   {V_NAME, 0, NUMVALUES_TABLE, "name", 0, MR_NO_MATCH},
2326 };
2327
2328 static struct validate gval_validate = {
2329   gval_valobj,
2330   1,
2331   0,
2332   0,
2333   0,
2334   0,
2335   0,
2336   0,
2337   0,
2338 };
2339
2340 static char *aval_fields[] = {
2341   "name", "value",
2342 };
2343
2344 static struct valobj aval_valobj[] = {
2345   {V_CHAR, 0, NUMVALUES_TABLE, "name"},
2346   {V_NUM, 1},
2347 };
2348
2349 static struct validate aval_validate =  /* for aval, uval, and dval */
2350 {
2351   aval_valobj,
2352   2,
2353   "name",
2354   "name = '%s'",
2355   1,
2356   0,
2357   0,
2358   0,
2359   0,
2360 };
2361
2362 static char *dval_fields[] = {
2363   "name",
2364 };
2365
2366 static char *gats_fields[] = {
2367   "table_name", "appends", "updates", "deletes", "modtime", "modby", "modwith",
2368 };
2369
2370 static char *_sdl_fields[] = {
2371     "level",
2372 };
2373
2374 static struct valobj _sdl_valobj[] = {
2375   {V_NUM, 0},
2376 };
2377
2378 static struct validate _sdl_validate = 
2379 {
2380     _sdl_valobj,
2381     1,
2382     (char *)0,
2383     (char *)0,
2384     0,
2385     0,
2386     0,
2387     0,
2388     _sdl_followup,
2389 };
2390
2391
2392 \f
2393 /* Generalized Query Definitions */
2394
2395 /* Note: For any query which uses prefetch_value, the vcnt should be
2396  * one less than the number of %-format specifiers in the tlist.
2397  */
2398
2399 struct query Queries2[] = {
2400   {
2401     /* Q_GALO - GET_ALL_LOGINS */
2402     "get_all_logins",
2403     "galo",
2404     RETRIEVE,
2405     "u",
2406     USERS_TABLE,
2407     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
2408     galo_fields,
2409     6,
2410     "u.users_id != 0",
2411     0,
2412     "u.login",
2413     0,
2414   },
2415   
2416   {
2417     /* Q_GAAL - GET_ALL_ACTIVE_LOGINS */
2418     "get_all_active_logins",
2419     "gaal",
2420     RETRIEVE,
2421     "u",
2422     USERS_TABLE,
2423     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle FROM users u",
2424     galo_fields,
2425     6,
2426     "u.status = 1",
2427     0,
2428     "u.login",
2429     0,
2430   },
2431   
2432   {
2433     /* Q_GUAL - GET_USER_ACCOUNT_BY_LOGIN */
2434     "get_user_account_by_login",
2435     "gual",
2436     RETRIEVE,
2437     "u",
2438     USERS_TABLE,
2439     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
2440     gual_fields,
2441     15,
2442     "u.login LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
2443     1,
2444     "u.login",
2445     &gubl_validate,
2446   },
2447   
2448   {
2449     /* Q_GUAU - GET_USER_ACCOUNT_BY_UID */
2450     "get_user_account_by_uid",
2451     "guau",
2452     RETRIEVE,
2453     "u",
2454     USERS_TABLE,
2455     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
2456     guau_fields,
2457     15,
2458     "u.unix_uid = %s AND u.users_id != 0 AND u.comments = str.string_id",
2459     1,
2460     "u.login",
2461     &gubu_validate,
2462   },
2463   
2464   {
2465     /* Q_GUAN - GET_USER_ACCOUNT_BY_NAME */
2466     "get_user_account_by_name",
2467     "guan",
2468     RETRIEVE,
2469     "u",
2470     USERS_TABLE,
2471     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
2472     guan_fields,
2473     15,
2474     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0 and u.comments = str.string_id",
2475     2,
2476     "u.last, u.first",
2477     &guan_validate,
2478   },
2479   
2480   {
2481     /* Q_GUAC - GET_USER_ACCOUNT_BY_CLASS */
2482     "get_user_account_by_class",
2483     "guac",
2484     RETRIEVE,
2485     "u",
2486     USERS_TABLE,
2487     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
2488     guac_fields,
2489     15,
2490     "u.type = UPPER('%s') AND u.users_id != 0 AND u.comments = str.string_id",
2491     1,
2492     "u.login",
2493     &VDfixmodby,
2494   },
2495   
2496   {
2497     /* Q_GUAM - GET_USER_ACCOUNT_BY_MITID */
2498     "get_user_account_by_id",
2499     "guai",
2500     RETRIEVE,
2501     "u",
2502     USERS_TABLE,
2503     "u.login, u.unix_uid, u.shell, u.last, u.first, u.middle, u.status, u.clearid, u.type, str.string, u.signature, u.secure, TO_CHAR(u.modtime, 'DD-mon-YYYY HH24:MI:SS'), u.modby, u.modwith FROM users u, strings str",
2504     guam_fields,
2505     15,
2506     "u.clearid LIKE '%s' AND u.users_id != 0 AND u.comments = str.string_id",
2507     1,
2508     "u.login",
2509     &VDfixmodby,
2510   },
2511   
2512   {
2513     /* Q_GUBL - GET_USER_BY_LOGIN */
2514     "get_user_by_login",
2515     "gubl",
2516     RETRIEVE,
2517     "u",
2518     USERS_TABLE,  
2519     "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",
2520     gubl_fields,
2521     12,
2522     "u.login LIKE '%s' AND u.users_id != 0",
2523     1,
2524     "u.login",
2525     &gubl_validate,
2526   },
2527   
2528   {
2529     /* Q_GUBU - GET_USER_BY_UID */
2530     "get_user_by_uid",
2531     "gubu",
2532     RETRIEVE,
2533     "u",
2534     USERS_TABLE,
2535     "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",
2536     gubu_fields,
2537     12,
2538     "u.unix_uid = %s AND u.users_id != 0",
2539     1,
2540     "u.login",
2541     &gubu_validate,
2542   },
2543   
2544   {
2545     /* Q_GUBN - GET_USER_BY_NAME */
2546     "get_user_by_name",
2547     "gubn",
2548     RETRIEVE,
2549     "u",
2550     USERS_TABLE,
2551     "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",
2552     gubn_fields,
2553     12,
2554     "u.first LIKE '%s' AND u.last LIKE '%s' AND u.users_id != 0",
2555     2,
2556     "u.last, u.first",
2557     &gubn_validate,
2558   },
2559   
2560   {
2561     /* Q_GUBC - GET_USER_BY_CLASS */
2562     "get_user_by_class",
2563     "gubc",
2564     RETRIEVE,
2565     "u",
2566     USERS_TABLE,
2567     "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",
2568     gubc_fields,
2569     12,
2570     "u.type = UPPER('%s') AND u.users_id != 0",
2571     1,
2572     "u.login",
2573     &VDfixmodby,
2574   },
2575   
2576   {
2577     /* Q_GUBM - GET_USER_BY_MITID */
2578     "get_user_by_mitid",
2579     "gubm",
2580     RETRIEVE,
2581     "u",
2582     USERS_TABLE,
2583     "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",
2584     gubm_fields,
2585     12,
2586     "u.clearid LIKE '%s' AND u.users_id != 0",
2587     1,
2588     "u.login",
2589     &VDfixmodby,
2590   },
2591   
2592   {
2593     /* Q_GUDF - GET_USER_DIRECTORY_FLAGS */
2594     "get_user_directory_flags",
2595     "gudf",
2596     RETRIEVE,
2597     "u",
2598     USERS_TABLE,
2599     "u.dirsuppress, u.dirremote FROM users u",
2600     gudf_fields,
2601     2,
2602     "u.users_id = %d",
2603     1,
2604     0,
2605     &gudf_validate,
2606   },
2607
2608   {
2609     /* Q_AUAC - ADD_USER_ACCOUNT */  /* uses prefetch_value() for users_id */
2610     "add_user_account",
2611     "auac",
2612     APPEND,
2613     "u",
2614     USERS_TABLE,
2615     "INTO users (login, unix_uid, shell, last, first, middle, status, clearid, type, comments, signature, secure, users_id) VALUES ('%s', %s, '%s', NVL('%s',CHR(0)), NVL('%s',CHR(0)), NVL('%s',CHR(0)), %s, NVL('%s',CHR(0)), '%s', %d, LENGTH(NVL('%s',CHR(0))), %s, %s)", /* followup_ausr fixes signature field */
2616     auac_fields,
2617     12,
2618     (char *)0,
2619     0,
2620     0,
2621     &auac_validate,
2622   },
2623   
2624   {
2625     /* Q_AUSR - ADD_USER */  /* uses prefetch_value() for users_id */
2626     "add_user",
2627     "ausr",
2628     APPEND,
2629     "u",
2630     USERS_TABLE,
2631     "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)",
2632     auac_fields,
2633     9,
2634     0,
2635     0,
2636     0,
2637     &ausr_validate,
2638   },
2639   
2640   {
2641     /* Q_RUSR - REGISTER_USER */
2642     "register_user",
2643     "rusr",
2644     APPEND,
2645     0,
2646     0,
2647     0,
2648     rusr_fields,
2649     3,
2650     0,
2651     0,
2652     0,
2653     &rusr_validate,
2654   },
2655   
2656   {
2657     /* Q_UUAC - UPDATE_USER_ACCOUNT */
2658     "update_user_account",
2659     "uuac",
2660     UPDATE,
2661     "u",
2662     USERS_TABLE,
2663     "users SET login = '%s', unix_uid = %s, shell = '%s', last = NVL('%s',CHR(0)), first = NVL('%s',CHR(0)), middle = NVL('%s',CHR(0)), status = %s, clearid = NVL('%s',CHR(0)), type = '%s', comments = %d, signature = LENGTH(NVL('%s',CHR(0))), secure = %s", /* followup_uuac fixes signature */
2664     uuac_fields,
2665     12,
2666     "users_id = %d",
2667     1,
2668     0,
2669     &uuac_validate,
2670   },
2671  
2672   {
2673     /* Q_UUSR - UPDATE_USER */
2674     "update_user",
2675     "uusr",
2676     UPDATE,
2677     "u",
2678     USERS_TABLE,
2679     "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'",
2680     uuac_fields,
2681     9,
2682     "users_id = %d",
2683     1,
2684     0,
2685     &uusr_validate,
2686   },
2687
2688   {
2689     /* Q_UUSH - UPDATE_USER_SHELL */
2690     "update_user_shell",
2691     "uush",
2692     UPDATE,
2693     "u",
2694     USERS_TABLE,
2695     "users SET shell = '%s'",  
2696     uush_fields,
2697     1,
2698     "users_id = %d",
2699     1,
2700     0,
2701     &uush_validate,
2702   },
2703
2704   {
2705     /* Q_UUST - UPDATE_USER_STATUS */
2706     "update_user_status",
2707     "uust",
2708     UPDATE,
2709     "u",
2710     USERS_TABLE,
2711     "users SET status = %s",
2712     uust_fields,
2713     1,
2714     "users_id = %d",
2715     1,
2716     0,
2717     &uust_validate,
2718   },
2719
2720   {
2721     /* Q_UUSS - UPDATE_USER_SECURITY_STATUS */
2722     "update_user_security_status",
2723     "uuss",
2724     UPDATE,
2725     "u",
2726     USERS_TABLE,
2727     "users SET secure = %s",
2728     uuss_fields,
2729     1,
2730     "users_id = %d",
2731     1,
2732     0,
2733     &uust_validate,
2734   },
2735  
2736   {
2737     /* Q_UUDF - UPDATE_USER_DIRECTORY_FLAGS */
2738     "update_user_directory_flags",
2739     "uudf",
2740     UPDATE,
2741     "u",
2742     USERS_TABLE,
2743     "users SET dirsuppress = %s, dirremote = %s",
2744     uudf_fields,
2745     2,
2746     "users_id = %d",
2747     1,
2748     0,
2749     &uudf_validate,
2750   },
2751
2752   {
2753     /* Q_DUSR - DELETE_USER */ 
2754     "delete_user",
2755     "dusr",
2756     DELETE,
2757     "u",
2758     USERS_TABLE,
2759     (char *)0,
2760     dusr_fields,
2761     0,
2762     "users_id = %d",
2763     1,
2764     0,
2765     &dusr_validate,
2766   },
2767
2768   {
2769     /* Q_DUBU - DELETE_USER_BY_UID */
2770     "delete_user_by_uid",
2771     "dubu",
2772     DELETE,
2773     "u",
2774     USERS_TABLE,
2775     (char *)0,
2776     dubu_fields,
2777     0,
2778     "users_id = %d",
2779     1,
2780     0,
2781     &dubu_validate,
2782   },
2783
2784   {
2785     /* Q_GKUM - GET_KERBEROS_USER_MAP */ 
2786     "get_kerberos_user_map",
2787     "gkum",
2788     RETRIEVE,
2789     "k",
2790     KRBMAP_TABLE,
2791     "u.login, str.string FROM krbmap km, users u, strings str",
2792     gkum_fields,
2793     2,
2794     "u.login LIKE '%s' AND str.string LIKE '%s' AND km.users_id = u.users_id AND km.string_id = str.string_id",
2795     2,
2796     "u.login",
2797     0,
2798   },
2799
2800   {
2801     /* Q_AKUM - ADD_KERBEROS_USER_MAP */
2802     "add_kerberos_user_map",
2803     "akum",
2804     APPEND,
2805     "k",
2806     KRBMAP_TABLE,
2807     "INTO krbmap (users_id, string_id) VALUES (%d, %d)",
2808     akum_fields,
2809     2,
2810     0,
2811     0,
2812     0,
2813     &akum_validate,
2814   },
2815
2816   {
2817     /* Q_DKUM - DELETE_KERBEROS_USER_MAP */
2818     "delete_kerberos_user_map",
2819     "dkum",
2820     DELETE,
2821     "k",
2822     KRBMAP_TABLE,
2823     0,
2824     akum_fields,
2825     0,
2826     "users_id = %d AND string_id = %d",
2827     2,
2828     0,
2829     &dkum_validate,
2830   },
2831
2832   {
2833     /* Q_GFBL - GET_FINGER_BY_LOGIN */
2834     "get_finger_by_login",
2835     "gfbl",
2836     RETRIEVE,
2837     "u",
2838     USERS_TABLE,
2839     "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",
2840     gfbl_fields,
2841     12,
2842     "users_id = %d",
2843     1,
2844     0,
2845     &gfbl_validate,
2846   },
2847
2848   {
2849     /* Q_UFBL - UPDATE_FINGER_BY_LOGIN */
2850     "update_finger_by_login",
2851     "ufbl",
2852     UPDATE,
2853     "u",
2854     USERS_TABLE,
2855     "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))",
2856     ufbl_fields,
2857     8,
2858     "users_id = %d",
2859     1,
2860     0,
2861     &ufbl_validate,
2862   },
2863
2864   {
2865     /* Q_GPOB - GET_POBOX */
2866     "get_pobox",
2867     "gpob",
2868     RETRIEVE,
2869     "u",
2870     USERS_TABLE,
2871     "login, potype, pop_id || ':' || box_id, TO_CHAR(pmodtime, 'DD-mon-YYYY HH24:MI:SS'), pmodby, pmodwith FROM users",
2872     gpob_fields,
2873     6,
2874     "users_id = %d",
2875     1,
2876     0,
2877     &gpob_validate,
2878   },
2879
2880   {
2881     /* Q_GAPO - GET_ALL_POBOXES */
2882     "get_all_poboxes",
2883     "gapo",
2884     RETRIEVE,
2885     "u",
2886     USERS_TABLE,
2887     "login, potype, pop_id || ':' || box_id FROM users",
2888     gpox_fields,
2889     3,
2890     "potype != 'NONE'",
2891     0,
2892     "u.login",
2893     &gpox_validate,
2894   },
2895       
2896   {
2897     /* Q_GPOP - GET_POBOXES_POP */
2898     "get_poboxes_pop",
2899     "gpop",
2900     RETRIEVE,
2901     "u",
2902     USERS_TABLE,
2903     "login, potype, pop_id || ':' || box_id FROM users",
2904     gpox_fields,
2905     3,
2906     "potype = 'POP'",
2907     0,
2908     "u.login",
2909     &gpox_validate
2910   },
2911
2912   {
2913     /* Q_GPOF - GET_POBOXES_SMTP */
2914     "get_poboxes_smtp",
2915     "gpos",
2916     RETRIEVE,
2917     "u",
2918     USERS_TABLE,
2919     "login, potype, pop_id || ':' || box_id FROM users",
2920     gpox_fields,
2921     3,
2922     "potype = 'SMTP'",
2923     0,
2924     "u.login",
2925     &gpox_validate
2926   },
2927
2928   {
2929     /* Q_SPOB - SET_POBOX */
2930     "set_pobox",
2931     "spob",
2932     UPDATE,
2933     0,
2934     USERS_TABLE,
2935     0,
2936     spob_fields,
2937     3,
2938     (char *)0,
2939     0,
2940     0,
2941     &spob_validate,
2942   },
2943
2944   {
2945     /* Q_SPOP - SET_POBOX_POP */
2946     "set_pobox_pop",
2947     "spop",
2948     UPDATE,
2949     "u",
2950     USERS_TABLE,
2951     "users SET potype = 'POP'",
2952     spob_fields,
2953     0,
2954     "users_id = %d",
2955     1,
2956     0,
2957     &spop_validate,
2958   },
2959
2960   {
2961     /* Q_DPOB - DELETE_POBOX */
2962     "delete_pobox",
2963     "dpob",
2964     UPDATE,
2965     "u",
2966     USERS_TABLE,
2967     "users SET potype = 'NONE'",
2968     spob_fields,
2969     0,
2970     "users_id = %d",
2971     1,
2972     0,
2973     &dpob_validate,
2974   },
2975
2976   {
2977     /* Q_GHST - GET_HOST */
2978     "get_host",
2979     "ghst",
2980     RETRIEVE,
2981     "m",
2982     MACHINE_TABLE,
2983     "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",
2984     ghst_fields,
2985     21,
2986     "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", 
2987     4,
2988     "m.name",
2989     &ghst_validate,
2990   },
2991
2992   {
2993     /* Q_AHST - ADD_HOST */ /* uses prefetch_value() for mach_id */
2994     "add_host",
2995     "ahst",
2996     APPEND,
2997     "m",
2998     MACHINE_TABLE,
2999     "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)",
3000     ahst_fields,
3001     14,
3002     0,
3003     0,
3004     0,
3005     &ahst_validate,
3006   },
3007
3008   {
3009     /* Q_UHST - UPDATE_HOST */
3010     "update_host",
3011     "uhst",
3012     UPDATE,
3013     "m",
3014     MACHINE_TABLE,
3015     "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",
3016     uhst_fields,
3017     14,
3018     "mach_id = %d",
3019     1,
3020     0,
3021     &uhst_validate,
3022   },
3023
3024   {
3025     /* Q_DHST - DELETE_HOST */
3026     "delete_host",
3027     "dhst",
3028     DELETE,
3029     "m",
3030     MACHINE_TABLE,
3031     (char *)0,
3032     dhst_fields,
3033     0,
3034     "mach_id = %d",
3035     1,
3036     0,
3037     &dhst_validate,
3038   },
3039
3040   {
3041     /* Q_GMAC - GET_MACHINE */
3042     "get_machine",
3043     "gmac",
3044     RETRIEVE,
3045     "m",
3046     MACHINE_TABLE,
3047     "name, vendor, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM machine",
3048     gmac_fields,
3049     5,
3050     "name LIKE UPPER('%s') AND mach_id != 0", 
3051     1,
3052     "m.name",
3053     &VDfixmodby,
3054   },
3055
3056   {
3057     /* Q_GHAL - GET_HOSTALIAS */
3058     "get_hostalias",
3059     "ghal",
3060     RETRIEVE,
3061     "a",
3062     HOSTALIAS_TABLE,
3063     "a.name, m.name FROM hostalias a, machine m",
3064     ghal_fields,
3065     2,
3066     "m.mach_id = a.mach_id and a.name LIKE UPPER('%s') AND m.name LIKE UPPER('%s')",
3067     2,
3068     "m.name, a.name",
3069     &ghal_validate,
3070   },
3071
3072   {
3073     /* Q_AHAL - ADD_HOSTALIAS */
3074     "add_hostalias",
3075     "ahal",
3076     APPEND,
3077     "a",
3078     HOSTALIAS_TABLE,
3079     "INTO hostalias (name, mach_id) VALUES (UPPER('%s'),%d)",
3080     ghal_fields,
3081     2,
3082     0,
3083     0,
3084     0,
3085     &ahal_validate,
3086   },
3087
3088   {
3089     /* Q_DHAL - DELETE_HOSTALIAS */
3090     "delete_hostalias",
3091     "dhal",
3092     DELETE,
3093     "a",
3094     HOSTALIAS_TABLE,
3095     (char *)0,
3096     ghal_fields,
3097     0,
3098     "name = UPPER('%s') AND mach_id = %d",
3099     2,
3100     0,
3101     &dhal_validate,
3102   },
3103
3104   {
3105     /* Q_GSNT - GET_SUBNET */
3106     "get_subnet",
3107     "gsnt",
3108     RETRIEVE,
3109     "s",
3110     SUBNET_TABLE,
3111     "name, description, saddr, mask, low, high, prefix, owner_type, owner_id, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM subnet",
3112     gsnt_fields,
3113     12,
3114     "name LIKE UPPER('%s') and snet_id != 0",
3115     1,
3116     "name",
3117     &gsnt_validate,
3118   },
3119
3120   {
3121     /* Q_ASNT - ADD_SUBNET */
3122     "add_subnet",
3123     "asnt",
3124     APPEND,
3125     "s",
3126     SUBNET_TABLE,
3127     "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)",
3128     asnt_fields,
3129     9,
3130     0,
3131     0,
3132     0,
3133     &asnt_validate,
3134   },
3135
3136   {
3137     /* Q_USNT - UPDATE_SUBNET */
3138     "update_subnet",
3139     "usnt",
3140     UPDATE,
3141     "s",
3142     SUBNET_TABLE,
3143     "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",
3144     usnt_fields,
3145     9,
3146     "snet_id = %d",
3147     1,
3148     0,
3149     &usnt_validate,
3150   },
3151
3152   {
3153     /* Q_DSNT - DELETE_SUBNET */
3154     "delete_subnet",
3155     "dsnt",
3156     DELETE,
3157     "s",
3158     SUBNET_TABLE,
3159     (char *)0,
3160     dsnt_fields,
3161     0,
3162     "snet_id = %d",
3163     1,
3164     0,
3165     &dsnt_validate,
3166   },
3167
3168   {
3169     /* Q_GCLU - GET_CLUSTER */
3170     "get_cluster",
3171     "gclu",
3172     RETRIEVE,
3173     "c",
3174     CLUSTER_TABLE,
3175     "name, description, location, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM clusters",
3176     gclu_fields,
3177     6,
3178     "name LIKE '%s' AND clu_id != 0",
3179     1,
3180     "name",
3181     &VDfixmodby,
3182   },
3183
3184   {
3185     /* Q_ACLU - ADD_CLUSTER */ /* uses prefetch_value() for clu_id */
3186     "add_cluster",
3187     "aclu",
3188     APPEND,
3189     "c",
3190     CLUSTER_TABLE,
3191     "INTO clusters (name, description, location, clu_id) VALUES ('%s',NVL('%s',CHR(0)),NVL('%s',CHR(0)),%s)",
3192     aclu_fields,
3193     3,
3194     0,
3195     0,
3196     0,
3197     &aclu_validate,
3198   },
3199
3200   {
3201     /* Q_UCLU - UPDATE_CLUSTER */
3202     "update_cluster",
3203     "uclu",
3204     UPDATE,
3205     "c",
3206     CLUSTER_TABLE,
3207     "clusters SET name = '%s', description = NVL('%s',CHR(0)), location = NVL('%s',CHR(0))",
3208     uclu_fields,
3209     3,
3210     "clu_id = %d",
3211     1,
3212     0,
3213     &uclu_validate,
3214   },
3215
3216   {
3217     /* Q_DCLU - DELETE_CLUSTER */
3218     "delete_cluster",
3219     "dclu",
3220     DELETE,
3221     "c",
3222     CLUSTER_TABLE,
3223     (char *)0,
3224     dclu_fields,
3225     0,
3226     "clu_id = %d",
3227     1,
3228     0,
3229     &dclu_validate,
3230   },
3231
3232   {
3233     /* Q_GMCM - GET_MACHINE_TO_CLUSTER_MAP */ 
3234     "get_machine_to_cluster_map",
3235     "gmcm",
3236     RETRIEVE,
3237     "mcm",
3238     MCMAP_TABLE,
3239     "m.name, c.name FROM machine m, clusters c, mcmap mcm",
3240     gmcm_fields,
3241     2,
3242     "m.name LIKE UPPER('%s') AND c.name LIKE '%s' AND mcm.clu_id = c.clu_id AND mcm.mach_id = m.mach_id",
3243     2,
3244     "m.name, c.name",
3245     0, 
3246   },
3247                                            
3248   {
3249     /* Q_AMTC - ADD_MACHINE_TO_CLUSTER */
3250     "add_machine_to_cluster",
3251     "amtc",
3252     APPEND,
3253     "mcm",
3254     MCMAP_TABLE,
3255     "INTO mcmap (mach_id, clu_id) VALUES (%d, %d)",
3256     gmcm_fields,
3257     2,
3258     0,
3259     0,
3260     0,
3261     &amtc_validate,
3262   },
3263
3264   {
3265     /* Q_DMFC - DELETE_MACHINE_FROM_CLUSTER */
3266     "delete_machine_from_cluster",
3267     "dmfc",
3268     DELETE,
3269     "mcm",
3270     MCMAP_TABLE,
3271     0,
3272     gmcm_fields,
3273     0,
3274     "mach_id = %d AND clu_id = %d",
3275     2,
3276     0,
3277     &amtc_validate,
3278   },
3279
3280   {
3281     /* Q_GCLD - GET_CLUSTER_DATA */
3282     "get_cluster_data",
3283     "gcld",
3284     RETRIEVE,
3285     "svc",
3286     SVC_TABLE,
3287     "c.name, svc.serv_label, svc.serv_cluster FROM svc svc, clusters c",
3288     gcld_fields,
3289     3,
3290     "c.clu_id = svc.clu_id AND c.name LIKE '%s' AND svc.serv_label LIKE '%s'",
3291     2,
3292     "c.name, svc.serv_label, svc.serv_cluster",
3293     0,
3294   },
3295
3296   {
3297     /* Q_ACLD - ADD_CLUSTER_DATA */
3298     "add_cluster_data",
3299     "acld",
3300     APPEND,
3301     "svc",
3302     SVC_TABLE,
3303     "INTO svc (clu_id, serv_label, serv_cluster) VALUES (%d,'%s','%s')",
3304     acld_fields,
3305     3,
3306     (char *)0,
3307     0,
3308     0,
3309     &acld_validate,
3310   },
3311
3312   {
3313     /* Q_DCLD - DELETE_CLUSTER_DATA */
3314     "delete_cluster_data",
3315     "dcld",
3316     DELETE,
3317     "svc",
3318     SVC_TABLE,
3319     (char *)0,
3320     acld_fields,
3321     0,
3322     "clu_id = %d AND serv_label = '%s' AND serv_cluster = '%s'",   
3323     3,
3324     0,
3325     &dcld_validate,
3326   },
3327
3328   {
3329     /* Q_GLIN - GET_LIST_INFO */
3330     "get_list_info",
3331     "glin",
3332     RETRIEVE,
3333     0,
3334     LIST_TABLE,
3335     0,
3336     glin_fields,
3337     13,
3338     0,
3339     1,              
3340     0,
3341     &glin_validate, 
3342   },
3343     
3344   {
3345     /* Q_EXLN - EXPAND_LIST_NAMES */
3346     "expand_list_names",
3347     "exln",
3348     RETRIEVE,
3349     "l",
3350     LIST_TABLE,
3351     "name FROM list",
3352     glin_fields,
3353     1,
3354     "name LIKE '%s' AND list_id != 0",
3355     1,
3356     "name",
3357     0,
3358   },
3359     
3360   {
3361     /* Q_ALIS - ADD_LIST */ /* uses prefetch_value() for list_id */
3362     "add_list",
3363     "alis",
3364     APPEND,
3365     "l",
3366     LIST_TABLE, 
3367     "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)",
3368     alis_fields,
3369     10,
3370     0,
3371     0,
3372     0,
3373     &alis_validate,
3374   },
3375
3376   {
3377     /* Q_ULIS - UPDATE_LIST */
3378     "update_list",
3379     "ulis",
3380     UPDATE,
3381     "l",
3382     LIST_TABLE,
3383     "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))",
3384     ulis_fields,
3385     10,
3386     "list_id = %d",
3387     1,
3388     0,
3389     &ulis_validate,
3390   },
3391
3392   {
3393     /* Q_DLIS - DELETE_LIST */
3394     "delete_list",
3395     "dlis",
3396     DELETE,
3397     "l",
3398     LIST_TABLE,
3399     (char *)0,
3400     dlis_fields,
3401     0,
3402     "list_id = %d",
3403     1,
3404     0,
3405     &dlis_validate,
3406   },
3407
3408   {
3409     /* Q_AMTL - ADD_MEMBER_TO_LIST */
3410     "add_member_to_list",
3411     "amtl",
3412     APPEND,
3413     0,
3414     IMEMBERS_TABLE,
3415     0,
3416     amtl_fields,
3417     3,
3418     (char *)0,
3419     0,
3420     0,
3421     &amtl_validate,
3422   },
3423
3424   {
3425     /* Q_DMFL - DELETE_MEMBER_FROM_LIST */
3426     "delete_member_from_list",
3427     "dmfl",
3428     DELETE,
3429     0,
3430     IMEMBERS_TABLE,
3431     (char *)0,
3432     amtl_fields,
3433     0,
3434     0,
3435     3,
3436     0,
3437     &dmfl_validate,
3438   },
3439
3440   {
3441     /* Q_GAUS - GET_ACE_USE */
3442     "get_ace_use",
3443     "gaus",
3444     RETRIEVE,
3445     0,
3446     0,
3447     0,
3448     gaus_fields,
3449     2,
3450     0,
3451     2,
3452     0,
3453     &gaus_validate,
3454   },
3455
3456   {
3457     /* Q_QGLI - QUALIFIED_GET_LISTS */
3458     "qualified_get_lists",
3459     "qgli",
3460     RETRIEVE,
3461     0,
3462     LIST_TABLE,
3463     0,
3464     qgli_fields,
3465     1,
3466     0,
3467     5,
3468     0,
3469     &qgli_validate,
3470   },
3471
3472   {
3473     /* Q_GMOL - GET_MEMBERS_OF_LIST */
3474     "get_members_of_list",
3475     "gmol",
3476     RETRIEVE,
3477     (char *)0,
3478     IMEMBERS_TABLE,
3479     (char *)0,
3480     gmol_fields,
3481     2,
3482     (char *)0,
3483     1,
3484     0,
3485     &gmol_validate,
3486   },
3487
3488   {
3489     /* Q_GEML - GET_END_MEMBERS_OF_LIST */
3490     "get_end_members_of_list",
3491     "geml",
3492     RETRIEVE,
3493     (char *)0,
3494     IMEMBERS_TABLE,
3495     (char *)0,
3496     gmol_fields,
3497     0,
3498     (char *)0,
3499     1,
3500     0,
3501     &geml_validate,
3502   },
3503  
3504   {
3505     /* Q_GLOM - GET_LISTS_OF_MEMBER */
3506     "get_lists_of_member",
3507     "glom",
3508     RETRIEVE,
3509     0,
3510     IMEMBERS_TABLE,
3511     0,
3512     glom_fields,
3513     6,
3514     0,
3515     2,
3516     0,
3517     &glom_validate,
3518   },
3519
3520   {
3521     /* Q_CMOL - COUNT_MEMBERS_OF_LIST */
3522     "count_members_of_list",
3523     "cmol",
3524     RETRIEVE,
3525     0,
3526     IMEMBERS_TABLE,
3527     0,
3528     cmol_fields,
3529     1,
3530     0,
3531     1,
3532     0,
3533     &cmol_validate,
3534   },
3535
3536   {
3537     /* Q_GSIN - GET_SERVER_INFO */
3538     "get_server_info",
3539     "gsin",
3540     RETRIEVE,
3541     "s",
3542     SERVERS_TABLE,
3543     "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",
3544     gsin_fields,
3545     16,
3546     "name LIKE UPPER('%s')",
3547     1,
3548     "name",
3549     &gsin_validate,
3550   },
3551
3552   {
3553     /* Q_QGSV - QUALIFIED_GET_SERVER */
3554     "qualified_get_server",
3555     "qgsv",
3556     RETRIEVE,
3557     0,
3558     SERVERS_TABLE,
3559     0,
3560     qgsv_fields,
3561     1,
3562     0,
3563     3,
3564     0,
3565     &qgsv_validate,
3566   },
3567
3568   {
3569     /* Q_ASIN - ADD_SERVER_INFO */
3570     "add_server_info",
3571     "asin",
3572     APPEND,
3573     "s",
3574     SERVERS_TABLE,
3575     "INTO servers (name, update_int, target_file, script, type, enable, acl_type, acl_id) VALUES (UPPER('%s'),%s,'%s','%s','%s',%s,'%s',%d)",
3576     asin_fields,
3577     8,
3578     (char *)0,
3579     0,
3580     0,
3581     &asin_validate,
3582   },
3583
3584   {
3585     /* Q_USIN - UPDATE_SERVER_INFO */
3586     "update_server_info",
3587     "usin",
3588     UPDATE,
3589     "s",
3590     SERVERS_TABLE,
3591     "servers SET update_int = %s, target_file = '%s', script = '%s', type = '%s', enable = %s, acl_type = '%s', acl_id = %d",
3592     asin_fields,
3593     7,
3594     "name = UPPER('%s')",
3595     1,
3596     0,
3597     &asin_validate,
3598   },
3599
3600   {
3601     /* Q_RSVE - RESET_SERVER_ERROR */
3602     "reset_server_error",
3603     "rsve",
3604     UPDATE,
3605     "s",
3606     SERVERS_TABLE,
3607     "servers SET harderror = 0, dfcheck = dfgen",
3608     dsin_fields,
3609     0,
3610     "name = UPPER('%s')",
3611     1,
3612     0,
3613     &rsve_validate,
3614   },
3615
3616   {
3617     /* Q_SSIF - SET_SERVER_INTERNAL_FLAGS */
3618     "set_server_internal_flags",
3619     "ssif",
3620     UPDATE,
3621     "s",
3622     SERVERS_TABLE,
3623     "servers SET dfgen = %s, dfcheck = %s, inprogress = %s, harderror = %s, errmsg = NVL('%s',CHR(0))",
3624     ssif_fields,
3625     5,
3626     "name = UPPER('%s')",
3627     1,
3628     0,
3629     &ssif_validate,
3630   },
3631
3632   {
3633     /* Q_DSIN - DELETE_SERVER_INFO */
3634     "delete_server_info",
3635     "dsin",
3636     DELETE,
3637     "s",
3638     SERVERS_TABLE,
3639     (char *)0,
3640     dsin_fields,
3641     0,
3642     "name = UPPER('%s')",
3643     1,
3644     0,
3645     &dsin_validate,
3646   },
3647
3648   {
3649     /* Q_GSHI - GET_SERVER_HOST_INFO */ 
3650     "get_server_host_info",
3651     "gshi",
3652     RETRIEVE,
3653     "sh",
3654     SERVERHOSTS_TABLE,
3655     "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",
3656     gshi_fields,
3657     16,
3658     "sh.service LIKE UPPER('%s') AND m.name LIKE UPPER('%s') AND m.mach_id = sh.mach_id",
3659     2,
3660     0,
3661     &gshi_validate,
3662   },
3663
3664   {
3665     /* Q_QGSH - QUALIFIED_GET_SERVER_HOST */
3666     "qualified_get_server_host",
3667     "qgsh",
3668     RETRIEVE,
3669     0,
3670     SERVERHOSTS_TABLE,
3671     0,
3672     qgsh_fields,
3673     2,
3674     0,
3675     6,
3676     0,
3677     &qgsh_validate,
3678   },
3679
3680   {
3681     /* Q_ASHI - ADD_SERVER_HOST_INFO */
3682     "add_server_host_info",
3683     "ashi",
3684     APPEND,
3685     "sh",
3686     SERVERHOSTS_TABLE,
3687     "INTO serverhosts (service, mach_id, enable, value1, value2, value3) VALUES (UPPER('%s'), %d, %s, %s, %s, NVL('%s',CHR(0)))",
3688     ashi_fields,
3689     6,
3690     (char *)0,
3691     0,
3692     0,
3693     &ashi_validate,
3694   },
3695
3696   {
3697     /* Q_USHI - UPDATE_SERVER_HOST_INFO */
3698     "update_server_host_info",
3699     "ushi",
3700     UPDATE,
3701     "sh",
3702     SERVERHOSTS_TABLE,
3703     "serverhosts SET enable = %s, value1 = %s, value2 = %s, value3 = NVL('%s',CHR(0))",
3704     ashi_fields,
3705     4,
3706     "service = UPPER('%s') AND mach_id = %d",
3707     2,
3708     0,
3709     &ashi_validate,
3710   },
3711
3712   {
3713     /* Q_RSHE - RESET_SERVER_HOST_ERROR */
3714     "reset_server_host_error",
3715     "rshe",
3716     UPDATE,
3717     "sh",
3718     SERVERHOSTS_TABLE,
3719     "serverhosts SET hosterror = 0",
3720     dshi_fields,
3721     0,
3722     "service = UPPER('%s') AND mach_id = %d",
3723     2,
3724     0,
3725     &rshe_validate,
3726   },
3727
3728   {
3729     /* Q_SSHO - SET_SERVER_HOST_OVERRIDE */
3730     "set_server_host_override",
3731     "ssho",
3732     UPDATE,
3733     "sh",
3734     SERVERHOSTS_TABLE,
3735     "serverhosts SET override = 1",
3736     dshi_fields,
3737     0,
3738     "service = UPPER('%s') AND mach_id = %d",
3739     2,
3740     0,
3741     &ssho_validate,
3742   },
3743
3744   {
3745     /* Q_SSHI - SET_SERVER_HOST_INTERNAL */
3746     "set_server_host_internal",
3747     "sshi",
3748     UPDATE,
3749     "s",
3750     SERVERHOSTS_TABLE,
3751     "serverhosts SET override = %s, success = %s, inprogress = %s, hosterror = %s, hosterrmsg = NVL('%s',CHR(0)), ltt = %s, lts = %s",
3752     sshi_fields,
3753     7,
3754     "service = UPPER('%s') AND mach_id = %d", 
3755     2,
3756     0,
3757     &sshi_validate,
3758   },
3759
3760   {
3761     /* Q_DSHI - DELETE_SERVER_HOST_INFO */
3762     "delete_server_host_info",
3763     "dshi",
3764     DELETE,
3765     "sh",
3766     SERVERHOSTS_TABLE,
3767     (char *)0,
3768     dshi_fields,
3769     0,
3770     "service = UPPER('%s') AND mach_id = %d",
3771     2,
3772     0,
3773     &dshi_validate,
3774   },
3775
3776   {
3777     /* Q_GSLO - GET_SERVER_LOCATIONS */ 
3778     "get_server_locations",
3779     "gslo",
3780     RETRIEVE,
3781     "sh",
3782     SERVERHOSTS_TABLE,
3783     "sh.service, m.name FROM serverhosts sh, machine m",
3784     gslo_fields,
3785     2,
3786     "sh.service LIKE UPPER('%s') AND sh.mach_id = m.mach_id",
3787     1,
3788     "sh.service, m.name",
3789     0,
3790   },
3791
3792   {
3793     /* Q_GFSL - GET_FILESYS_BY_LABEL */ 
3794     "get_filesys_by_label",
3795     "gfsl",
3796     RETRIEVE,
3797     "fs",
3798     FILESYS_TABLE,
3799     "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",
3800     gfsl_fields,
3801     14,
3802     "fs.label LIKE '%s' AND fs.mach_id = m.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
3803     1,
3804     "fs.label",
3805     &VDfixmodby,
3806   },
3807
3808   {
3809     /* Q_GFSM - GET_FILESYS_BY_MACHINE */ 
3810     "get_filesys_by_machine",
3811     "gfsm",
3812     RETRIEVE,
3813     "fs",
3814     FILESYS_TABLE,
3815     "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",
3816     gfsm_fields,
3817     14,
3818     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
3819     1,
3820     "fs.label",
3821     &gfsm_validate,
3822   },
3823
3824   {
3825     /* Q_GFSN - GET_FILESYS_BY_NFSPHYS */ 
3826     "get_filesys_by_nfsphys",
3827     "gfsn",
3828     RETRIEVE,
3829     "fs",
3830     FILESYS_TABLE,
3831     "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",
3832     gfsn_fields,
3833     14,
3834     "fs.mach_id = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id AND np.nfsphys_id = fs.phys_id AND np.dir LIKE '%s' AND fs.type = 'NFS'", 
3835     2,
3836     "fs.label",
3837     &gfsn_validate,
3838   },
3839
3840   {
3841     /* Q_GFSG - GET_FILESYS_BY_GROUP */ 
3842     "get_filesys_by_group",
3843     "gfsg",
3844     RETRIEVE,
3845     "fs",
3846     FILESYS_TABLE,
3847     "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",
3848     gfsg_fields,
3849     14,
3850     "fs.owners = %d AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = l.list_id",
3851     1,
3852     "fs.label",
3853     &gfsg_validate,
3854   },
3855
3856   {
3857     /* Q_GFSP - GET_FILESYS_BY_PATH */
3858     "get_filesys_by_path",
3859     "gfsp",
3860     RETRIEVE,
3861     "fs",
3862     FILESYS_TABLE,
3863     "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",
3864     gfsp_fields,
3865     14,
3866     "fs.name LIKE '%s' AND m.mach_id = fs.mach_id AND fs.owner = u.users_id AND fs.owners = list_id",
3867     1,
3868     "fs.label",
3869     &VDfixmodby,
3870   },
3871  
3872   {
3873     /* Q_AFIL - ADD_FILESYS */ /* uses prefetch_value() for filsys_id */
3874     "add_filesys",
3875     "afil",
3876     APPEND,
3877     "fs",
3878     FILESYS_TABLE,
3879     "INTO filesys (label, type, mach_id, name, mount, rwaccess, comments, owner, owners, createflg, lockertype, filsys_id) VALUES ('%s','%s',%d,NVL('%s',CHR(0)),'%s','%s',NVL('%s',CHR(0)),%d,%d,%s,'%s',%s)",
3880     afil_fields,
3881     11,
3882     0,
3883     0,
3884     0,
3885     &afil_validate,
3886   },
3887
3888   {
3889     /* Q_UFIL - UPDATE_FILESYS */
3890     "update_filesys",
3891     "ufil",
3892     UPDATE,
3893     "fs",
3894     FILESYS_TABLE,
3895     "filesys SET label = '%s', type = '%s', mach_id = %d, name = NVL('%s',CHR(0)), mount = '%s', rwaccess = '%s', comments = NVL('%s',CHR(0)), owner = %d, owners = %d, createflg = %s, lockertype = '%s'",
3896     ufil_fields,
3897     11,
3898     "filsys_id = %d",
3899     1,
3900     0,
3901     &ufil_validate,      
3902   },
3903
3904   {
3905     /* Q_DFIL - DELETE_FILESYS */
3906     "delete_filesys",
3907     "dfil",
3908     DELETE,
3909     "fs",
3910     FILESYS_TABLE,
3911     (char *)0,
3912     dfil_fields,
3913     0,
3914     "filsys_id = %d",
3915     1,
3916     0,
3917     &dfil_validate,
3918   },
3919
3920   {
3921     /* Q_GFGM - GET_FSGROUP_MEMBERS */ 
3922     "get_fsgroup_members",
3923     "gfgm",
3924     RETRIEVE,
3925     "fg",
3926     FSGROUP_TABLE,
3927     "fs.label, fg.key FROM fsgroup fg, filesys fs",
3928     gfgm_fields,
3929     2,
3930     "fg.group_id = %d AND fs.filsys_id = fg.filsys_id",
3931     1,
3932     "fg.key, fs.label",
3933     &gfgm_validate,
3934   },
3935
3936   {
3937     /* Q_AFTG - ADD_FILESYS_TO_FSGROUP */
3938     "add_filesys_to_fsgroup",
3939     "aftg",
3940     APPEND,
3941     "fg",
3942     FSGROUP_TABLE,
3943     "INTO fsgroup (group_id,filsys_id,key) VALUES (%d, %d, '%s')",
3944     gfgm_fields,
3945     3,
3946     (char *)0,
3947     0,
3948     0,
3949     &aftg_validate,
3950   },
3951
3952   {
3953     /* Q_RFFG - REMOVE_FILESYS_FROM_FSGROUP */
3954     "remove_filesys_from_fsgroup",
3955     "rffg",
3956     DELETE,
3957     "fg",
3958     FSGROUP_TABLE,
3959     (char *)0,
3960     gfgm_fields,
3961     0,
3962     "group_id = %d AND filsys_id = %d",
3963     2,
3964     0,
3965     &aftg_validate,
3966   },
3967
3968   {
3969     /* Q_GANF - GET_ALL_NFSPHYS */ 
3970     "get_all_nfsphys",
3971     "ganf",
3972     RETRIEVE,
3973     "np",
3974     NFSPHYS_TABLE,
3975     "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",
3976     ganf_fields,
3977     9,
3978     "m.mach_id = np.mach_id",
3979     0,
3980     "m.name, np.dir",
3981     &VDfixmodby,
3982   },
3983
3984   {
3985     /* Q_GNFP - GET_NFSPHYS */ 
3986     "get_nfsphys",
3987     "gnfp",
3988     RETRIEVE,
3989     "np",
3990     NFSPHYS_TABLE,
3991     "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",
3992     gnfp_fields,
3993     9,
3994     "np.mach_id = %d AND np.dir LIKE '%s' AND m.mach_id = np.mach_id", 
3995     2,
3996     "m.name, np.dir",
3997     &gnfp_validate,
3998   },
3999
4000   {
4001     /* Q_ANFP - ADD_NFSPHYS */ /* uses prefetch_value() for nfsphys_id */
4002     "add_nfsphys",
4003     "anfp",
4004     APPEND,
4005     "np",
4006     NFSPHYS_TABLE,
4007     "INTO nfsphys (mach_id, dir, device, status, allocated, partsize, nfsphys_id) VALUES (%d, '%s', NVL('%s',CHR(0)), %s, %s, %s, %s)",
4008     ganf_fields,
4009     6,
4010     0,
4011     0,
4012     0,
4013     &anfp_validate,
4014   },
4015
4016   {
4017     /* Q_UNFP - UPDATE_NFSPHYS */
4018     "update_nfsphys",
4019     "unfp",
4020     UPDATE,
4021     "np",
4022     NFSPHYS_TABLE,
4023     "nfsphys SET device = NVL('%s',CHR(0)), status = %s, allocated = %s, partsize = %s",
4024     ganf_fields,
4025     4,
4026     "mach_id = %d AND dir = '%s'", 
4027     2,
4028     0,
4029     &unfp_validate,
4030   },
4031
4032   {
4033     /* Q_AJNF - ADJUST_NFSPHYS_ALLOCATION */
4034     "adjust_nfsphys_allocation",
4035     "ajnf",
4036     UPDATE,
4037     "np",
4038     NFSPHYS_TABLE,
4039     "nfsphys SET allocated = allocated + %s",
4040     ajnf_fields,
4041     1,
4042     "mach_id = %d AND dir = '%s'",
4043     2,
4044     0,
4045     &ajnf_validate,
4046   },
4047
4048   {
4049     /* Q_DNFP - DELETE_NFSPHYS */
4050     "delete_nfsphys",
4051     "dnfp",
4052     DELETE,
4053     "np",
4054     NFSPHYS_TABLE,
4055     (char *)0,
4056     dnfp_fields,
4057     0,
4058     "mach_id = %d AND dir = '%s'",
4059     2,
4060     0,
4061     &dnfp_validate,
4062   },
4063
4064   {
4065     /* Q_GQOT - GET_QUOTA */ 
4066     "get_quota",
4067     "gqot",
4068     RETRIEVE,
4069     "q",
4070     QUOTA_TABLE,
4071     "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",
4072     gqot_fields,
4073     9,
4074     "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",
4075     3,
4076     "fs.label",
4077     &gqot_validate,
4078   },
4079
4080   {
4081     /* Q_GQBF - GET_QUOTA_BY_FILESYS */ 
4082     "get_quota_by_filesys",
4083     "gqbf",
4084     RETRIEVE,
4085     "q",
4086     QUOTA_TABLE,
4087     "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",
4088     gqbf_fields,
4089     9,
4090     "fs.label LIKE '%s' AND fs.filsys_id = q.filsys_id AND m.mach_id = fs.mach_id",
4091     1,
4092     "fs.label, q.type",
4093     &gqbf_validate,
4094   },
4095
4096   {
4097     /* Q_AQOT - ADD_QUOTA */ /* prefetch_filsys() gets last 1 value */
4098     "add_quota",
4099     "aqot",
4100     APPEND,
4101     0,
4102     QUOTA_TABLE,
4103     "INTO quota (filsys_id, type, entity_id, quota, phys_id) VALUES ('%s', %d, %d, %s, %s)",
4104     aqot_fields,
4105     4,
4106     (char *)0,
4107     0,
4108     0,
4109     &aqot_validate,
4110   },
4111
4112   {
4113     /* Q_UQOT - UPDATE_QUOTA */
4114     "update_quota",
4115     "uqot",
4116     UPDATE,
4117     0,
4118     QUOTA_TABLE,
4119     "quota SET quota = %s",
4120     aqot_fields,
4121     1,
4122     0,
4123     3,
4124     0,
4125     &uqot_validate,
4126   },
4127
4128   {
4129     /* Q_DQOT - DELETE_QUOTA */
4130     "delete_quota",
4131     "dqot",
4132     DELETE,
4133     0,
4134     QUOTA_TABLE,
4135     (char *)0,
4136     aqot_fields,
4137     0,
4138     0,
4139     3,
4140     0,
4141     &dqot_validate,
4142   },
4143
4144   {
4145     /* Q_GNFQ - GET_NFS_QUOTAS */ 
4146     "get_nfs_quota",
4147     "gnfq",
4148     RETRIEVE,
4149     "q",
4150     QUOTA_TABLE,
4151     "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",
4152     gnfq_fields,
4153     8,
4154     "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'",
4155     2,
4156     "fs.label, u.login",
4157     &gnfq_validate,
4158   },
4159
4160   {
4161     /* Q_GNQP - GET_NFS_QUOTAS_BY_PARTITION */ 
4162     "get_nfs_quotas_by_partition",
4163     "gnqp",
4164     RETRIEVE,
4165     "q",
4166     QUOTA_TABLE,
4167     "fs.label, u.login, q.quota, np.dir, m.name FROM quota q, filesys fs, users u, nfsphys np, machine m",
4168     gnqp_fields,
4169     5,
4170     "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",
4171     2,
4172     "fs.label, np.dir, u.login",
4173     0,
4174   },
4175
4176   {
4177     /* Q_ANFQ - ADD_NFS_QUOTA */ /* prefetch_filsys() gets last 1 value */
4178     "add_nfs_quota",
4179     "anfq",
4180     APPEND,
4181     0,
4182     QUOTA_TABLE,
4183     "INTO quota (type, filsys_id, entity_id, quota, phys_id ) VALUES ('USER', %d, %d, %s, %s)",
4184     anfq_fields,
4185     3,
4186     (char *)0,
4187     0,
4188     0,
4189     &anfq_validate,
4190   },
4191
4192   {
4193     /* Q_UNFQ - UPDATE_NFS_QUOTA */ 
4194     "update_nfs_quota",
4195     "unfq",
4196     UPDATE,
4197     0,
4198     QUOTA_TABLE,
4199     "quota SET quota = %s",
4200     anfq_fields,
4201     1,
4202     0,
4203     2,
4204     0,
4205     &unfq_validate,
4206   },
4207
4208   {
4209     /* Q_DNFQ - DELETE_NFS_QUOTA */
4210     "delete_nfs_quota",
4211     "dnfq",
4212     DELETE,
4213     0,
4214     QUOTA_TABLE,
4215     (char *)0,
4216     anfq_fields,
4217     0,
4218     0,
4219     2,
4220     0,
4221     &dnfq_validate,
4222   },
4223
4224   {
4225     /* Q_GZCL - GET_ZEPHYR_CLASS */
4226     "get_zephyr_class",
4227     "gzcl",
4228     RETRIEVE,
4229     "z",
4230     ZEPHYR_TABLE,
4231     "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",
4232     gzcl_fields,
4233     12,
4234     "class LIKE '%s'",
4235     1,
4236     "class",
4237     &gzcl_validate,
4238   },
4239
4240   {
4241     /* Q_AZCL - ADD_ZEPHYR_CLASS */
4242     "add_zephyr_class",
4243     "azcl",
4244     APPEND,
4245     "z",
4246     ZEPHYR_TABLE,
4247     "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)",
4248     azcl_fields,
4249     9,
4250     0,
4251     0,
4252     0,
4253     &azcl_validate,
4254   },    
4255
4256   {
4257     /* Q_UZCL - UPDATE_ZEPHYR_CLASS */
4258     "update_zephyr_class",
4259     "uzcl",
4260     UPDATE,
4261     "z",
4262     ZEPHYR_TABLE,
4263     "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",
4264     uzcl_fields,
4265     9,
4266     "class = '%s'",
4267     1,
4268     0,
4269     &uzcl_validate,
4270   },    
4271
4272   {
4273     /* Q_DZCL - DELETE_ZEPHYR_CLASS */
4274     "delete_zephyr_class",
4275     "dzcl",
4276     DELETE,
4277     "z",
4278     ZEPHYR_TABLE,
4279     0,
4280     uzcl_fields,
4281     0,
4282     "class = '%s'",
4283     1,
4284     0,
4285     &dzcl_validate,
4286   },    
4287
4288   {
4289     /* Q_GSHA - GET_SERVER_HOST_ACCESS */ 
4290     "get_server_host_access",
4291     "gsha",
4292     RETRIEVE,
4293     "ha",
4294     HOSTACCESS_TABLE,
4295     "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",
4296     gsha_fields,
4297     6,
4298     "m.name LIKE UPPER('%s') AND ha.mach_id = m.mach_id",
4299     1,
4300     "m.name",
4301     &gsha_validate,
4302   },
4303
4304   {
4305     /* Q_ASHA - ADD_SERVER_HOST_ACCESS */
4306     "add_server_host_access",
4307     "asha",
4308     APPEND,
4309     "ha",
4310     HOSTACCESS_TABLE,
4311     "INTO hostaccess (mach_id, acl_type, acl_id) VALUES (%d,'%s',%d)",
4312     asha_fields,
4313     3,
4314     0,
4315     0,
4316     0,
4317     &asha_validate,
4318   },
4319
4320   {
4321     /* Q_USHA - UPDATE_SERVER_HOST_ACCESS */
4322     "update_server_host_access",
4323     "usha",
4324     UPDATE,
4325     "ha",
4326     HOSTACCESS_TABLE,
4327     "hostaccess SET acl_type = '%s', acl_id = %d",
4328     asha_fields,
4329     2,
4330     "mach_id = %d",
4331     1,
4332     0,
4333     &asha_validate,
4334   },
4335
4336   {
4337     /* Q_DSHA - DELETE_SERVER_HOST_ACCESS */
4338     "delete_server_host_access",
4339     "dsha",
4340     DELETE,
4341     "ha",
4342     HOSTACCESS_TABLE,
4343     0,
4344     asha_fields,
4345     0,
4346     "mach_id = %d",
4347     1,
4348     0,
4349     &VDmach,
4350   },
4351
4352   {
4353     /* Q_GSVC - GET_SERVICE */
4354     "get_service",
4355     "gsvc",
4356     RETRIEVE,
4357     "ss",
4358     SERVICES_TABLE,
4359     "name, protocol, port, description, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS'), modby, modwith FROM services",
4360     gsvc_fields,
4361     7,
4362     "name LIKE '%s'",
4363     1,
4364     "name, protocol",
4365     &VDfixmodby,
4366   },
4367
4368   {
4369     /* Q_ASVC - ADD_SERVICE */
4370     "add_service",
4371     "asvc",
4372     APPEND,
4373     "ss",
4374     SERVICES_TABLE,
4375     "INTO services (name, protocol, port, description) VALUES ('%s','%s',%s,NVL('%s',CHR(0)))",
4376     asvc_fields,
4377     4,
4378     (char *)0,
4379     0,
4380     0,
4381     &asvc_validate,
4382   },
4383
4384   {
4385     /* Q_DSVC - DELETE_SERVICE */
4386     "delete_service",
4387     "dsvc",
4388     DELETE,
4389     "ss",
4390     SERVICES_TABLE,
4391     0,
4392     asvc_fields,
4393     0,
4394     "name = '%s'",
4395     1,
4396     0,
4397     &asvc_validate,
4398   },
4399
4400   {
4401     /* Q_GPCE - GET_PRINTCAP_ENTRY */ 
4402     "get_printcap_entry",
4403     "gpce",
4404     RETRIEVE,
4405     "pc",
4406     PRINTCAP_TABLE,
4407     "pc.name, m.name, pc.dir, pc.rp, pc.quotaserver, pc.auth, pc.price, pc.comments, TO_CHAR(pc.modtime, 'DD-mon-YYYY HH24:MI:SS'), pc.modby, pc.modwith FROM printcap pc, machine m",
4408     gpce_fields,
4409     11,
4410     "pc.name LIKE '%s' AND m.mach_id = pc.mach_id",
4411     1,
4412     "pc.name",
4413     &gpce_validate,
4414   },
4415
4416   {
4417     /* Q_APCE - ADD_PRINTCAP_ENTRY */
4418     "add_printcap_entry",
4419     "apce",
4420     APPEND,
4421     "pc",
4422     PRINTCAP_TABLE,
4423     "INTO printcap (name, mach_id, dir, rp, quotaserver, auth, price, comments) VALUES ('%s',%d,'%s','%s',%d,%s,%s,NVL('%s',CHR(0)))",
4424     apce_fields,
4425     8,
4426     0,
4427     0,
4428     0,
4429     &apce_validate,
4430   },
4431
4432   {
4433     /* Q_DPCE - DELETE_PRINTCAP_ENTRY */
4434     "delete_printcap_entry",
4435     "dpce",
4436     DELETE,
4437     "pc",
4438     PRINTCAP_TABLE,
4439     0,
4440     apce_fields,
4441     0,
4442     "name = '%s'",
4443     1,
4444     0,
4445     &dpce_validate,
4446   },
4447
4448   {
4449     /* Q_GPCP - GET_PRINTCAP */
4450     "get_printcap",
4451     "gpcp",
4452     RETRIEVE,
4453     "pc",
4454     PRINTCAP_TABLE,
4455     "pc.name, m.name, pc.dir, pc.rp, pc.comments, TO_CHAR(pc.modtime, 'DD-mon-YYYY HH24:MI:SS'), pc.modby, pc.modwith FROM printcap pc, machine m",
4456     gpcp_fields,
4457     8,
4458     "pc.name LIKE '%s' AND m.mach_id = pc.mach_id",
4459     1,
4460     "pc.name",
4461     &VDfixmodby,
4462   },
4463
4464   {
4465     /* Q_DPCP - DELETE_PRINTCAP */
4466     "delete_printcap",
4467     "dpcp",
4468     DELETE,
4469     "pc",
4470     PRINTCAP_TABLE,
4471     0,
4472     apce_fields,
4473     0,
4474     "name = '%s'",
4475     1,
4476     0,
4477     &dpce_validate,
4478   },
4479
4480   {
4481     /* Q_GPDM - GET_PALLADIUM */
4482     "get_palladium",
4483     "gpdm",
4484     RETRIEVE,
4485     "pal",
4486     PALLADIUM_TABLE,
4487     "pal.name, pal.identifier, m.name, TO_CHAR(pal.modtime, 'DD-mon-YYYY HH24:MI:SS'), pal.modby, pal.modwith FROM palladium pal, machine m",
4488     gpdm_fields,
4489     6,
4490     "pal.name LIKE '%s' AND m.mach_id = pal.mach_id",
4491     1,
4492     "pal.name",
4493     &VDfixmodby,
4494   },
4495
4496   {
4497     /* Q_APDM - ADD_PALLADIUM */
4498     "add_palladium",
4499     "apdm",
4500     APPEND,
4501     "pal",
4502     PALLADIUM_TABLE,
4503     "INTO palladium (name, identifier, mach_id) VALUES ('%s',%s,%d)",
4504     apdm_fields,
4505     3,
4506     0,
4507     0,
4508     0,
4509     &apdm_validate,
4510   },
4511
4512   {
4513     /* Q_DPDM - DELETE_PALLADIUM */
4514     "delete_palladium",
4515     "dpdm",
4516     DELETE,
4517     "pal",
4518     PALLADIUM_TABLE,
4519     0,
4520     apdm_fields,
4521     0,
4522     "name = '%s'",
4523     1,
4524     0,
4525     &dpdm_validate,
4526   },
4527
4528   {
4529     /* Q_GALI - GET_ALIAS */
4530     "get_alias",
4531     "gali",
4532     RETRIEVE,
4533     "a",
4534     ALIAS_TABLE,
4535     "name, type, trans FROM alias",
4536     gali_fields,
4537     3,
4538     "name LIKE '%s' AND type LIKE '%s' AND trans LIKE '%s'",
4539     3,
4540     "name, type, trans",
4541     0,
4542   },
4543
4544   {
4545     /* Q_AALI - ADD_ALIAS */
4546     "add_alias",
4547     "aali",
4548     APPEND,
4549     "a",
4550     ALIAS_TABLE,
4551     "INTO alias (name, type, trans) VALUES ('%s', '%s', '%s')",
4552     aali_fields,
4553     3,
4554     (char *)0,
4555     0,
4556     0,
4557     &aali_validate,
4558   },
4559
4560   {
4561     /* Q_DALI - DELETE_ALIAS */
4562     "delete_alias",
4563     "dali",
4564     DELETE,
4565     "a",
4566     ALIAS_TABLE,
4567     (char *)0,
4568     aali_fields,
4569     0,
4570     "name = '%s' AND type = '%s' AND  trans = '%s'", 
4571     3,
4572     0,
4573     &dali_validate,
4574   },
4575
4576   {
4577     /* Q_GVAL - GET_VALUE */
4578     "get_value",
4579     "gval",
4580     RETRIEVE,
4581     "val",
4582     NUMVALUES_TABLE,
4583     "value FROM numvalues",
4584     gval_fields,
4585     1,
4586     "name = '%s'",
4587     1,
4588     0,
4589     &gval_validate,
4590   },
4591
4592   {
4593     /* Q_AVAL - ADD_VALUE */
4594     "add_value",
4595     "aval",
4596     APPEND,
4597     "val",
4598     NUMVALUES_TABLE,
4599     "INTO numvalues (name, value) VALUES ('%s', %s)",
4600     aval_fields,
4601     2,
4602     (char *)0,
4603     0,
4604     0,
4605     &aval_validate,
4606   },
4607
4608   {
4609     /* Q_UVAL - UPDATE_VALUE */
4610     "update_value",
4611     "uval",
4612     UPDATE,
4613     "val",
4614     NUMVALUES_TABLE,
4615     "numvalues SET value = %s",
4616     aval_fields,
4617     1,
4618     "name = '%s'",
4619     1,
4620     0,
4621     &aval_validate,
4622   },
4623
4624   {
4625     /* Q_DVAL - DELETE_VALUE */
4626     "delete_value",
4627     "dval",
4628     DELETE,
4629     "val",
4630     NUMVALUES_TABLE,
4631     (char *)0,
4632     dval_fields,
4633     0,
4634     "name = '%s'",
4635     1,
4636     0,
4637     &aval_validate,
4638   },
4639
4640   {
4641     /* Q_GATS - GET_ALL_TABLE_STATS */
4642     "get_all_table_stats",
4643     "gats",
4644     RETRIEVE,
4645     "tbs",
4646     TBLSTATS_TABLE,
4647     "table_name, appends, updates, deletes, TO_CHAR(modtime, 'DD-mon-YYYY HH24:MI:SS') FROM tblstats",
4648     gats_fields,
4649     5,
4650     (char *)0,
4651     0,
4652     "table_name",
4653     0,
4654   },
4655
4656   {
4657     /* Q__SDL - _SET_DEBUG_LEVEL */
4658     "_set_debug_level",
4659     "_sdl",
4660     UPDATE,
4661     (char *)0,
4662     0,
4663     (char *)0,
4664     _sdl_fields,
4665     1,
4666     (char *)0,
4667     0,
4668     0,
4669     &_sdl_validate,
4670   },
4671
4672 };
4673
4674 int QueryCount2 = (sizeof Queries2 / sizeof (struct query));
This page took 0.374406 seconds and 3 git commands to generate.