3 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
8 #include <mit-copyright.h>
12 EXEC SQL INCLUDE sqlca;
14 static char phase2_qc_rcsid[] = "$Header$";
16 EXEC SQL WHENEVER SQLERROR DO dbmserr();
21 EXEC SQL BEGIN DECLARE SECTION;
22 int iid = id, found = 1;
24 EXEC SQL END DECLARE SECTION;
26 EXEC SQL DECLARE csr201 CURSOR FOR
27 SELECT clusters.name FROM clusters, mcmap
28 WHERE clusters.clu_id=mcmap.clu_id AND mcmap.mach_id = :iid;
31 EXEC SQL FETCH csr201 INTO :name;
32 if (sqlca.sqlcode != 0) break;
36 printf("Cluster %s, non-existant machine %d in cluster map\n", name, id);
38 EXEC SQL CLOSE csr201;
45 EXEC SQL BEGIN DECLARE SECTION;
46 int iid = id, found = 1;
48 EXEC SQL END DECLARE SECTION;
50 EXEC SQL DECLARE csr202 CURSOR FOR
51 SELECT machine.name FROM machine, mcmap
52 WHERE machine.mach_id=mcmap.mach_id AND mcmap.clu_id=:iid;
55 EXEC SQL FETCH csr202 INTO :name;
56 if (sqlca.sqlcode != 0) break;
61 printf("Machine %s, non-existant cluster %d in cluster map\n", name, id);
63 EXEC SQL CLOSE csr202;
70 EXEC SQL BEGIN DECLARE SECTION;
71 int iid = id, found = 1;
73 EXEC SQL END DECLARE SECTION;
75 EXEC SQL DECLARE csr234 CURSOR FOR
76 SELECT name FROM hostalias WHERE mach_id=:iid;
79 EXEC SQL FETCH csr234 INTO :name;
80 if (sqlca.sqlcode != 0) break;
85 printf("Alias %s, non-existant machine %d in hostalias map\n", name, id);
87 EXEC SQL CLOSE csr234;
94 EXEC SQL BEGIN DECLARE SECTION;
95 int iid = id, found = 1;
97 EXEC SQL END DECLARE SECTION;
99 EXEC SQL DECLARE csr235 CURSOR FOR
100 SELECT name FROM printcap WHERE mach_id=:iid;
101 EXEC SQL OPEN csr235;
103 EXEC SQL FETCH csr235 INTO :name;
104 if (sqlca.sqlcode != 0) break;
109 printf("Printer %s, non-existant spool machine %d in printcap table\n", name, id);
111 EXEC SQL CLOSE csr235;
118 EXEC SQL BEGIN DECLARE SECTION;
119 int iid = id, found = 1;
121 EXEC SQL END DECLARE SECTION;
123 EXEC SQL DECLARE csr236 CURSOR FOR
124 SELECT name FROM printcap WHERE quotaserver=:iid;
125 EXEC SQL OPEN csr236;
127 EXEC SQL FETCH csr236 INTO :name;
128 if (sqlca.sqlcode != 0) break;
133 printf("Printer %s, non-existant quota server %d in printcap table\n", name, id);
135 EXEC SQL CLOSE csr236;
139 user_check(id, u, hint)
144 u->comment=maybe_fixup_unref_string(u->comment, id, u->login, "users",
145 "comments", "users_id");
147 u->modby=maybe_fixup_modby(u->modby, id, u->login, "users",
148 "modby", "users_id");
150 u->fmodby=maybe_fixup_modby(u->fmodby, id, u->login, "users",
151 "fmodby", "users_id");
153 u->pmodby=maybe_fixup_modby(u->pmodby, id, u->login, "users",
154 "pmodby", "users_id");
156 u->sigwho=maybe_fixup_unref_string(u->sigwho, id, u->login, "users",
157 "sigwho", "users_id");
159 pobox_check(id, u, hint);
162 maybe_fixup_unref_string(sid, oid, oname, table, field, idfield)
165 char *field, *idfield;
167 int ret=(sid<0)?-sid:sid, doit=0, newid;
168 EXEC SQL BEGIN DECLARE SECTION;
171 EXEC SQL END DECLARE SECTION;
173 if(newid=int_hash_lookup(string_dups, ret)) {
174 printf("%s entry %s(%d) has a %s with duplicate string %d\n",
175 table, oname, oid, field, ret);
176 if(single_fix("Replace duplicate", 0)){
181 } else if(!string_check(ret)) {
182 printf("%s entry %s(%d) has a %s with non-existant string %d\n",
183 table, oname, oid, field, ret);
184 if (single_fix("Delete", 1)) {
191 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE %s = %d",
192 table, field, (sid<0)?-ret:ret, idfield, oid);
193 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
194 rowcount = sqlca.sqlerrd[2];
198 printf("Not fixed, rowcount = %d\n", rowcount);
202 return((sid<0)?-ret:ret);
206 maybe_fixup_modby(sid, oid, oname, table, field, idfield)
209 char *field, *idfield;
211 EXEC SQL BEGIN DECLARE SECTION;
214 EXEC SQL END DECLARE SECTION;
217 return maybe_fixup_unref_string(sid, oid, oname, table, field, idfield);
219 if(!hash_lookup(users, sid)) {
220 printf("%s entry %s(%d) has a %s with non-existant user %d\n",
221 table, oname, oid, field, sid);
222 if (single_fix("Delete", 1)) {
223 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE %s=%d",
224 table, field, 0, idfield, oid);
225 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
226 rowcount = sqlca.sqlerrd[2];
230 printf("Not fixed, rowcount = %d\n", rowcount);
239 maybe_fixup_unref_string2(table, field, cursor, sid)
241 char *field, *table, *cursor;
243 int ret=(sid<0)?-sid:sid, doit=0, newid;
244 EXEC SQL BEGIN DECLARE SECTION;
247 EXEC SQL END DECLARE SECTION;
249 if(newid=int_hash_lookup(string_dups, ret)) {
250 printf("%s entry has a %s with duplicate string %d\n",
252 if(single_fix("Replace duplicate", 0)){
257 } else if(!string_check(ret)) {
258 printf("%s entry has a %s with non-existant string %d\n",
260 if (single_fix("Delete", 1)) {
267 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE CURRENT OF %s",
268 table, field, (sid<0)?-ret:ret, cursor);
269 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
270 rowcount = sqlca.sqlerrd[2];
274 printf("Not fixed, rowcount = %d\n", rowcount);
277 return((sid<0)?-ret:ret);
280 maybe_fixup_modby2(table, field, cursor, id)
282 EXEC SQL BEGIN DECLARE SECTION;
285 EXEC SQL END DECLARE SECTION;
287 if(id<0) return maybe_fixup_unref_string2(table, field, cursor, id);
289 if(!hash_lookup(users, id)) {
290 printf("%s entry has a %s with non-existant user %d\n",
292 if (single_fix("Delete", 1)) {
293 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE CURRENT OF %s",
294 table, field, 0, cursor);
295 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
296 rowcount = sqlca.sqlerrd[2];
300 printf("Not fixed, rowcount = %d\n", rowcount);
309 pobox_check(id, u, hint)
316 if (!hash_lookup(machines, u->pobox_id)) {
317 printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
318 u->login, u->fullname, u->pobox_id);
319 if (single_fix("Delete", 0)) {
320 remove_pobox(u->users_id);
326 if( int_hash_lookup( string_dups, u->pobox_id ) ) {
327 printf("User %s(%s) has P.O.Box with duplicate string %d\n",
328 u->login, u->fullname, u->pobox_id);
329 if(single_fix("Update", 0)){
330 printf("Replacing box_id dup string ID %d with %d\n",
332 int_hash_lookup(string_dups, u->pobox_id));
333 u->pobox_id = int_hash_lookup( string_dups, u->pobox_id );
334 fix_smtp_pobox(u->users_id, u->pobox_id);
335 string_check(u->pobox_id);
337 } else if (!string_check(u->pobox_id)) {
338 printf("User %s(%s) has P.O.Box with non-existant string %d\n",
339 u->login, u->fullname, u->pobox_id);
340 if (single_fix("Delete", 0)) {
341 remove_pobox(u->users_id);
355 EXEC SQL BEGIN DECLARE SECTION;
356 int rowcount, iid = id;
357 EXEC SQL END DECLARE SECTION;
359 EXEC SQL UPDATE users SET potype='NONE' WHERE users.users_id = :iid;
360 rowcount = sqlca.sqlerrd[2];
362 printf("%d entr%s removed\n", rowcount, rowcount==1?"y":"ies");
364 printf("Not removed\n");
368 fix_smtp_pobox(id, sid)
371 EXEC SQL BEGIN DECLARE SECTION;
372 int rowcount, iid = id, isid=sid;
373 EXEC SQL END DECLARE SECTION;
375 EXEC SQL UPDATE users SET box_id=:isid WHERE users.users_id = :iid;
376 rowcount = sqlca.sqlerrd[2];
378 printf("%d entr%s updated\n", rowcount, rowcount==1?"y":"ies");
380 printf("Not updated\n");
384 mach_check(id, m, hint)
389 if (!hash_lookup(subnets, m->snet_id)) {
390 printf("Machine %s is on a non-existant subnet %d\n",
391 m->name, m->snet_id);
392 if (single_fix("Move to null-subnet", 1)) {
393 EXEC SQL BEGIN DECLARE SECTION;
394 int rowcount, iid = id;
395 EXEC SQL END DECLARE SECTION;
397 EXEC SQL UPDATE machine SET snet_id=0 WHERE mach_id = :iid;
398 rowcount = sqlca.sqlerrd[2];
400 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
402 printf("Not fixed\n");
407 switch (m->owner_type) {
409 if (!hash_lookup(users, m->owner_id)) {
410 printf("Machine %s has non-existant USER owner %d\n",
411 m->name, m->owner_id);
412 if (single_fix("Set to no owner", 1)) {
418 if (!hash_lookup(lists, m->owner_id)) {
419 printf("Machine %s has non-existant LIST owner %d\n",
420 m->name, m->owner_id);
421 if (single_fix("Set to no owner", 1)) {
429 m->owner_id=maybe_fixup_unref_string(m->owner_id, id, m->name,
430 "machine", "owner_id", "mach_id");
436 m->acomment=maybe_fixup_unref_string(m->acomment, id, m->name,
437 "machine", "acomment", "mach_id");
439 m->ocomment=maybe_fixup_unref_string(m->ocomment, id, m->name,
440 "machine", "ocomment", "mach_id");
442 m->creator=maybe_fixup_modby(m->creator, id, m->name, "machine",
443 "creator", "mach_id");
444 m->modby=maybe_fixup_modby(m->modby, id, m->name, "machine",
448 subnet_check(id, s, hint)
453 switch (s->owner_type) {
455 if (!hash_lookup(users, s->owner_id)) {
456 printf("Subnet %s has non-existant USER owner %d\n",
457 s->name, s->owner_id);
458 if (single_fix("Set to no owner", 1)) {
459 clear_subnet_owner(s);
464 if (!hash_lookup(lists, s->owner_id)) {
465 printf("Machine %s has non-existant LIST owner %d\n",
466 s->name, s->owner_id);
467 if (single_fix("Set to no owner", 1)) {
468 clear_subnet_owner(s);
475 s->owner_id=maybe_fixup_unref_string(s->owner_id, id, s->name,
476 "machine", "owner_id", "mach_id");
478 clear_subnet_owner(s);
481 s->modby=maybe_fixup_modby(s->modby, id, s->name, "subnet",
486 clear_subnet_owner(s)
489 EXEC SQL BEGIN DECLARE SECTION;
490 int rowcount, id = s->snet_id;
491 EXEC SQL END DECLARE SECTION;
493 EXEC SQL UPDATE subnet SET owner_type='NONE', owner_id=0
495 rowcount = sqlca.sqlerrd[2];
497 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
499 printf("Not fixed\n");
506 EXEC SQL BEGIN DECLARE SECTION;
507 int rowcount, id = m->mach_id;
508 EXEC SQL END DECLARE SECTION;
510 EXEC SQL UPDATE machine SET owner_type='NONE', owner_id=0
512 rowcount = sqlca.sqlerrd[2];
514 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
516 printf("Not fixed\n");
520 cluster_check(id, c, hint)
525 c->modby=maybe_fixup_modby(c->modby, id, c->name, "clusters",
534 EXEC SQL BEGIN DECLARE SECTION;
535 int iid = id, found = 1;
536 char label[17], data[33];
537 EXEC SQL END DECLARE SECTION;
539 EXEC SQL DECLARE csr203 CURSOR FOR
540 SELECT serv_label, serv_cluster FROM svc
542 EXEC SQL OPEN csr203;
544 EXEC SQL FETCH csr203 INTO :label, :data;
545 if (sqlca.sqlcode != 0) break;
550 printf("Cluster data [%s] %s for non-existant cluster %d\n",
553 EXEC SQL CLOSE csr203;
557 list_check(id, l, hint)
562 switch (l->acl_type) {
564 if (!hash_lookup(lists, l->acl_id)) {
565 printf("List %s has bad LIST acl %d\n", l->name, l->acl_id);
566 if (single_fix("Patch", 1)) {
567 fix_list_acl(l->list_id);
572 if (!hash_lookup(users, l->acl_id)) {
573 printf("List %s has bad USER acl %d\n", l->name, l->acl_id);
574 if (single_fix("Patch", 1)) {
575 fix_list_acl(l->list_id);
580 l->acl_id = maybe_fixup_unref_string(l->acl_id, id, l->name,
581 "list", "acl_id", "list_id");
583 printf("List %s has bad KERBEROS acl %d\n", l->name, l->acl_id);
584 if(single_fix("Patch", 1)) {
585 fix_list_acl(l->list_id);
595 EXEC SQL BEGIN DECLARE SECTION;
596 int rowcount, iid = id;
597 EXEC SQL END DECLARE SECTION;
599 EXEC SQL UPDATE list SET acl_id = :iid, acl_type='LIST'
600 WHERE list_id = :iid;
601 rowcount = sqlca.sqlerrd[2];
603 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
605 printf("Not fixed\n");
613 EXEC SQL BEGIN DECLARE SECTION;
614 int mid, iid = id, found = 1;
615 char mtype[9], *name = "";
616 EXEC SQL END DECLARE SECTION;
618 EXEC SQL DECLARE csr204 CURSOR FOR
619 SELECT member_type, member_id FROM imembers
620 WHERE list_id = :iid AND direct=1;
621 EXEC SQL OPEN csr204;
623 EXEC SQL FETCH csr204 INTO :mtype, :mid;
624 if (sqlca.sqlcode != 0) break;
629 name = ((struct list *) hash_lookup(lists, mid))->name;
630 else if (mtype[0] == 'U')
631 name = ((struct user *) hash_lookup(users, mid))->login;
632 else if (mtype[0] == 'S' || mtype[0] == 'K')
633 name = ((struct string *) hash_lookup(strings, mid))->name;
634 printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
636 EXEC SQL CLOSE csr204;
643 EXEC SQL BEGIN DECLARE SECTION;
644 int lid, iid = id, found = 1;
646 EXEC SQL END DECLARE SECTION;
648 EXEC SQL DECLARE csr205 CURSOR FOR
649 SELECT list_id FROM imembers
650 WHERE member_id = :iid AND member_type='USER' AND direct=1;
651 EXEC SQL OPEN csr205;
653 EXEC SQL FETCH csr205 INTO :lid;
654 if (sqlca.sqlcode != 0) break;
657 printf("List %s has non-existant user member, id %d\n",
658 ((struct list *)hash_lookup(lists, lid))->name, iid);
660 EXEC SQL CLOSE csr205;
667 EXEC SQL BEGIN DECLARE SECTION;
668 int lid, iid = id, found = 1;
670 EXEC SQL END DECLARE SECTION;
672 EXEC SQL DECLARE csr206 CURSOR FOR
673 SELECT list_id FROM imembers
674 WHERE member_id = :iid AND member_type='LIST' AND direct=1;
675 EXEC SQL OPEN csr206;
677 EXEC SQL FETCH csr206 INTO :lid;
678 if (sqlca.sqlcode != 0) break;
681 printf("List %s has non-existant list member, id %d\n",
682 ((struct list *)hash_lookup(lists, lid))->name, iid);
684 EXEC SQL CLOSE csr206;
691 EXEC SQL BEGIN DECLARE SECTION;
692 int lid, iid = id, found = 1;
694 EXEC SQL END DECLARE SECTION;
696 EXEC SQL DECLARE csr207 CURSOR FOR
697 SELECT list_id FROM imembers
698 WHERE member_id = :iid AND member_type='STRING' AND direct=1;
699 EXEC SQL OPEN csr207;
701 EXEC SQL FETCH csr207 INTO :lid;
702 if (sqlca.sqlcode != 0) break;
705 printf("List %s has non-existant string member, id %d\n",
706 ((struct list *)hash_lookup(lists, lid))->name, iid);
708 EXEC SQL CLOSE csr207;
716 EXEC SQL BEGIN DECLARE SECTION;
717 int lid, iid = id, found = 1;
719 EXEC SQL END DECLARE SECTION;
721 EXEC SQL DECLARE csr208 CURSOR FOR
722 SELECT list_id FROM imembers
723 WHERE member_id = :iid AND member_type='KERBEROS' AND direct=1;
724 EXEC SQL OPEN csr208;
726 EXEC SQL FETCH csr208 INTO :lid;
727 if (sqlca.sqlcode != 0) break;
730 printf("List %s has non-existant kerberos member, id %d\n",
731 ((struct list *)hash_lookup(lists, lid))->name, iid);
733 EXEC SQL CLOSE csr208;
739 EXEC SQL BEGIN DECLARE SECTION;
741 EXEC SQL END DECLARE SECTION;
743 EXEC SQL BEGIN DECLARE SECTION;
745 EXEC SQL END DECLARE SECTION;
747 EXEC SQL DELETE FROM imembers WHERE member_type='USER' AND
748 member_id = :id AND direct = 1;
749 rowcount = sqlca.sqlerrd[2];
751 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
753 printf("Not deleted\n");
754 modified("imembers");
758 EXEC SQL BEGIN DECLARE SECTION;
760 EXEC SQL END DECLARE SECTION;
762 EXEC SQL BEGIN DECLARE SECTION;
764 EXEC SQL END DECLARE SECTION;
766 EXEC SQL DELETE FROM imembers WHERE member_type='LIST' AND
767 member_id = :id AND direct=1;
768 rowcount = sqlca.sqlerrd[2];
770 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
772 printf("Not deleted\n");
773 modified("imembers");
777 EXEC SQL BEGIN DECLARE SECTION;
779 EXEC SQL END DECLARE SECTION;
781 EXEC SQL BEGIN DECLARE SECTION;
783 EXEC SQL END DECLARE SECTION;
785 EXEC SQL DELETE FROM imembers WHERE member_type='STRING' AND
786 member_id = :id AND direct=1;
787 rowcount = sqlca.sqlerrd[2];
789 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
791 printf("Not deleted\n");
792 modified("imembers");
797 EXEC SQL BEGIN DECLARE SECTION;
799 EXEC SQL END DECLARE SECTION;
801 EXEC SQL BEGIN DECLARE SECTION;
803 EXEC SQL END DECLARE SECTION;
805 EXEC SQL DELETE FROM imembers WHERE member_type='KERBEROS' AND
806 member_id = :id AND direct=1;
807 rowcount = sqlca.sqlerrd[2];
809 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
811 printf("Not deleted\n");
812 modified("imembers");
817 EXEC SQL BEGIN DECLARE SECTION;
819 EXEC SQL END DECLARE SECTION;
821 EXEC SQL BEGIN DECLARE SECTION;
823 EXEC SQL END DECLARE SECTION;
826 EXEC SQL DECLARE csr209 CURSOR FOR
827 SELECT service FROM serverhosts
829 EXEC SQL OPEN csr209;
831 EXEC SQL FETCH csr209 INTO :name;
832 if (sqlca.sqlcode != 0) break;
835 printf("ServerHost entry for service %s non-existant host %d\n",
838 EXEC SQL CLOSE csr209;
843 EXEC SQL BEGIN DECLARE SECTION;
845 EXEC SQL END DECLARE SECTION;
847 EXEC SQL BEGIN DECLARE SECTION;
849 EXEC SQL END DECLARE SECTION;
851 EXEC SQL DELETE FROM serverhosts WHERE mach_id = :id;
852 rowcount = sqlca.sqlerrd[2];
854 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
856 printf("Not deleted\n");
857 modified("serverhosts");
861 static int fnchecklen;
868 if (n->mach_id == f->mach_id &&
869 !strncmp(f->dir, n->dir, strlen(n->dir)) &&
870 strlen(n->dir) > fnchecklen) {
872 fnchecklen = strlen(n->dir);
877 check_fs(id, f, hint)
878 EXEC SQL BEGIN DECLARE SECTION;
880 EXEC SQL END DECLARE SECTION;
881 register struct filesys *f;
884 EXEC SQL BEGIN DECLARE SECTION;
885 int id1, id2, id3, rowcount;
887 EXEC SQL END DECLARE SECTION;
891 if (!hash_lookup(machines, f->mach_id)) {
892 printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
893 if (single_fix("Fix", 0)) {
894 EXEC SQL UPDATE filesys SET mach_id = 0 WHERE filsys_id = :id;
895 rowcount = sqlca.sqlerrd[2];
897 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
899 printf("Not fixed\n");
905 if (!hash_lookup(users, f->owner)) {
906 printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
907 if (single_fix("Fix", 1)) {
908 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
912 if (!hash_lookup(lists, f->owners)) {
913 printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
914 if (single_fix("Fix", 1)) {
915 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
920 if (f->type == 'N') {
921 if (!hash_lookup(nfsphys, f->phys_id)) {
922 m = (struct machine *)hash_lookup(machines, f->mach_id);
923 printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
924 if (single_fix("Fix", 1)) {
926 hash_step(nfsphys, fsmatch, f);
927 if (fnchecklen != 0) {
931 EXEC SQL UPDATE filesys SET phys_id = :id1 WHERE filsys_id = :id2;
932 rowcount = sqlca.sqlerrd[2];
934 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
936 printf("Not fixed\n");
939 printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
940 if (single_fix("Create", 0)) {
945 if (set_next_object_id("nfsphys_id", "nfsphys") !=
947 printf("Unable to assign unique ID\n");
950 EXEC SQL SELECT COUNT(*) INTO :rowcount FROM numvalues
951 WHERE name='nfsphys_id';
953 printf("Unable to retrieve unique ID\n");
956 EXEC SQL INSERT INTO mfsphys (mfsphys_id, mach_id,
957 device, dir, status, allocated, size, modtime,
958 modby, modwith) VALUES (:id1, :id3, '\?\?\?', :dir,
959 0, 0, 0, SYSDATE, 0, 'dbck');
960 rowcount = sqlca.sqlerrd[2];
962 printf("%d entr%s created\n", rowcount,
963 rowcount==1?"y":"ies");
965 printf("Not created\n");
967 n = (struct nfsphys *)malloc(sizeof(struct nfsphys));
969 out_of_mem("storing new nfsphys");
975 if( hash_store(nfsphys, id1, n) == -1 ) {
976 out_of_mem("storing nfsphys in hash table");
978 EXEC SQL UPDATE filesys SET phys_id = :id1
979 WHERE filsys_id = :id2;
980 rowcount = sqlca.sqlerrd[2];
982 printf("%d filesys entr%s fixed\n", rowcount,
983 rowcount==1?"y":"ies");
985 printf("Not fixed\n");
995 check_nfsphys(id, n, hint)
1000 if (!hash_lookup(machines, n->mach_id)) {
1001 printf("NFSphys %d(%s) on non-existant machine %d\n",
1002 id, n->dir, n->mach_id);
1003 if (single_fix("Delete", 0))
1004 single_delete("nfsphys", "nfsphys_id", id);
1008 show_fsg_missing(id)
1009 EXEC SQL BEGIN DECLARE SECTION;
1011 EXEC SQL END DECLARE SECTION;
1013 EXEC SQL BEGIN DECLARE SECTION;
1015 EXEC SQL END DECLARE SECTION;
1018 EXEC SQL DECLARE csr210 CURSOR FOR
1019 SELECT filsys_id FROM fsgroup
1020 WHERE group_id = :id;
1021 EXEC SQL OPEN csr210;
1023 EXEC SQL FETCH csr210 INTO :id1;
1024 if (sqlca.sqlcode != 0) break;
1027 if (f = (struct filesys *) hash_lookup(filesys, id1))
1028 printf("Missing fsgroup %d has member filesystem %s\n", id, f->name);
1030 printf("Missing fsgroup %d has member filesystem %d\n", id, id1);
1032 EXEC SQL CLOSE csr210;
1063 printf("FSGroup %s has type %s instead of FSGROUP\n", f->name, t);
1070 EXEC SQL BEGIN DECLARE SECTION;
1071 int rowcount, id = f->filsys_id;
1072 EXEC SQL END DECLARE SECTION;
1074 EXEC SQL UPDATE filesys SET type='FSGROUP' WHERE filsys_id = :id;
1075 rowcount = sqlca.sqlerrd[2];
1077 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
1079 printf("Not fixed\n");
1080 modified("filesys");
1083 show_fsg_nomember(id)
1084 EXEC SQL BEGIN DECLARE SECTION;
1086 EXEC SQL END DECLARE SECTION;
1088 EXEC SQL BEGIN DECLARE SECTION;
1090 EXEC SQL END DECLARE SECTION;
1093 EXEC SQL DECLARE csr211 CURSOR FOR
1094 SELECT group_id FROM fsgroup
1095 WHERE filsys_id = :id;
1096 EXEC SQL OPEN csr211;
1098 EXEC SQL FETCH csr211 INTO :id1;
1099 if (sqlca.sqlcode != 0) break;
1102 if (f = (struct filesys *) hash_lookup(filesys, id1))
1103 printf("FSGroup %s has missing member %d\n", f->name, id);
1105 printf("FSGroup %d has missing member %d\n", id1, id);
1107 EXEC SQL CLOSE csr211;
1111 show_quota_nouser(id)
1112 EXEC SQL BEGIN DECLARE SECTION;
1114 EXEC SQL END DECLARE SECTION;
1116 EXEC SQL BEGIN DECLARE SECTION;
1118 EXEC SQL END DECLARE SECTION;
1120 EXEC SQL DECLARE csr212 CURSOR FOR
1121 SELECT filsys_id FROM quota
1122 WHERE entity_id = :id AND type='USER';
1123 EXEC SQL OPEN csr212;
1125 EXEC SQL FETCH csr212 INTO :id1;
1126 if (sqlca.sqlcode != 0) break;
1129 printf("Quota on fs %d for non-existant user %d\n", id1, id);
1131 EXEC SQL CLOSE csr212;
1135 show_quota_nolist(id)
1136 EXEC SQL BEGIN DECLARE SECTION;
1138 EXEC SQL END DECLARE SECTION;
1140 EXEC SQL BEGIN DECLARE SECTION;
1142 EXEC SQL END DECLARE SECTION;
1144 EXEC SQL DECLARE csr213 CURSOR FOR
1145 SELECT filsys_id FROM quota
1146 WHERE entity_id = :id AND type='GROUP';
1147 EXEC SQL OPEN csr213;
1149 EXEC SQL FETCH csr213 INTO :id1;
1150 if (sqlca.sqlcode != 0) break;
1153 printf("Quota on fs %d for non-existant list %d\n", id1, id);
1155 EXEC SQL CLOSE csr213;
1159 fix_quota_nouser(id)
1160 EXEC SQL BEGIN DECLARE SECTION;
1162 EXEC SQL END DECLARE SECTION;
1164 EXEC SQL BEGIN DECLARE SECTION;
1166 EXEC SQL END DECLARE SECTION;
1168 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
1169 EXEC SQL DELETE FROM quota
1170 WHERE entity_id = :id AND type = 'USER';
1171 rowcount = sqlca.sqlerrd[2];
1173 printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
1175 printf("Not deleted\n");
1179 fix_quota_nolist(id)
1180 EXEC SQL BEGIN DECLARE SECTION;
1182 EXEC SQL END DECLARE SECTION;
1184 EXEC SQL BEGIN DECLARE SECTION;
1186 EXEC SQL END DECLARE SECTION;
1188 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
1189 EXEC SQL DELETE FROM quota WHERE entity_id = :id AND type='GROUP';
1190 rowcount = sqlca.sqlerrd[2];
1192 printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
1194 printf("Not deleted\n");
1199 EXEC SQL BEGIN DECLARE SECTION;
1201 EXEC SQL END DECLARE SECTION;
1203 EXEC SQL BEGIN DECLARE SECTION;
1206 EXEC SQL END DECLARE SECTION;
1208 EXEC SQL DECLARE csr214 CURSOR FOR
1209 SELECT entity_id, type FROM quota
1210 WHERE filsys_id = :id;
1211 EXEC SQL OPEN csr214;
1213 EXEC SQL FETCH csr214 INTO :id1, :type;
1214 if (sqlca.sqlcode != 0) break;
1217 printf("Quota for %s %d on non-existant filesys %d\n", type, id1, id);
1219 EXEC SQL CLOSE csr214;
1225 single_delete("quota", "filsys_id", id);
1228 show_quota_wrongpid(id)
1229 EXEC SQL BEGIN DECLARE SECTION;
1231 EXEC SQL END DECLARE SECTION;
1233 EXEC SQL BEGIN DECLARE SECTION;
1236 EXEC SQL END DECLARE SECTION;
1240 f = (struct filesys *)hash_lookup(filesys, id);
1241 EXEC SQL DECLARE csr215 CURSOR FOR
1242 SELECT entity_id, type FROM quota
1243 WHERE filsys_id = :id;
1244 EXEC SQL OPEN csr215;
1246 EXEC SQL FETCH csr215 INTO :id1, :type;
1247 if (sqlca.sqlcode != 0) break;
1250 printf("Quota for %s %d on filesys %s has wrong phys_id %d\n",
1251 type, id1, f->name, id);
1253 EXEC SQL CLOSE csr215;
1257 fix_quota_physid(id)
1258 EXEC SQL BEGIN DECLARE SECTION;
1260 EXEC SQL END DECLARE SECTION;
1262 EXEC SQL BEGIN DECLARE SECTION;
1264 EXEC SQL END DECLARE SECTION;
1266 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
1267 EXEC SQL UPDATE quota SET phys_id = :id1
1268 WHERE filsys_id = :id AND phys_id != :id1;
1269 rowcount = sqlca.sqlerrd[2];
1271 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
1273 printf("Not fixed\n");
1278 EXEC SQL BEGIN DECLARE SECTION;
1280 EXEC SQL END DECLARE SECTION;
1282 EXEC SQL BEGIN DECLARE SECTION;
1284 EXEC SQL END DECLARE SECTION;
1287 EXEC SQL DECLARE csr216 CURSOR FOR
1288 SELECT name FROM servers
1289 WHERE acl_type='USER' and acl_id = :id;
1290 EXEC SQL OPEN csr216;
1292 EXEC SQL FETCH csr216 INTO :name;
1293 if (sqlca.sqlcode != 0) break;
1296 printf("Service %s has acl non-existant user %d\n", name, id);
1299 EXEC SQL CLOSE csr216;
1304 EXEC SQL BEGIN DECLARE SECTION;
1306 EXEC SQL END DECLARE SECTION;
1308 EXEC SQL BEGIN DECLARE SECTION;
1310 EXEC SQL END DECLARE SECTION;
1313 EXEC SQL DECLARE csr217 CURSOR FOR
1314 SELECT name FROM servers
1315 WHERE acl_type='LIST' AND acl_id = :id;
1316 EXEC SQL OPEN csr217;
1318 EXEC SQL FETCH csr217 INTO :name;
1319 if (sqlca.sqlcode != 0) break;
1322 printf("Service %s has acl non-existant list %d\n", name, id);
1325 EXEC SQL CLOSE csr217;
1330 EXEC SQL BEGIN DECLARE SECTION;
1332 EXEC SQL END DECLARE SECTION;
1334 EXEC SQL BEGIN DECLARE SECTION;
1336 EXEC SQL END DECLARE SECTION;
1338 EXEC SQL UPDATE servers SET acl_id=0 WHERE acl_id = :id AND
1340 rowcount = sqlca.sqlerrd[2];
1342 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
1344 printf("Not fixed\n");
1345 modified("servers");
1349 EXEC SQL BEGIN DECLARE SECTION;
1351 EXEC SQL END DECLARE SECTION;
1353 EXEC SQL BEGIN DECLARE SECTION;
1355 EXEC SQL END DECLARE SECTION;
1357 EXEC SQL UPDATE servers SET acl_id=0 WHERE acl_id = :id AND
1359 rowcount = sqlca.sqlerrd[2];
1361 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
1363 printf("Not fixed\n");
1364 modified("servers");
1369 EXEC SQL BEGIN DECLARE SECTION;
1371 EXEC SQL END DECLARE SECTION;
1373 EXEC SQL BEGIN DECLARE SECTION;
1375 EXEC SQL END DECLARE SECTION;
1379 EXEC SQL DECLARE csr218 CURSOR FOR
1380 SELECT string_id FROM krbmap
1381 WHERE users_id = :id ;
1382 EXEC SQL OPEN csr218;
1384 EXEC SQL FETCH csr218 INTO :id1;
1385 if (sqlca.sqlcode != 0) break;
1387 if (s = ((struct string *)hash_lookup(strings, id1)))
1392 printf("Kerberos map for non-existant user %d to principal %s\n",
1395 EXEC SQL CLOSE csr218;
1401 EXEC SQL BEGIN DECLARE SECTION;
1403 EXEC SQL END DECLARE SECTION;
1405 EXEC SQL BEGIN DECLARE SECTION;
1407 EXEC SQL END DECLARE SECTION;
1411 EXEC SQL DECLARE csr219 CURSOR FOR
1412 SELECT users_id FROM krbmap
1413 WHERE string_id = :id;
1414 EXEC SQL OPEN csr219;
1416 EXEC SQL FETCH csr219 INTO :id1;
1417 if (sqlca.sqlcode != 0) break;
1419 if (u = ((struct user *)hash_lookup(users, id1)))
1424 printf("Kerberos map for user %s (%d) to non-existant string %d\n",
1427 EXEC SQL CLOSE csr219;
1433 EXEC SQL BEGIN DECLARE SECTION;
1435 EXEC SQL END DECLARE SECTION;
1437 EXEC SQL BEGIN DECLARE SECTION;
1439 EXEC SQL END DECLARE SECTION;
1442 EXEC SQL DECLARE csr220 CURSOR FOR
1443 SELECT name FROM palladium
1444 WHERE mach_id = :id;
1445 EXEC SQL OPEN csr220;
1447 EXEC SQL FETCH csr220 INTO :name;
1448 if (sqlca.sqlcode != 0) break;
1451 printf("Palladium server/supervisor %s is on non-existant machine %d\n",
1455 EXEC SQL CLOSE csr220;
1462 EXEC SQL BEGIN DECLARE SECTION;
1463 int id1, id2, id3, id4, id5;
1464 char type[9], name[33];
1465 EXEC SQL END DECLARE SECTION;
1466 struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5;
1472 printf("Phase 2 - Checking references\n");
1474 dprintf("Checking users...\n");
1475 hash_step(users, user_check, NULL);
1477 dprintf("Checking machines...\n");
1478 hash_step(machines, mach_check, NULL);
1480 dprintf("Checking subnets...\n");
1481 hash_step(subnets, subnet_check, NULL);
1483 dprintf("Checking clusters...\n");
1484 hash_step(clusters, cluster_check, NULL);
1486 dprintf("Checking mcmap...\n");
1489 EXEC SQL DECLARE csr221 CURSOR FOR
1490 SELECT mach_id, clu_id FROM mcmap;
1491 EXEC SQL OPEN csr221;
1493 EXEC SQL FETCH csr221 INTO :id1, :id2;
1494 if (sqlca.sqlcode != 0) break;
1496 if (!(m = (struct machine *)hash_lookup(machines, id1)))
1497 sq_save_unique_data(sq1, id1);
1498 else if (!hash_lookup(clusters, id2))
1499 sq_save_unique_data(sq2, id2);
1500 if (m) m->clucount++;
1502 EXEC SQL CLOSE csr221;
1503 generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1);
1504 generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1);
1506 dprintf("Checking service clusters...\n");
1508 EXEC SQL DECLARE csr222 CURSOR FOR
1509 SELECT clu_id FROM svc;
1510 EXEC SQL OPEN csr222;
1512 EXEC SQL FETCH csr222 INTO :id1;
1513 if (sqlca.sqlcode != 0) break;
1515 if (!hash_lookup(clusters, id1))
1516 sq_save_unique_data(sq1, id1);
1518 EXEC SQL CLOSE csr222;
1519 generic_delete(sq1, show_svc, "svc", "clu_id", 1);
1521 dprintf("Checking lists...\n");
1522 hash_step(lists, list_check, NULL);
1524 dprintf("Checking members...\n");
1531 EXEC SQL DECLARE csr223 CURSOR FOR
1532 SELECT list_id, member_type, member_id, ref_count, direct
1533 FROM imembers FOR UPDATE OF member_id;
1534 EXEC SQL OPEN csr223;
1536 EXEC SQL FETCH csr223 INTO :id1, :type, :id2, :id3, :id4;
1537 if (sqlca.sqlcode != 0) break;
1539 if ((l = (struct list *) hash_lookup(lists, id1)) == NULL)
1540 sq_save_unique_data(sq1, id1);
1541 else if (type[0] == 'U' && !hash_lookup(users, id2))
1542 sq_save_unique_data(sq2, id2);
1543 else if (type[0] == 'L' && !hash_lookup(lists, id2))
1544 sq_save_unique_data(sq3, id2);
1545 else if (type[0] == 'S' && !maybe_fixup_unref_string2("imembers","member_id","csr223",id2))
1546 sq_save_unique_data(sq4, id2);
1547 else if (type[0] == 'K' && !maybe_fixup_unref_string2("imembers","member_id","csr223",id2))
1548 sq_save_unique_data(sq5, id2);
1552 EXEC SQL CLOSE csr223;
1553 generic_delete(sq1, show_member_list, "imembers", "list_id", 1);
1554 generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1);
1555 generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1);
1556 generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1);
1557 generic_fix(sq5, show_mem_krb, "Delete", del_mem_krb, 1);
1559 dprintf("Checking servers...\n");
1562 EXEC SQL DECLARE csr224 CURSOR FOR
1563 SELECT name, acl_type, acl_id, modby FROM servers
1564 FOR UPDATE of modby;
1565 EXEC SQL OPEN csr224;
1567 EXEC SQL FETCH csr224 INTO :name, :type, :id1, :id2;
1568 if (sqlca.sqlcode != 0) break;
1570 maybe_fixup_modby2("servers","modby","csr224",id2);
1572 if (!strcmp(type, "USER") && !hash_lookup(users, id1)) {
1573 sq_save_data(sq1, id1);
1574 } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1)) {
1575 sq_save_data(sq2, id1);
1578 EXEC SQL CLOSE csr224;
1579 generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
1580 generic_fix(sq2, show_srv_list, "Fix", zero_srv_list, 1);
1582 dprintf("Checking serverhosts...\n");
1584 EXEC SQL DECLARE csr225 CURSOR FOR
1585 SELECT mach_id, modby FROM serverhosts
1586 FOR UPDATE OF modby;
1587 EXEC SQL OPEN csr225;
1589 EXEC SQL FETCH csr225 INTO :id1, :id2;
1590 if (sqlca.sqlcode != 0) break;
1592 maybe_fixup_modby2("serverhosts", "modby", "csr225", id2);
1593 if (!hash_lookup(machines, id1))
1594 sq_save_data(sq, id1);
1596 EXEC SQL CLOSE csr225;
1597 generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
1599 dprintf("Checking nfsphys...\n");
1600 hash_step(nfsphys, check_nfsphys, NULL);
1602 dprintf("Checking filesys...\n");
1603 hash_step(filesys, check_fs, NULL);
1605 dprintf("Checking filesystem groups...\n");
1609 EXEC SQL DECLARE csr226 CURSOR FOR
1610 SELECT group_id, filsys_id FROM fsgroup;
1611 EXEC SQL OPEN csr226;
1613 EXEC SQL FETCH csr226 INTO :id1, :id2;
1614 if (sqlca.sqlcode != 0) break;
1616 if (!(f = (struct filesys *) hash_lookup(filesys, id1)))
1617 sq_save_data(sq1, id1);
1618 if (!hash_lookup(filesys, id2))
1619 sq_save_data(sq3, id2);
1621 EXEC SQL CLOSE csr226;
1622 generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
1623 generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
1625 dprintf("Checking quotas...\n");
1630 EXEC SQL DECLARE csr227 CURSOR FOR
1631 SELECT entity_id, type, filsys_id, phys_id, quota, modby
1632 FROM quota FOR UPDATE OF modby;
1633 EXEC SQL OPEN csr227;
1635 EXEC SQL FETCH csr227 INTO :id1, :type, :id2, :id3, :id4, :id5;
1636 if (sqlca.sqlcode != 0) break;
1638 maybe_fixup_modby2("quota", "modby", "csr227", id5);
1639 if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
1640 sq_save_data(sq1, id1);
1641 else if (type[0] == 'G' && !hash_lookup(lists, id1))
1642 sq_save_data(sq4, id1);
1643 else if (!(f = (struct filesys *) hash_lookup(filesys, id2)))
1644 sq_save_data(sq2, id2);
1645 else if (id3 != f->phys_id ||
1646 ((n = (struct nfsphys*) hash_lookup(nfsphys, id3)) ==
1647 (struct nfsphys *)NULL))
1648 sq_save_data(sq3, id2);
1652 EXEC SQL CLOSE csr227;
1653 generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
1654 generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
1655 generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
1656 generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
1658 dprintf("Not checking zephyr.\n");
1660 dprintf("Checking hostaccess...\n");
1661 EXEC SQL DECLARE csr228 CURSOR FOR
1662 SELECT mach_id, acl_type, acl_id, modby FROM hostaccess
1663 FOR UPDATE OF modby;
1664 EXEC SQL OPEN csr228;
1666 EXEC SQL FETCH csr228 INTO :id1, :type, :id2, :id3;
1667 if (sqlca.sqlcode != 0) break;
1669 maybe_fixup_modby2("hostaccess", "modby", "csr228", id3);
1671 if (!hash_lookup(machines, id1)) {
1672 printf("Hostaccess for non-existant host %d\n", id1);
1673 printf("Not fixing this error\n");
1675 if (!strcmp(type, "USER") && !hash_lookup(users, id2)) {
1676 printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
1677 printf("Not fixing this error\n");
1678 } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) {
1679 printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
1680 printf("Not fixing this error\n");
1683 EXEC SQL CLOSE csr228;
1685 dprintf("Checking palladium...\n");
1687 EXEC SQL DECLARE csr229 CURSOR FOR
1688 SELECT mach_id, modby FROM palladium
1689 FOR UPDATE OF modby;
1690 EXEC SQL OPEN csr229;
1692 EXEC SQL FETCH csr229 INTO :id1, :id2;
1693 if (sqlca.sqlcode != 0) break;
1695 maybe_fixup_modby2("palladium", "modby", "csr229", id2);
1696 if (!hash_lookup(machines, id1)) {
1697 sq_save_unique_data(sq1, id1);
1700 EXEC SQL CLOSE csr229;
1701 generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
1703 dprintf("Checking krbmap...\n");
1706 EXEC SQL DECLARE csr230 CURSOR FOR
1707 SELECT users_id, string_id FROM krbmap
1708 FOR UPDATE OF string_id;
1709 EXEC SQL OPEN csr230;
1711 EXEC SQL FETCH csr230 INTO :id1, :id2;
1712 if (sqlca.sqlcode != 0) break;
1714 if (!hash_lookup(users, id1))
1715 sq_save_unique_data(sq1, id1);
1716 else if (!maybe_fixup_unref_string2("krbmap","string_id","csr230",id2))
1717 sq_save_unique_data(sq2, id2);
1719 EXEC SQL CLOSE csr230;
1720 generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
1721 generic_delete(sq2, show_krb_str, "krbmap", "string_id", 1);
1723 dprintf("Checking capacls...\n");
1724 EXEC SQL DECLARE csr231 CURSOR FOR
1725 SELECT list_id, tag FROM capacls;
1726 EXEC SQL OPEN csr231;
1728 EXEC SQL FETCH csr231 INTO :id1, :name;
1729 if (sqlca.sqlcode != 0) break;
1731 if (!hash_lookup(lists, id1)) {
1732 printf("Capacl for %s is non-existant list %d\n", name, id1);
1733 printf("Not fixing this error\n");
1736 EXEC SQL CLOSE csr231;
1738 dprintf("Checking hostaliases\n");
1740 EXEC SQL DECLARE csr232 CURSOR FOR
1741 SELECT mach_id FROM hostalias;
1742 EXEC SQL OPEN csr232;
1744 EXEC SQL FETCH csr232 INTO :id1;
1745 if (sqlca.sqlcode != 0) break;
1747 if (!hash_lookup(machines, id1))
1748 sq_save_unique_data(sq1, id1);
1750 EXEC SQL CLOSE csr232;
1751 generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
1753 dprintf("Checking printcaps\n");
1756 EXEC SQL DECLARE csr233 CURSOR FOR
1757 SELECT mach_id, quotaserver, modby FROM printcap;
1758 EXEC SQL OPEN csr233;
1760 EXEC SQL FETCH csr233 INTO :id1, :id2, :id3;
1761 if (sqlca.sqlcode != 0) break;
1763 maybe_fixup_modby2("printcap", "modby", "csr233", id3);
1764 if (!hash_lookup(machines, id1))
1765 sq_save_unique_data(sq1, id1);
1766 else if(!hash_lookup(machines, id2))
1767 sq_save_unique_data(sq2, id2);
1769 EXEC SQL CLOSE csr233;
1770 generic_delete(sq1, show_pcap_mach, "printcap", "mach_id", 1);
1771 generic_delete(sq2, show_pcap_quota, "printcap", "quotaserver", 1);