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_ghst: fix the ace_name in argv[12]. argv[11] will contain the
755 * ace_type: "LIST", "USER", or "NONE". Decode the id in argv[12] 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_ghst(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;
771 while (sq_get_data(sq, &argv)) {
772 mr_trim_args(q->vcnt, argv);
774 id = atoi(argv[i = q->vcnt - 2]);
776 status = id_to_name(id, "USER", &argv[i]);
778 status = id_to_name(-id, "STRING", &argv[i]);
779 if (status && status != MR_NO_MATCH)
783 status = id_to_name(id, "STRING", &argv[13]);
784 if (status) return(status);
786 status = id_to_name(id, "STRING", &argv[14]);
787 if (status) return(status);
790 status = id_to_name(-id, "STRING", &argv[16]);
792 status = id_to_name(id, "USER", &argv[16]);
793 if (status) return(status);
796 id = atoi(argv[idx]);
797 type = strtrim(argv[idx - 1]);
799 if (!strcmp(type, "LIST")) {
800 status = id_to_name(id, "LIST", &argv[idx]);
801 } else if (!strcmp(type, "USER")) {
802 status = id_to_name(id, "USER", &argv[idx]);
803 } else if (!strcmp(type, "KERBEROS")) {
804 status = id_to_name(id, "STRING", &argv[idx]);
805 } else if (!strcmp(type, "NONE")) {
808 argv[idx] = strsave("NONE");
812 argv[idx] = strsave("???");
814 if (status && status != MR_NO_MATCH)
818 (*action)(q->vcnt, argv, actarg);
820 /* free saved data */
821 for (i = 0; i < q->vcnt; i++)
831 /* followup_glin: fix the ace_name in argv[8]. argv[7] will contain the
832 * ace_type: "LIST", "USER", or "NONE". Decode the id in argv[8] into the
833 * proper name based on the type, and repace that string in the argv.
834 * Also fixes the modby field by called followup_fix_modby.
837 followup_glin(q, sq, v, action, actarg, cl)
838 register struct query *q;
839 register struct save_queue *sq;
840 register struct validate *v;
841 register int (*action)();
845 char **argv, *malloc(), *realloc(), *type;
846 int id, i, idx, status;
849 if (!strcmp(q->shortname, "gsin"))
852 while (sq_get_data(sq, &argv)) {
853 mr_trim_args(q->vcnt, argv);
855 id = atoi(argv[i = q->vcnt - 2]);
857 status = id_to_name(id, "USER", &argv[i]);
859 status = id_to_name(-id, "STRING", &argv[i]);
860 if (status && status != MR_NO_MATCH)
863 id = atoi(argv[idx]);
864 type = argv[idx - 1];
866 if (!strcmp(type, "LIST")) {
867 status = id_to_name(id, "LIST", &argv[idx]);
868 } else if (!strcmp(type, "USER")) {
869 status = id_to_name(id, "USER", &argv[idx]);
870 } else if (!strcmp(type, "KERBEROS")) {
871 status = id_to_name(id, "STRING", &argv[idx]);
872 } else if (!strcmp(type, "NONE")) {
875 argv[idx] = strsave("NONE");
879 argv[idx] = strsave("???");
881 if (status && status != MR_NO_MATCH)
884 if (!strcmp(q->shortname, "glin") && atoi(argv[6]) == -1) {
885 argv[6] = realloc(argv[6], strlen(UNIQUE_GID) + 1);
886 strcpy(argv[6], UNIQUE_GID);
890 (*action)(q->vcnt, argv, actarg);
892 /* free saved data */
893 for (i = 0; i < q->vcnt; i++)
903 /* followup_gqot: Fix the entity name, directory name & modby fields
904 * argv[0] = filsys_id
906 * argv[2] = entity_id
907 * argv[3] = ascii(quota)
910 followup_gqot(q, sq, v, action, actarg, cl)
912 register struct save_queue *sq;
914 register int (*action)();
919 char **argv, *malloc();
920 EXEC SQL BEGIN DECLARE SECTION;
923 EXEC SQL END DECLARE SECTION;
926 if (!strcmp(q->name, "get_quota") ||
927 !strcmp(q->name, "get_quota_by_filesys"))
931 while (sq_get_data(sq, &argv)) {
933 switch (argv[1][0]) {
935 status = id_to_name(atoi(argv[2]), "USER", &argv[2]);
939 status = id_to_name(atoi(argv[2]), "LIST", &argv[2]);
943 argv[2] = strsave("system:anyuser");
948 sprintf(argv[2], "%d", id);
951 id = atoi(argv[idx]);
953 argv[idx] = malloc(256);
957 EXEC SQL REPEATED SELECT name INTO :name FROM filesys
958 WHERE label = :label;
960 EXEC SQL REPEATED SELECT dir INTO :name FROM nfsphys
961 WHERE nfsphys_id = :id;
963 if (sqlca.sqlerrd[2] != 1) {
964 sprintf(argv[idx], "#%d", id);
967 id = atoi(argv[idx+3]);
969 status = id_to_name(id, "USER", &argv[idx+3]);
971 status = id_to_name(-id, "STRING", &argv[idx+3]);
972 if (status && status != MR_NO_MATCH)
974 (*action)(q->vcnt, argv, actarg);
975 for (j = 0; j < q->vcnt; j++)
984 /* followup_aqot: Add allocation to nfsphys after creating quota.
985 * argv[0] = filsys_id
986 * argv[1] = type if "add_quota" or "update_quota"
988 * argv[3 or 2] = ascii(quota)
991 followup_aqot(q, argv, cl)
996 EXEC SQL BEGIN DECLARE SECTION;
997 int quota, id, fs, who, physid;
998 char *entity, *qtype, *table_name;
999 EXEC SQL END DECLARE SECTION;
1004 table_name=q->rtable;
1005 fs = *(int *)argv[0];
1006 EXEC SQL REPEATED SELECT phys_id INTO :physid FROM filesys
1007 WHERE filsys_id = :fs;
1011 if (!strcmp(q->shortname, "aqot") || !strcmp(q->shortname, "uqot")) {
1013 id = *(int *)argv[2];
1014 quota = atoi(argv[3]);
1015 sprintf(incr_qual,"q.filsys_id = %d",fs);
1018 id = *(int *)argv[1];
1019 quota = atoi(argv[2]);
1020 sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
1024 /* quota case of incremental_{before|after} only looks at slot 1 */
1027 /* Follows one of many possible gross hacks to fix these particular
1028 * conflicts between what is possible in the query table and what
1029 * is possible in SQL.
1031 if(q->type==APPEND) {
1032 incremental_clear_before();
1033 EXEC SQL INSERT INTO quota
1034 (filsys_id, type, entity_id, quota, phys_id)
1035 VALUES (:fs, :qtype, :id, :quota, :physid);
1036 incremental_after(table_name, incr_qual, incr_argv);
1038 incremental_before(table_name, incr_qual, incr_argv);
1039 EXEC SQL UPDATE quota SET quota = :quota
1040 WHERE filsys_id = :fs AND type = :qtype AND entity_id = :id;
1041 status = mr_errcode;
1042 incremental_after(table_name, incr_qual, incr_argv);
1047 flush_name(argv[0], q->rtable);
1048 if(q->type==APPEND) {
1049 EXEC SQL UPDATE tblstats SET appends = appends + 1, modtime = 'now'
1050 WHERE table_name = :table_name;
1052 EXEC SQL UPDATE tblstats SET updates = updates + 1, modtime = 'now'
1053 WHERE table_name = :table_name;
1056 /* Proceed with original followup */
1057 who = cl->client_id;
1058 entity = cl->entity;
1060 EXEC SQL REPEATED UPDATE quota
1061 SET modtime = 'now', modby = :who, modwith = :entity
1062 WHERE filsys_id = :fs and type = :qtype and entity_id = :id;
1063 EXEC SQL REPEATED UPDATE nfsphys SET allocated = allocated + :quota
1064 WHERE nfsphys_id = :physid;
1065 if (ingres_errno) return(mr_errcode);
1070 /* Necessitated by the requirement of a correlation name by the incremental
1071 * routines, since query table deletes don't provide one.
1073 followup_dqot(q,argv,cl)
1081 EXEC SQL BEGIN DECLARE SECTION;
1084 EXEC SQL END DECLARE SECTION;
1086 fs = *(int *)argv[0];
1087 if (!strcmp(q->shortname, "dqot")) {
1089 id = *(int *)argv[2];
1092 id = *(int *)argv[1];
1094 sprintf(incr_qual,"q.filsys_id=%d AND q.type='%s' AND q.entity_id=%d",
1097 /* quota case of incremental_{before|after} only looks at slot 1 */
1100 incremental_before(q->rtable, incr_qual, incr_argv);
1101 EXEC SQL DELETE FROM quota q WHERE :incr_qual;
1102 incremental_clear_after();
1106 flush_name(argv[0], q->rtable);
1108 tblname = q->rtable;
1109 EXEC SQL UPDATE tblstats SET deletes = deletes + 1, modtime = 'now'
1110 WHERE table_name = :tblname;
1115 followup_gpce(q, sq, v, action, actarg, cl)
1117 register struct save_queue *sq;
1119 register int (*action)();
1120 register int actarg;
1124 char **argv, *malloc();
1128 while (sq_get_data(sq, &argv)) {
1129 id = atoi(argv[PCAP_QSERVER]);
1130 status = id_to_name(id, "MACHINE", &argv[PCAP_QSERVER]);
1131 if (status) return (status);
1134 status = id_to_name(id, "USER", &argv[i]);
1136 status = id_to_name(-id, "STRING", &argv[i]);
1137 if (status && status != MR_NO_MATCH)
1139 (*action)(q->vcnt, argv, actarg);
1140 for (j = 0; j < q->vcnt; j++)
1152 followup_gzcl(q, sq, v, action, actarg, cl)
1153 register struct query *q;
1154 register struct save_queue *sq;
1155 register struct validate *v;
1156 register int (*action)();
1163 while (sq_get_data(sq, &argv)) {
1164 mr_trim_args(q->vcnt, argv);
1166 id = atoi(argv[i = q->vcnt - 2]);
1168 status = id_to_name(id, "USER", &argv[i]);
1170 status = id_to_name(-id, "STRING", &argv[i]);
1171 if (status && status != MR_NO_MATCH)
1174 for (i = 1; i < 8; i+=2) {
1175 id = atoi(argv[i+1]);
1176 if (!strcmp(argv[i], "LIST")) {
1177 status = id_to_name(id, "LIST", &argv[i+1]);
1178 } else if (!strcmp(argv[i], "USER")) {
1179 status = id_to_name(id, "USER", &argv[i+1]);
1180 } else if (!strcmp(argv[i], "KERBEROS")) {
1181 status = id_to_name(id, "STRING", &argv[i+1]);
1182 } else if (!strcmp(argv[i], "NONE")) {
1185 argv[i+1] = strsave("NONE");
1189 argv[i+1] = strsave("???");
1191 if (status && status != MR_NO_MATCH)
1196 (*action)(q->vcnt, argv, actarg);
1198 /* free saved data */
1199 for (i = 0; i < q->vcnt; i++)
1211 followup_gsha(q, sq, v, action, actarg, cl)
1212 register struct query *q;
1213 register struct save_queue *sq;
1214 register struct validate *v;
1215 register int (*action)();
1222 while (sq_get_data(sq, &argv)) {
1223 mr_trim_args(q->vcnt, argv);
1227 status = id_to_name(id, "USER", &argv[4]);
1229 status = id_to_name(-id, "STRING", &argv[4]);
1230 if (status && status != MR_NO_MATCH)
1234 if (!strcmp(argv[1], "LIST")) {
1235 status = id_to_name(id, "LIST", &argv[2]);
1236 } else if (!strcmp(argv[1], "USER")) {
1237 status = id_to_name(id, "USER", &argv[2]);
1238 } else if (!strcmp(argv[1], "KERBEROS")) {
1239 status = id_to_name(id, "STRING", &argv[2]);
1240 } else if (!strcmp(argv[1], "NONE")) {
1243 argv[2] = strsave("NONE");
1247 argv[2] = strsave("???");
1249 if (status && status != MR_NO_MATCH)
1253 (*action)(q->vcnt, argv, actarg);
1255 /* free saved data */
1256 for (i = 0; i < q->vcnt; i++)
1265 int _sdl_followup(q, argv, cl)
1274 EXEC SQL set printqry;
1276 EXEC SQL set noprintqry;
1288 fprintf(stderr, "Size: %d\n", strlen(p));
1289 while (strlen(p) >= 8) {
1290 fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x %02x\n",
1291 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]);
1294 switch (strlen(p)) {
1296 fprintf(stderr, "%02x %02x %02x %02x %02x %02x %02x\n",
1297 p[0], p[1], p[2], p[3], p[4], p[5], p[6]);
1300 fprintf(stderr, "%02x %02x %02x %02x %02x %02x\n",
1301 p[0], p[1], p[2], p[3], p[4], p[5]);
1304 fprintf(stderr, "%02x %02x %02x %02x %02x\n",
1305 p[0], p[1], p[2], p[3], p[4]);
1308 fprintf(stderr, "%02x %02x %02x %02x\n",
1309 p[0], p[1], p[2], p[3]);
1312 fprintf(stderr, "%02x %02x %02x\n",
1316 fprintf(stderr, "%02x %02x\n",
1320 fprintf(stderr, "%02x\n",