6 * Copyright (C) 1987 by the Massachusetts Institute of Technology
7 * For copying and distribution information, please see the file
13 static char *rcsid_qsupport_dc = "$Header$";
16 #include <mit-copyright.h>
18 #include "mr_server.h"
23 EXEC SQL INCLUDE sqlca;
24 EXEC SQL INCLUDE sqlda;
27 extern char *whoami, *strsave();
28 extern int ingres_errno, mr_errcode;
30 EXEC SQL BEGIN DECLARE SECTION;
31 extern char stmt_buf[];
32 EXEC SQL END DECLARE SECTION;
34 EXEC SQL WHENEVER SQLERROR CALL ingerr;
37 /* FOLLOWUP ROUTINES */
39 /* generic set_modtime routine. This takes the table name from the query,
40 * and will update the modtime, modby, and modwho fields in the entry in
41 * the table whose name field matches argv[0].
44 set_modtime(q, argv, cl)
49 char *name, *entity, *table;
57 sprintf(stmt_buf,"UPDATE %s SET modtime = 'now', modby = %d, modwith = '%s' WHERE %s.name = LEFT('%s',SIZE(%s.name))",table,who,entity,table,name,table);
58 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
63 /* generic set_modtime_by_id routine. This takes the table name from
64 * the query, and the id name from the validate record,
65 * and will update the modtime, modby, and modwho fields in the entry in
66 * the table whose id matches argv[0].
69 set_modtime_by_id(q, argv, cl)
74 char *entity, *table, *id_name;
80 id_name = q->validate->object_id;
83 sprintf(stmt_buf,"UPDATE %s SET modtime = 'now', modby = %d, \
84 modwith = '%s' WHERE %s.%s = %d",table,who,entity,table,id_name,id);
85 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
90 /* Sets the finger modtime on a user record. The users_id will be in argv[0].
93 set_finger_modtime(q, argv, cl)
98 EXEC SQL BEGIN DECLARE SECTION;
101 EXEC SQL END DECLARE SECTION;
105 users_id = *(int *)argv[0];
107 EXEC SQL UPDATE users SET fmodtime='now', fmodby = :who, fmodwith = :entity
108 WHERE users.users_id = :users_id;
114 /* Sets the pobox modtime on a user record. The users_id will be in argv[0].
117 set_pobox_modtime(q, argv, cl)
122 EXEC SQL BEGIN DECLARE SECTION;
125 EXEC SQL END DECLARE SECTION;
129 users_id = *(int *)argv[0];
131 EXEC SQL UPDATE users SET pmodtime='now', pmodby = :who, pmodwith = :entity
132 WHERE users.users_id = :users_id;
138 /* Like set_modtime, but uppercases the name first.
141 set_uppercase_modtime(q, argv, cl)
146 char *name, *entity, *table;
154 sprintf(stmt_buf,"UPDATE %s SET modtime = 'now', modby = %d, modwith = '%s' WHERE %s.name = UPPERCASE(LEFT('%s',SIZE(%s.name)))",table,who,entity,table,name,table);
155 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
161 /* Sets the modtime on the machine whose mach_id is in argv[0]. This routine
162 * is necessary for add_machine_to_cluster becuase the table that query
163 * operates on is "mcm", not "machine".
166 set_mach_modtime_by_id(q, argv, cl)
171 EXEC SQL BEGIN DECLARE SECTION;
174 EXEC SQL END DECLARE SECTION;
178 id = *(int *)argv[0];
179 EXEC SQL UPDATE machine SET modtime='now', modby = :who, modwith = :entity
180 WHERE machine.mach_id = :id;
186 /* Sets the modtime on the cluster whose mach_id is in argv[0]. This routine
187 * is necessary for add_cluster_data and delete_cluster_data becuase the
188 * table that query operates on is "svc", not "cluster".
191 set_cluster_modtime_by_id(q, argv, cl)
196 EXEC SQL BEGIN DECLARE SECTION;
199 EXEC SQL END DECLARE SECTION;
204 id = *(int *)argv[0];
205 EXEC SQL UPDATE cluster SET modtime='now', modby = :who, modwith = :entity
206 WHERE cluster.clu_id = :id;
211 /* sets the modtime on the serverhost where the service name is in argv[0]
212 * and the mach_id is in argv[1].
215 set_serverhost_modtime(q, argv, cl)
220 EXEC SQL BEGIN DECLARE SECTION;
223 EXEC SQL END DECLARE SECTION;
229 id = *(int *)argv[1];
230 EXEC SQL UPDATE serverhosts
231 SET modtime = 'now', modby = :who, modwith = :entity
232 WHERE service = :serv AND mach_id = :id;
237 /* sets the modtime on the nfsphys where the mach_id is in argv[0] and the
238 * directory name is in argv[1].
241 set_nfsphys_modtime(q, argv, cl)
246 EXEC SQL BEGIN DECLARE SECTION;
249 EXEC SQL END DECLARE SECTION;
254 id = *(int *)argv[0];
256 EXEC SQL UPDATE nfsphys SET modtime = 'now', modby = :who, modwith = :entity
257 WHERE dir = :dir AND mach_id = :id;
262 /* sets the modtime on a filesystem, where argv[0] contains the filesys
266 set_filesys_modtime(q, argv, cl)
271 EXEC SQL BEGIN DECLARE SECTION;
272 char *label, *entity;
274 extern int _var_phys_id;
276 EXEC SQL END DECLARE SECTION;
282 if (!strcmp(q->shortname, "ufil"))
285 EXEC SQL UPDATE filesys SET modtime = 'now', modby = :who,
286 modwith = :entity, phys_id = :_var_phys_id
287 WHERE label = LEFT(:label,SIZE(label));
292 /* sets the modtime on a zephyr class, where argv[0] contains the class
296 set_zephyr_modtime(q, argv, cl)
301 EXEC SQL BEGIN DECLARE SECTION;
302 char *class, *entity;
304 EXEC SQL END DECLARE SECTION;
311 EXEC SQL UPDATE zephyr SET modtime = 'now', modby = :who, modwith = :entity
312 WHERE class = LEFT(:class,SIZE(class));
318 /* fixes the modby field. This will be the second to last thing in the
319 * argv, the argv length is determined from the query structure. It is
320 * passed as a pointer to an integer. This will either turn it into a
321 * username, or # + the users_id.
323 followup_fix_modby(q, sq, v, action, actarg, cl)
325 register struct save_queue *sq;
327 register int (*action)();
332 char **argv, *malloc();
336 while (sq_get_data(sq, &argv)) {
339 status = id_to_name(id, "USER", &argv[i]);
341 status = id_to_name(-id, "STRING", &argv[i]);
342 if (status && status != MR_NO_MATCH)
344 (*action)(q->vcnt, argv, actarg);
345 for (j = 0; j < q->vcnt; j++)
354 /* After retrieving a user account, fix the modby field and signature.
355 * The modby field is the second to last thing in the
356 * argv, the argv length is determined from the query structure. It is
357 * passed as a pointer to an integer. This will either turn it into a
358 * username, or # + the users_id. Only "gua*" queries have a signature,
359 * these are ones with U_END return values. "gub*" queries also use this
360 * routine but don't have a signature.
362 followup_guax(q, sq, v, action, actarg, cl)
364 register struct save_queue *sq;
366 register int (*action)();
371 char **argv, *malloc();
373 unsigned char sigbuf[256];
376 EXEC SQL BEGIN DECLARE SECTION;
379 varchar struct { short data_size; char data_buf[257];} rsig;
380 EXEC SQL END DECLARE SECTION;
385 while (sq_get_data(sq, &argv)) {
387 com_err(whoami, 0, "argv[SIGNATURE] = \"%s\"", argv[U_SIGNATURE]);
391 status = id_to_name(id, "USER", &argv[i]);
393 status = id_to_name(-id, "STRING", &argv[i]);
394 if (status && status != MR_NO_MATCH)
397 if (q->vcnt == U_END && strlen(argv[U_SIGNATURE])) {
398 login = argv[U_NAME];
399 EXEC SQL REPEATED SELECT signature, sigdate, sigwho
400 INTO :rsig, :timestamp, :who FROM users
401 WHERE login = :login;
402 /** What about (INGRES) error handling? **/
404 status = id_to_name(who, "STRING", &kname);
405 si.timestamp = timestamp;
406 si.SigInfoVersion = 0; /* XXXXX this isn't used */
407 kname_parse(si.pname, si.pinst, si.prealm, kname);
409 rsig.data_buf[rsig.data_size] = 0;
410 si.rawsig = (unsigned char *)strsave(rsig.data_buf);
411 if (log_flags & LOG_GDSS)
412 com_err(whoami, 0, "rawsig length = %d, sig=\"%s\"", strlen(si.rawsig), si.rawsig);
413 GDSS_Recompose(&si, sigbuf);
415 free(argv[U_SIGNATURE]);
416 argv[U_SIGNATURE] = strsave(sigbuf);
417 if (log_flags & LOG_GDSS)
418 com_err(whoami, 0, "generated signature length %d", strlen(sigbuf));
421 (*action)(q->vcnt, argv, actarg);
422 for (j = 0; j < q->vcnt; j++)
432 ** followup_ausr - add finger and pobox entries, set_user_modtime
435 ** argv[0] - login (add_user)
436 ** argv[3] - last name
437 ** argv[4] - first name
438 ** argv[5] - middle name
442 followup_ausr(q, argv, cl)
447 EXEC SQL BEGIN DECLARE SECTION;
449 char *login, *entity, *src, *dst, *name;
451 EXEC SQL END DECLARE SECTION;
453 char databuf[32], *kname_unparse();
454 EXEC SQL BEGIN DECLARE SECTION;
456 int sigwho, timestamp;
457 EXEC SQL END DECLARE SECTION;
462 if (strlen(argv[4]) && strlen(argv[5]))
463 sprintf(fullname, "%s %s %s", argv[4], argv[5], argv[3]);
464 else if (strlen(argv[4]))
465 sprintf(fullname, "%s %s", argv[4], argv[3]);
467 sprintf(fullname, "%s", argv[3]);
470 if (q->vcnt == U_END && *argv[U_SIGNATURE]) {
471 /* unquote ' chars in signature */
472 for (dst = src = argv[U_SIGNATURE]; *src; ) {
478 sprintf(databuf, "%s:%s", argv[U_NAME], argv[U_MITID]);
479 /* skip bytes for timestamp & kname */
480 si.rawsig = (unsigned char *) rawsig;
481 status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE], &si);
482 if (strlen(rawsig) > mr_sig_length) {
483 com_err(whoami, 0, "GDSS signature would be truncated."); /** untested **/
487 name = kname_unparse(si.pname, si.pinst, si.prealm);
488 status = name_to_id(name, "STRING", &sigwho);
489 if (status == MR_NO_MATCH) {
490 sigwho=add_string(name);
493 timestamp = si.timestamp;
495 if (log_flags & LOG_GDSS)
496 hex_dump(argv[U_SIGNATURE]);
497 return(gdss2et(status));
510 /* create finger entry, pobox & set modtime on user */
512 EXEC SQL REPEATED UPDATE users
513 SET modtime='now', modby=:who, modwith = :entity,
514 fullname = :fullname, affiliation = type,
515 signature = :rawsig, sigdate = :timestamp, sigwho = :sigwho,
516 fmodtime='now', fmodby = :who, fmodwith = :entity,
517 potype='NONE', pmodtime='now', pmodby = :who, pmodwith = :entity
518 WHERE login = :login;
520 EXEC SQL REPEATED UPDATE users
521 SET modtime='now', modby=:who, modwith = :entity,
522 fullname = :fullname, affiliation = type,
523 fmodtime='now', fmodby = :who, fmodwith = :entity,
524 potype='NONE', pmodtime='now', pmodby = :who, pmodwith = :entity
525 WHERE login = :login;
533 ** followup_uusr - do signature, set_user_modtime
536 ** argv[0] - login (add_user)
537 ** argv[U_SIGNATURE] - sig
541 followup_uuac(q, argv, cl)
546 EXEC SQL BEGIN DECLARE SECTION;
548 char *entity, *name, *src, *dst;
549 EXEC SQL END DECLARE SECTION;
551 char databuf[32], *kname_unparse();
552 EXEC SQL BEGIN DECLARE SECTION;
555 int sigwho, timestamp;
556 EXEC SQL END DECLARE SECTION;
560 id = *(int *)argv[0];
565 if (q->vcnt == U_MODTIME && *argv[U_SIGNATURE + 1]) {
566 /* unquote ' chars in signature */
567 for (dst = src = argv[U_SIGNATURE+1]; *src; ) {
574 status = id_to_name(id, "USER", &login);
575 sprintf(databuf, "%s:%s", login, argv[U_MITID+1]);
577 /* skip bytes for timestamp & kname */
578 si.rawsig = (unsigned char *) rawsig;
580 com_err(whoami, 0, "verifying sig");
582 status = GDSS_Verify(databuf, strlen(databuf), argv[U_SIGNATURE+1], &si);
584 com_err(whoami, 0, "verified");
586 if (strlen(rawsig) > mr_sig_length) {
587 com_err(whoami, 0, "GDSS signature would be truncated."); /** untested **/
591 name = kname_unparse(si.pname, si.pinst, si.prealm);
592 status = name_to_id(name, "STRING", &sigwho);
593 if (status == MR_NO_MATCH) {
594 sigwho=add_string(name);
597 timestamp = si.timestamp;
599 if (log_flags & LOG_GDSS)
600 hex_dump(argv[U_SIGNATURE+1]);
601 return(gdss2et(status));
610 /* create finger entry, pobox & set modtime on user */
613 EXEC SQL REPEATED UPDATE users SET modtime='now', modby = :who, modwith = :entity,
614 signature = :rawsig, sigdate = :timestamp, sigwho = :sigwho
615 WHERE users_id = :id;
617 EXEC SQL REPEATED UPDATE users SET modtime='now', modby = :who, modwith = :entity
618 WHERE users_id = :id;
624 /* followup_gpob: fixes argv[2] based on the IDs currently there and the
625 * type in argv[1]. Then completes the upcall to the user.
627 * argv[2] is of the form "123:234" where the first integer is the machine
628 * ID if it is a pop box, and the second is the string ID if it is an SMTP
629 * box. argv[1] should be "POP", "SMTP", or "NONE". Boxes of type NONE
633 followup_gpob(q, sq, v, action, actarg, cl)
634 register struct query *q;
635 register struct save_queue *sq;
636 register struct validate *v;
637 register int (*action)();
641 char **argv, *index();
643 int mid, sid, status, i;
646 while (sq_get_data(sq, &argv)) {
647 mr_trim_args(2, argv);
649 p = index(argv[2], ':');
654 if (!strcmp(ptype, "POP")) {
655 status = id_to_name(mid, "MACHINE", &argv[2]);
656 if (status == MR_NO_MATCH)
658 } else if (!strcmp(ptype, "SMTP")) {
659 status = id_to_name(sid, "STRING", &argv[2]);
660 if (status == MR_NO_MATCH)
662 } else /* ptype == "NONE" */ {
665 if (status) return(status);
667 if (!strcmp(q->shortname, "gpob")) {
670 status = id_to_name(sid, "USER", &argv[4]);
672 status = id_to_name(-sid, "STRING", &argv[4]);
674 if (status && status != MR_NO_MATCH) return(status);
676 (*action)(q->vcnt, argv, actarg);
678 /* free saved data */
679 for (i = 0; i < q->vcnt; i++)
689 /* followup_gsnt: fix the ace_name in argv[7]. argv[6] will contain the
690 * ace_type: "LIST", "USER", or "NONE". Decode the id in argv[7] into the
691 * proper name based on the type, and repace that string in the argv.
692 * Also fixes the modby field by called followup_fix_modby.
695 followup_gsnt(q, sq, v, action, actarg, cl)
696 register struct query *q;
697 register struct save_queue *sq;
698 register struct validate *v;
699 register int (*action)();
703 char **argv, *malloc(), *realloc(), *type;
704 int id, i, idx, status;
708 while (sq_get_data(sq, &argv)) {
709 mr_trim_args(q->vcnt, argv);
711 id = atoi(argv[i = q->vcnt - 2]);
713 status = id_to_name(id, "USER", &argv[i]);
715 status = id_to_name(-id, "STRING", &argv[i]);
716 if (status && status != MR_NO_MATCH)
719 id = atoi(argv[idx]);
720 type = argv[idx - 1];
722 if (!strcmp(type, "LIST")) {
723 status = id_to_name(id, "LIST", &argv[idx]);
724 } else if (!strcmp(type, "USER")) {
725 status = id_to_name(id, "USER", &argv[idx]);
726 } else if (!strcmp(type, "KERBEROS")) {
727 status = id_to_name(id, "STRING", &argv[idx]);
728 } else if (!strcmp(type, "NONE")) {
731 argv[idx] = strsave("NONE");
735 argv[idx] = strsave("???");
737 if (status && status != MR_NO_MATCH)
741 (*action)(q->vcnt, argv, actarg);
743 /* free saved data */
744 for (i = 0; i < q->vcnt; i++)
754 /* followup_glin: fix the ace_name in argv[8]. argv[7] will contain the
755 * ace_type: "LIST", "USER", or "NONE". Decode the id in argv[8] into the
756 * proper name based on the type, and repace that string in the argv.
757 * Also fixes the modby field by called followup_fix_modby.
760 followup_glin(q, sq, v, action, actarg, cl)
761 register struct query *q;
762 register struct save_queue *sq;
763 register struct validate *v;
764 register int (*action)();
768 char **argv, *malloc(), *realloc(), *type;
769 int id, i, idx, status;
772 if (!strcmp(q->shortname, "gsin"))
775 while (sq_get_data(sq, &argv)) {
776 mr_trim_args(q->vcnt, argv);
778 id = atoi(argv[i = q->vcnt - 2]);
780 status = id_to_name(id, "USER", &argv[i]);
782 status = id_to_name(-id, "STRING", &argv[i]);
783 if (status && status != MR_NO_MATCH)
786 id = atoi(argv[idx]);
787 type = argv[idx - 1];
789 if (!strcmp(type, "LIST")) {
790 status = id_to_name(id, "LIST", &argv[idx]);
791 } else if (!strcmp(type, "USER")) {
792 status = id_to_name(id, "USER", &argv[idx]);
793 } else if (!strcmp(type, "KERBEROS")) {
794 status = id_to_name(id, "STRING", &argv[idx]);
795 } else if (!strcmp(type, "NONE")) {
798 argv[idx] = strsave("NONE");
802 argv[idx] = strsave("???");
804 if (status && status != MR_NO_MATCH)
807 if (!strcmp(q->shortname, "glin") && atoi(argv[6]) == -1) {
808 argv[6] = realloc(argv[6], strlen(UNIQUE_GID) + 1);
809 strcpy(argv[6], UNIQUE_GID);
813 (*action)(q->vcnt, argv, actarg);
815 /* free saved data */
816 for (i = 0; i < q->vcnt; i++)
826 /* followup_gqot: Fix the entity name, directory name & modby fields
827 * argv[0] = filsys_id
829 * argv[2] = entity_id
830 * argv[3] = ascii(quota)
833 followup_gqot(q, sq, v, action, actarg, cl)
835 register struct save_queue *sq;
837 register int (*action)();
842 char **argv, *malloc();
843 EXEC SQL BEGIN DECLARE SECTION;
846 EXEC SQL END DECLARE SECTION;
849 if (!strcmp(q->name, "get_quota") ||
850 !strcmp(q->name, "get_quota_by_filesys"))
854 while (sq_get_data(sq, &argv)) {
856 switch (argv[1][0]) {
858 status = id_to_name(atoi(argv[2]), "USER", &argv[2]);
862 status = id_to_name(atoi(argv[2]), "LIST", &argv[2]);
866 argv[2] = strsave("system:anyuser");
871 sprintf(argv[2], "%d", id);
874 id = atoi(argv[idx]);
876 argv[idx] = malloc(256);
880 EXEC SQL REPEATED SELECT name INTO :name FROM filesys
881 WHERE label = :label;
883 EXEC SQL REPEATED SELECT dir INTO :name FROM nfsphys
884 WHERE nfsphys_id = :id;
886 if (sqlca.sqlerrd[2] != 1) {
887 sprintf(argv[idx], "#%d", id);
890 id = atoi(argv[idx+3]);
892 status = id_to_name(id, "USER", &argv[idx+3]);
894 status = id_to_name(-id, "STRING", &argv[idx+3]);
895 if (status && status != MR_NO_MATCH)
897 (*action)(q->vcnt, argv, actarg);
898 for (j = 0; j < q->vcnt; j++)
907 /* followup_aqot: Add allocation to nfsphys after creating quota.
908 * argv[0] = filsys_id
909 * argv[1] = type if "add_quota" or "update_quota"
911 * argv[3 or 2] = ascii(quota)
914 followup_aqot(q, argv, cl)
919 EXEC SQL BEGIN DECLARE SECTION;
920 int quota, id, fs, who, physid;
921 char *entity, *qtype, *table_name;
922 EXEC SQL END DECLARE SECTION;
927 table_name=q->rtable;
928 fs = *(int *)argv[0];
929 EXEC SQL REPEATED SELECT phys_id INTO :physid FROM filesys
930 WHERE filsys_id = :fs;
934 if (!strcmp(q->shortname, "aqot") || !strcmp(q->shortname, "uqot")) {
936 id = *(int *)argv[2];
937 quota = atoi(argv[3]);
938 sprintf(incr_qual,"q.filsys_id = %d",fs);
941 id = *(int *)argv[1];
942 quota = atoi(argv[2]);
943 sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
947 /* quota case of incremental_{before|after} only looks at slot 1 */
950 /* Follows one of many possible gross hacks to fix these particular
951 * conflicts between what is possible in the query table and what
952 * is possible in SQL.
954 if(q->type==APPEND) {
955 incremental_clear_before();
956 EXEC SQL INSERT INTO quota
957 (filsys_id, type, entity_id, quota, phys_id)
958 VALUES (:fs, :qtype, :id, :quota, :physid);
959 incremental_after(table_name, incr_qual, incr_argv);
961 incremental_before(table_name, incr_qual, incr_argv);
962 EXEC SQL UPDATE quota SET quota = :quota
963 WHERE filsys_id = :fs AND type = :qtype AND entity_id = :id;
965 incremental_after(table_name, incr_qual, incr_argv);
970 flush_name(argv[0], q->rtable);
971 if(q->type==APPEND) {
972 EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = 'now'
973 WHERE table_name = :table_name;
975 EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = 'now'
976 WHERE table_name = :table_name;
979 /* Proceed with original followup */
983 EXEC SQL REPEATED UPDATE quota
984 SET modtime = 'now', modby = :who, modwith = :entity
985 WHERE filsys_id = :fs and type = :qtype and entity_id = :id;
986 EXEC SQL REPEATED UPDATE nfsphys SET allocated = allocated + :quota
987 WHERE nfsphys_id = :physid;
988 if (ingres_errno) return(mr_errcode);
993 /* Necessitated by the requirement of a correlation name by the incremental
994 * routines, since query table deletes don't provide one.
996 followup_dqot(q,argv,cl)
1004 EXEC SQL BEGIN DECLARE SECTION;
1007 EXEC SQL END DECLARE SECTION;
1009 fs = *(int *)argv[0];
1010 if (!strcmp(q->shortname, "dqot")) {
1012 id = *(int *)argv[2];
1015 id = *(int *)argv[1];
1017 sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
1020 /* quota case of incremental_{before|after} only looks at slot 1 */
1023 incremental_before(q->rtable, incr_qual, incr_argv);
1024 EXEC SQL DELETE FROM quota q WHERE :incr_qual;
1025 incremental_clear_after();
1029 flush_name(argv[0], q->rtable);
1031 tblname = q->rtable;
1032 EXEC SQL UPDATE tblstats SET deletes = deletes + 1, modtime = 'now'
1033 WHERE table_name = :tblname;
1038 followup_gpce(q, sq, v, action, actarg, cl)
1040 register struct save_queue *sq;
1042 register int (*action)();
1043 register int actarg;
1047 char **argv, *malloc();
1051 while (sq_get_data(sq, &argv)) {
1052 id = atoi(argv[PCAP_QSERVER]);
1053 status = id_to_name(id, "MACHINE", &argv[PCAP_QSERVER]);
1054 if (status) return (status);
1057 status = id_to_name(id, "USER", &argv[i]);
1059 status = id_to_name(-id, "STRING", &argv[i]);
1060 if (status && status != MR_NO_MATCH)
1062 (*action)(q->vcnt, argv, actarg);
1063 for (j = 0; j < q->vcnt; j++)
1075 followup_gzcl(q, sq, v, action, actarg, cl)
1076 register struct query *q;
1077 register struct save_queue *sq;
1078 register struct validate *v;
1079 register int (*action)();
1086 while (sq_get_data(sq, &argv)) {
1087 mr_trim_args(q->vcnt, argv);
1089 id = atoi(argv[i = q->vcnt - 2]);
1091 status = id_to_name(id, "USER", &argv[i]);
1093 status = id_to_name(-id, "STRING", &argv[i]);
1094 if (status && status != MR_NO_MATCH)
1097 for (i = 1; i < 8; i+=2) {
1098 id = atoi(argv[i+1]);
1099 if (!strcmp(argv[i], "LIST")) {
1100 status = id_to_name(id, "LIST", &argv[i+1]);
1101 } else if (!strcmp(argv[i], "USER")) {
1102 status = id_to_name(id, "USER", &argv[i+1]);
1103 } else if (!strcmp(argv[i], "KERBEROS")) {
1104 status = id_to_name(id, "STRING", &argv[i+1]);
1105 } else if (!strcmp(argv[i], "NONE")) {
1108 argv[i+1] = strsave("NONE");
1112 argv[i+1] = strsave("???");
1114 if (status && status != MR_NO_MATCH)
1119 (*action)(q->vcnt, argv, actarg);
1121 /* free saved data */
1122 for (i = 0; i < q->vcnt; i++)
1134 followup_gsha(q, sq, v, action, actarg, cl)
1135 register struct query *q;
1136 register struct save_queue *sq;
1137 register struct validate *v;
1138 register int (*action)();
1145 while (sq_get_data(sq, &argv)) {
1146 mr_trim_args(q->vcnt, argv);
1150 status = id_to_name(id, "USER", &argv[4]);
1152 status = id_to_name(-id, "STRING", &argv[4]);
1153 if (status && status != MR_NO_MATCH)
1157 if (!strcmp(argv[1], "LIST")) {
1158 status = id_to_name(id, "LIST", &argv[2]);
1159 } else if (!strcmp(argv[1], "USER")) {
1160 status = id_to_name(id, "USER", &argv[2]);
1161 } else if (!strcmp(argv[1], "KERBEROS")) {
1162 status = id_to_name(id, "STRING", &argv[2]);
1163 } else if (!strcmp(argv[1], "NONE")) {
1166 argv[2] = strsave("NONE");
1170 argv[2] = strsave("???");
1172 if (status && status != MR_NO_MATCH)
1176 (*action)(q->vcnt, argv, actarg);
1178 /* free saved data */
1179 for (i = 0; i < q->vcnt; i++)
1188 int _sdl_followup(q, argv, cl)
1197 EXEC SQL set printqry;
1199 EXEC SQL set noprintqry;
1211 fprintf(stderr, "Size: %d\n", strlen(p));
1212 while (strlen(p) >= 8) {
1213 fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1214 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
1217 switch (strlen(p)) {
1219 fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x\n",
1220 p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
1223 fprintf(stderr, "%02x %02x %02x %02x %02x %02x\n",
1224 p[0], p[1], p[2], p[3], p[4], p[5]);
1227 fprintf(stderr, "%02x %02x %02x %02x %02x\n",
1228 p[0], p[1], p[2], p[3], p[4]);
1231 fprintf(stderr, "%02x %02x %02x %02x\n",
1232 p[0], p[1], p[2], p[3]);
1235 fprintf(stderr, "%02x %02x %02x\n",
1239 fprintf(stderr, "%02x %02x\n",
1243 fprintf(stderr, "%02x\n",