3 * (c) Copyright 1988-1998 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
8 #include <mit-copyright.h>
16 EXEC SQL INCLUDE sqlca;
20 EXEC SQL WHENEVER SQLERROR DO dbmserr();
22 int show_mcm_mach(void *id);
23 int show_mcm_clu(void *id);
24 int show_hostalias(void *id);
25 int show_pcap_mach(void *id);
26 int show_pcap_quota(void *id);
27 void user_check(int id, void *user, void *hint);
28 int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
29 char *field, char *idfield);
30 int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
31 char *field, char *idfield);
32 int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid);
33 int maybe_fixup_modby2(char *table, char *field, char *cursor, int id);
34 void pobox_check(int id, struct user *u);
35 void remove_pobox(int id);
36 void fix_smtp_pobox(int id, int sid);
37 void mach_check(int id, void *machine, void *hint);
38 void subnet_check(int id, void *subnet, void *hint);
39 void clear_subnet_owner(struct subnet *s);
40 void clear_mach_owner(struct machine *m);
41 void cluster_check(int id, void *cluster, void *hint);
42 int show_svc(void *id);
43 void list_check(int id, void *list, void *hint);
44 void fix_list_acl(int id);
45 int show_member_list(void *id);
46 int show_mem_user(void *id);
47 int show_mem_list(void *id);
48 int show_mem_str(void *id);
49 int show_mem_krb(void *id);
50 void del_mem_user(void *id);
51 void del_mem_list(void *id);
52 void del_mem_str(void *id);
53 void del_mem_krb(void *id);
54 int show_sh(void *id);
55 void del_sh_mach(void *id);
56 void fsmatch(int id, void *nfsphys, void *filesys);
57 void check_fs(int id, void *filesys, void *hint);
58 void check_nfsphys(int id, void *nfsphys, void *hint);
59 int show_fsg_missing(void *id);
60 int show_fsg_type(void *filesys);
61 void fix_fsg_type(void *filesys);
62 int show_fsg_nomember(void *id);
63 int show_quota_nouser(void *id);
64 int show_quota_nolist(void *id);
65 void fix_quota_nouser(void *id);
66 void fix_quota_nolist(void *id);
67 int show_quota_nofs(void *id);
68 void fix_quota_nofs(void *id);
69 int show_quota_wrongpid(void *id);
70 void fix_quota_physid(void *id);
71 int show_srv_user(void *id);
72 int show_srv_list(void *id);
73 void zero_srv_user(void *id);
74 void zero_srv_list(void *id);
75 int show_krb_usr(void *id);
76 int show_krb_str(void *id);
77 int show_pdm_mach(void *id);
79 int show_mcm_mach(void *id)
81 EXEC SQL BEGIN DECLARE SECTION;
82 int iid = (int)id, found = 1;
84 EXEC SQL END DECLARE SECTION;
86 EXEC SQL DECLARE csr201 CURSOR FOR
87 SELECT clusters.name FROM clusters, mcmap
88 WHERE clusters.clu_id = mcmap.clu_id AND mcmap.mach_id = :iid;
92 EXEC SQL FETCH csr201 INTO :name;
98 printf("Cluster %s, non-existant machine %d in cluster map\n",
101 EXEC SQL CLOSE csr201;
105 int show_mcm_clu(void *id)
107 EXEC SQL BEGIN DECLARE SECTION;
108 int iid = (int)id, found = 1;
110 EXEC SQL END DECLARE SECTION;
112 EXEC SQL DECLARE csr202 CURSOR FOR
113 SELECT machine.name FROM machine, mcmap
114 WHERE machine.mach_id = mcmap.mach_id AND mcmap.clu_id = :iid;
115 EXEC SQL OPEN csr202;
118 EXEC SQL FETCH csr202 INTO :name;
125 printf("Machine %s, non-existant cluster %d in cluster map\n",
128 EXEC SQL CLOSE csr202;
132 int show_hostalias(void *id)
134 EXEC SQL BEGIN DECLARE SECTION;
135 int iid = (int)id, found = 1;
137 EXEC SQL END DECLARE SECTION;
139 EXEC SQL DECLARE csr234 CURSOR FOR
140 SELECT name FROM hostalias WHERE mach_id = :iid;
141 EXEC SQL OPEN csr234;
144 EXEC SQL FETCH csr234 INTO :name;
151 printf("Alias %s, non-existant machine %d in hostalias map\n",
154 EXEC SQL CLOSE csr234;
158 int show_pcap_mach(void *id)
160 EXEC SQL BEGIN DECLARE SECTION;
161 int iid = (int)id, found = 1;
163 EXEC SQL END DECLARE SECTION;
165 EXEC SQL DECLARE csr235 CURSOR FOR
166 SELECT name FROM printcap WHERE mach_id = :iid;
167 EXEC SQL OPEN csr235;
170 EXEC SQL FETCH csr235 INTO :name;
177 printf("Printer %s, non-existant spool machine %d in printcap table\n",
180 EXEC SQL CLOSE csr235;
184 int show_pcap_quota(void *id)
186 EXEC SQL BEGIN DECLARE SECTION;
187 int iid = (int)id, found = 1;
189 EXEC SQL END DECLARE SECTION;
191 EXEC SQL DECLARE csr236 CURSOR FOR
192 SELECT name FROM printcap WHERE quotaserver = :iid;
193 EXEC SQL OPEN csr236;
196 EXEC SQL FETCH csr236 INTO :name;
203 printf("Printer %s, non-existant quota server %d in printcap table\n",
206 EXEC SQL CLOSE csr236;
210 void user_check(int id, void *user, void *hint)
212 struct user *u = user;
214 u->comment = maybe_fixup_unref_string(u->comment, id, u->login, "users",
215 "comments", "users_id");
217 u->modby = maybe_fixup_modby(u->modby, id, u->login, "users",
218 "modby", "users_id");
220 u->fmodby = maybe_fixup_modby(u->fmodby, id, u->login, "users",
221 "fmodby", "users_id");
223 u->pmodby = maybe_fixup_modby(u->pmodby, id, u->login, "users",
224 "pmodby", "users_id");
226 u->sigwho = maybe_fixup_unref_string(u->sigwho, id, u->login, "users",
227 "sigwho", "users_id");
232 int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
233 char *field, char *idfield)
235 int ret = (sid < 0) ? -sid : sid, doit = 0, newid;
236 EXEC SQL BEGIN DECLARE SECTION;
239 EXEC SQL END DECLARE SECTION;
241 if ((newid = (int)hash_lookup(string_dups, ret)))
243 printf("%s entry %s(%d) has a %s with duplicate string %d\n",
244 table, oname, oid, field, ret);
245 if (single_fix("Replace duplicate", 0))
252 else if (!string_check(ret))
254 printf("%s entry %s(%d) has a %s with non-existant string %d\n",
255 table, oname, oid, field, ret);
256 if (single_fix("Delete", 1))
265 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE %s = %d",
266 table, field, (sid < 0) ? -ret : ret, idfield, oid);
267 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
268 rowcount = sqlca.sqlerrd[2];
272 printf("Not fixed, rowcount = %d\n", rowcount);
276 return (sid < 0) ? -ret : ret;
279 int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
280 char *field, char *idfield)
282 EXEC SQL BEGIN DECLARE SECTION;
285 EXEC SQL END DECLARE SECTION;
288 return maybe_fixup_unref_string(sid, oid, oname, table, field, idfield);
291 if (!hash_lookup(users, sid))
293 printf("%s entry %s(%d) has a %s with non-existant user %d\n",
294 table, oname, oid, field, sid);
295 if (single_fix("Delete", 1))
297 sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE %s = %d",
298 table, field, idfield, oid);
299 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
300 rowcount = sqlca.sqlerrd[2];
304 printf("Not fixed, rowcount = %d\n", rowcount);
313 int maybe_fixup_unref_string2(char *table, char *field, char *cursor, int sid)
315 int ret = (sid < 0) ? -sid : sid, doit = 0, newid;
316 EXEC SQL BEGIN DECLARE SECTION;
319 EXEC SQL END DECLARE SECTION;
321 if ((newid = (int)hash_lookup(string_dups, ret)))
323 printf("%s entry has a %s with duplicate string %d\n",
325 if (single_fix("Replace duplicate", 0))
332 else if (!string_check(ret))
334 printf("%s entry has a %s with non-existant string %d\n",
336 if (single_fix("Delete", 1))
345 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE CURRENT OF %s",
346 table, field, (sid < 0) ? -ret : ret, cursor);
347 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
348 rowcount = sqlca.sqlerrd[2];
352 printf("Not fixed, rowcount = %d\n", rowcount);
355 return (sid < 0) ? -ret : ret;
358 int maybe_fixup_modby2(char *table, char *field, char *cursor, int id)
360 EXEC SQL BEGIN DECLARE SECTION;
363 EXEC SQL END DECLARE SECTION;
366 return maybe_fixup_unref_string2(table, field, cursor, id);
369 if (!hash_lookup(users, id))
371 printf("%s entry has a %s with non-existant user %d\n",
373 if (single_fix("Delete", 1))
375 sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE CURRENT OF %s",
376 table, field, cursor);
377 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
378 rowcount = sqlca.sqlerrd[2];
382 printf("Not fixed, rowcount = %d\n", rowcount);
391 void pobox_check(int id, struct user *u)
396 if (!hash_lookup(machines, u->pobox_id))
398 printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
399 u->login, u->fullname, u->pobox_id);
400 if (single_fix("Delete", 0))
402 remove_pobox(u->users_id);
408 if (hash_lookup(string_dups, u->pobox_id))
410 printf("User %s(%s) has P.O.Box with duplicate string %d\n",
411 u->login, u->fullname, u->pobox_id);
412 if (single_fix("Update", 0))
414 printf("Replacing box_id dup string ID %d with %d\n",
416 (int)hash_lookup(string_dups, u->pobox_id));
417 u->pobox_id = (int)hash_lookup(string_dups, u->pobox_id);
418 fix_smtp_pobox(u->users_id, u->pobox_id);
419 string_check(u->pobox_id);
422 else if (!string_check(u->pobox_id))
424 printf("User %s(%s) has P.O.Box with non-existant string %d\n",
425 u->login, u->fullname, u->pobox_id);
426 if (single_fix("Delete", 0))
428 remove_pobox(u->users_id);
439 void remove_pobox(int id)
441 EXEC SQL BEGIN DECLARE SECTION;
442 int rowcount, iid = (int)id;
443 EXEC SQL END DECLARE SECTION;
445 EXEC SQL UPDATE users SET potype = 'NONE' WHERE users.users_id = :iid;
446 rowcount = sqlca.sqlerrd[2];
448 printf("%d entr%s removed\n", rowcount, rowcount == 1 ? "y" : "ies");
450 printf("Not removed\n");
454 void fix_smtp_pobox(int id, int sid)
456 EXEC SQL BEGIN DECLARE SECTION;
457 int rowcount, iid = id, isid = sid;
458 EXEC SQL END DECLARE SECTION;
460 EXEC SQL UPDATE users SET box_id = :isid WHERE users.users_id = :iid;
461 rowcount = sqlca.sqlerrd[2];
463 printf("%d entr%s updated\n", rowcount, rowcount == 1 ? "y" : "ies");
465 printf("Not updated\n");
469 void mach_check(int id, void *machine, void *hint)
471 struct machine *m = machine;
473 if (!hash_lookup(subnets, m->snet_id))
475 printf("Machine %s is on a non-existant subnet %d\n",
476 m->name, m->snet_id);
477 if (single_fix("Move to null-subnet", 1))
479 EXEC SQL BEGIN DECLARE SECTION;
480 int rowcount, iid = id;
481 EXEC SQL END DECLARE SECTION;
483 EXEC SQL UPDATE machine SET snet_id = 0 WHERE mach_id = :iid;
484 rowcount = sqlca.sqlerrd[2];
486 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
488 printf("Not fixed\n");
493 switch (m->owner_type)
496 if (!hash_lookup(users, m->owner_id))
498 printf("Machine %s has non-existant USER owner %d\n",
499 m->name, m->owner_id);
500 if (single_fix("Set to no owner", 1))
505 if (!hash_lookup(lists, m->owner_id))
507 printf("Machine %s has non-existant LIST owner %d\n",
508 m->name, m->owner_id);
509 if (single_fix("Set to no owner", 1))
516 m->owner_id = maybe_fixup_unref_string(m->owner_id, id, m->name,
517 "machine", "owner_id",
519 if (m->owner_id == 0)
524 m->acomment = maybe_fixup_unref_string(m->acomment, id, m->name,
525 "machine", "acomment", "mach_id");
527 m->ocomment = maybe_fixup_unref_string(m->ocomment, id, m->name,
528 "machine", "ocomment", "mach_id");
530 m->creator = maybe_fixup_modby(m->creator, id, m->name, "machine",
531 "creator", "mach_id");
532 m->modby = maybe_fixup_modby(m->modby, id, m->name, "machine",
536 void subnet_check(int id, void *subnet, void *hint)
538 struct subnet *s = subnet;
540 switch (s->owner_type)
543 if (!hash_lookup(users, s->owner_id))
545 printf("Subnet %s has non-existant USER owner %d\n",
546 s->name, s->owner_id);
547 if (single_fix("Set to no owner", 1))
548 clear_subnet_owner(s);
552 if (!hash_lookup(lists, s->owner_id))
554 printf("Machine %s has non-existant LIST owner %d\n",
555 s->name, s->owner_id);
556 if (single_fix("Set to no owner", 1))
557 clear_subnet_owner(s);
563 s->owner_id = maybe_fixup_unref_string(s->owner_id, id, s->name,
564 "machine", "owner_id",
566 if (s->owner_id == 0)
567 clear_subnet_owner(s);
570 s->modby = maybe_fixup_modby(s->modby, id, s->name, "subnet",
574 void clear_subnet_owner(struct subnet *s)
576 EXEC SQL BEGIN DECLARE SECTION;
577 int rowcount, id = s->snet_id;
578 EXEC SQL END DECLARE SECTION;
580 EXEC SQL UPDATE subnet SET owner_type = 'NONE', owner_id = 0
582 rowcount = sqlca.sqlerrd[2];
584 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
586 printf("Not fixed\n");
590 void clear_mach_owner(struct machine *m)
592 EXEC SQL BEGIN DECLARE SECTION;
593 int rowcount, id = m->mach_id;
594 EXEC SQL END DECLARE SECTION;
596 EXEC SQL UPDATE machine SET owner_type = 'NONE', owner_id = 0
598 rowcount = sqlca.sqlerrd[2];
600 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
602 printf("Not fixed\n");
606 void cluster_check(int id, void *cluster, void *hint)
608 struct cluster *c = cluster;
610 c->modby = maybe_fixup_modby(c->modby, id, c->name, "clusters",
614 int show_svc(void *id)
616 EXEC SQL BEGIN DECLARE SECTION;
617 int iid = (int)id, found = 1;
618 char label[17], data[33];
619 EXEC SQL END DECLARE SECTION;
621 EXEC SQL DECLARE csr203 CURSOR FOR
622 SELECT serv_label, serv_cluster FROM svc
624 EXEC SQL OPEN csr203;
627 EXEC SQL FETCH csr203 INTO :label, :data;
634 printf("Cluster data [%s] %s for non-existant cluster %d\n",
637 EXEC SQL CLOSE csr203;
641 void list_check(int id, void *list, void *hint)
643 struct list *l = list;
648 if (!hash_lookup(lists, l->acl_id))
650 printf("List %s has bad LIST acl %d\n", l->name, l->acl_id);
651 if (single_fix("Patch", 1))
652 fix_list_acl(l->list_id);
656 if (!hash_lookup(users, l->acl_id))
658 printf("List %s has bad USER acl %d\n", l->name, l->acl_id);
659 if (single_fix("Patch", 1))
660 fix_list_acl(l->list_id);
664 l->acl_id = maybe_fixup_unref_string(l->acl_id, id, l->name,
665 "list", "acl_id", "list_id");
668 printf("List %s has bad KERBEROS acl %d\n", l->name, l->acl_id);
669 if (single_fix("Patch", 1))
670 fix_list_acl(l->list_id);
676 void fix_list_acl(int id)
678 EXEC SQL BEGIN DECLARE SECTION;
679 int rowcount, iid = (int)id;
680 EXEC SQL END DECLARE SECTION;
682 EXEC SQL UPDATE list SET acl_id = :iid, acl_type = 'LIST'
683 WHERE list_id = :iid;
684 rowcount = sqlca.sqlerrd[2];
686 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
688 printf("Not fixed\n");
692 int show_member_list(void *id)
694 EXEC SQL BEGIN DECLARE SECTION;
695 int mid, iid = (int)id, found = 1;
696 char mtype[9], *name = "";
697 EXEC SQL END DECLARE SECTION;
699 EXEC SQL DECLARE csr204 CURSOR FOR
700 SELECT member_type, member_id FROM imembers
701 WHERE list_id = :iid AND direct = 1;
702 EXEC SQL OPEN csr204;
705 EXEC SQL FETCH csr204 INTO :mtype, :mid;
712 name = ((struct list *) hash_lookup(lists, mid))->name;
713 else if (mtype[0] == 'U')
714 name = ((struct user *) hash_lookup(users, mid))->login;
715 else if (mtype[0] == 'S' || mtype[0] == 'K')
716 name = ((struct string *) hash_lookup(strings, mid))->name;
717 printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
719 EXEC SQL CLOSE csr204;
723 int show_mem_user(void *id)
725 EXEC SQL BEGIN DECLARE SECTION;
726 int lid, iid = (int)id, found = 1;
727 EXEC SQL END DECLARE SECTION;
729 EXEC SQL DECLARE csr205 CURSOR FOR
730 SELECT list_id FROM imembers
731 WHERE member_id = :iid AND member_type = 'USER' AND direct = 1;
732 EXEC SQL OPEN csr205;
735 EXEC SQL FETCH csr205 INTO :lid;
740 printf("List %s has non-existant user member, id %d\n",
741 ((struct list *)hash_lookup(lists, lid))->name, iid);
743 EXEC SQL CLOSE csr205;
747 int show_mem_list(void *id)
749 EXEC SQL BEGIN DECLARE SECTION;
750 int lid, iid = (int)id, found = 1;
751 EXEC SQL END DECLARE SECTION;
753 EXEC SQL DECLARE csr206 CURSOR FOR
754 SELECT list_id FROM imembers
755 WHERE member_id = :iid AND member_type = 'LIST' AND direct = 1;
756 EXEC SQL OPEN csr206;
759 EXEC SQL FETCH csr206 INTO :lid;
764 printf("List %s has non-existant list member, id %d\n",
765 ((struct list *)hash_lookup(lists, lid))->name, iid);
767 EXEC SQL CLOSE csr206;
771 int show_mem_str(void *id)
773 EXEC SQL BEGIN DECLARE SECTION;
774 int lid, iid = (int)id, found = 1;
775 EXEC SQL END DECLARE SECTION;
777 EXEC SQL DECLARE csr207 CURSOR FOR
778 SELECT list_id FROM imembers
779 WHERE member_id = :iid AND member_type = 'STRING' AND direct = 1;
780 EXEC SQL OPEN csr207;
783 EXEC SQL FETCH csr207 INTO :lid;
788 printf("List %s has non-existant string member, id %d\n",
789 ((struct list *)hash_lookup(lists, lid))->name, iid);
791 EXEC SQL CLOSE csr207;
796 int show_mem_krb(void *id)
798 EXEC SQL BEGIN DECLARE SECTION;
799 int lid, iid = (int)id, found = 1;
800 EXEC SQL END DECLARE SECTION;
802 EXEC SQL DECLARE csr208 CURSOR FOR
803 SELECT list_id FROM imembers
804 WHERE member_id = :iid AND member_type = 'KERBEROS' AND direct = 1;
805 EXEC SQL OPEN csr208;
808 EXEC SQL FETCH csr208 INTO :lid;
813 printf("List %s has non-existant kerberos member, id %d\n",
814 ((struct list *)hash_lookup(lists, lid))->name, iid);
816 EXEC SQL CLOSE csr208;
821 void del_mem_user(void *id)
823 EXEC SQL BEGIN DECLARE SECTION;
824 int iid = (int)id, rowcount;
825 EXEC SQL END DECLARE SECTION;
827 EXEC SQL DELETE FROM imembers WHERE member_type = 'USER' AND
828 member_id = :iid AND direct = 1;
829 rowcount = sqlca.sqlerrd[2];
831 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
833 printf("Not deleted\n");
834 modified("imembers");
837 void del_mem_list(void *id)
839 EXEC SQL BEGIN DECLARE SECTION;
840 int iid = (int)id, rowcount;
841 EXEC SQL END DECLARE SECTION;
843 EXEC SQL DELETE FROM imembers WHERE member_type = 'LIST' AND
844 member_id = :iid AND direct = 1;
845 rowcount = sqlca.sqlerrd[2];
847 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
849 printf("Not deleted\n");
850 modified("imembers");
853 void del_mem_str(void *id)
855 EXEC SQL BEGIN DECLARE SECTION;
856 int iid = (int)id, rowcount;
857 EXEC SQL END DECLARE SECTION;
859 EXEC SQL DELETE FROM imembers WHERE member_type = 'STRING' AND
860 member_id = :iid AND direct = 1;
861 rowcount = sqlca.sqlerrd[2];
863 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
865 printf("Not deleted\n");
866 modified("imembers");
870 void del_mem_krb(void *id)
872 EXEC SQL BEGIN DECLARE SECTION;
873 int iid = (int)id, rowcount;
874 EXEC SQL END DECLARE SECTION;
876 EXEC SQL DELETE FROM imembers WHERE member_type = 'KERBEROS' AND
877 member_id = :iid AND direct = 1;
878 rowcount = sqlca.sqlerrd[2];
880 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
882 printf("Not deleted\n");
883 modified("imembers");
887 int show_sh(void *id)
889 EXEC SQL BEGIN DECLARE SECTION;
892 EXEC SQL END DECLARE SECTION;
895 EXEC SQL DECLARE csr209 CURSOR FOR
896 SELECT service FROM serverhosts
897 WHERE mach_id = :iid;
898 EXEC SQL OPEN csr209;
901 EXEC SQL FETCH csr209 INTO :name;
906 printf("ServerHost entry for service %s non-existant host %d\n",
909 EXEC SQL CLOSE csr209;
913 void del_sh_mach(void *id)
915 EXEC SQL BEGIN DECLARE SECTION;
916 int iid = (int)id, rowcount;
917 EXEC SQL END DECLARE SECTION;
919 EXEC SQL DELETE FROM serverhosts WHERE mach_id = :iid;
920 rowcount = sqlca.sqlerrd[2];
922 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
924 printf("Not deleted\n");
925 modified("serverhosts");
929 static int fnchecklen;
931 void fsmatch(int id, void *nfsphys, void *filesys)
933 struct nfsphys *n = nfsphys;
934 struct filesys *f = filesys;
936 if (n->mach_id == f->mach_id &&
937 !strncmp(f->dir, n->dir, strlen(n->dir)) &&
938 strlen(n->dir) > fnchecklen)
941 fnchecklen = strlen(n->dir);
946 void check_fs(int id, void *filesys, void *hint)
948 EXEC SQL BEGIN DECLARE SECTION;
949 int iid = id, id1, id2, id3, rowcount;
951 EXEC SQL END DECLARE SECTION;
952 struct filesys *f = filesys;
956 if (!hash_lookup(machines, f->mach_id))
958 printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
959 if (single_fix("Fix", 0))
961 EXEC SQL UPDATE filesys SET mach_id = 0 WHERE filsys_id = :iid;
962 rowcount = sqlca.sqlerrd[2];
964 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
966 printf("Not fixed\n");
972 if (!hash_lookup(users, f->owner))
974 printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
975 if (single_fix("Fix", 1))
977 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
981 if (!hash_lookup(lists, f->owners))
983 printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
984 if (single_fix("Fix", 1))
986 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
993 if (!hash_lookup(nfsphys, f->phys_id))
995 m = hash_lookup(machines, f->mach_id);
996 printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
997 if (single_fix("Fix", 1))
1000 hash_step(nfsphys, fsmatch, f);
1001 if (fnchecklen != 0)
1006 EXEC SQL UPDATE filesys SET phys_id = :id1
1007 WHERE filsys_id = :id2;
1008 rowcount = sqlca.sqlerrd[2];
1010 printf("%d entr%s fixed\n", rowcount,
1011 rowcount == 1 ? "y" : "ies");
1013 printf("Not fixed\n");
1014 modified("filesys");
1018 printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
1019 if (single_fix("Create", 0))
1025 if (set_next_object_id("nfsphys_id", "nfsphys") !=
1028 printf("Unable to assign unique ID\n");
1031 EXEC SQL SELECT COUNT(*) INTO :rowcount FROM numvalues
1032 WHERE name = 'nfsphys_id';
1035 printf("Unable to retrieve unique ID\n");
1038 EXEC SQL INSERT INTO nfsphys
1039 (nfsphys_id, mach_id, device, dir, status, allocated,
1040 size, modtime, modby, modwith) VALUES
1041 (:id1, :id3, '\?\?\?', :dir, 0, 0, 0, SYSDATE, 0,
1043 rowcount = sqlca.sqlerrd[2];
1046 printf("%d entr%s created\n", rowcount,
1047 rowcount == 1 ? "y" : "ies");
1050 printf("Not created\n");
1051 modified("nfsphys");
1052 n = malloc(sizeof(struct nfsphys));
1054 out_of_mem("storing new nfsphys");
1055 strcpy(n->dir, dir);
1057 n->nfsphys_id = id1;
1060 if (hash_store(nfsphys, id1, n) == -1)
1061 out_of_mem("storing nfsphys in hash table");
1062 EXEC SQL UPDATE filesys SET phys_id = :id1
1063 WHERE filsys_id = :id2;
1064 rowcount = sqlca.sqlerrd[2];
1067 printf("%d filesys entr%s fixed\n", rowcount,
1068 rowcount == 1 ? "y" : "ies");
1071 printf("Not fixed\n");
1072 modified("filesys");
1080 void check_nfsphys(int id, void *nfsphys, void *hint)
1082 struct nfsphys *n = nfsphys;
1084 if (!hash_lookup(machines, n->mach_id))
1086 printf("NFSphys %d(%s) on non-existant machine %d\n",
1087 id, n->dir, n->mach_id);
1088 if (single_fix("Delete", 0))
1089 single_delete("nfsphys", "nfsphys_id", id);
1093 int show_fsg_missing(void *id)
1095 EXEC SQL BEGIN DECLARE SECTION;
1096 int iid = (int)id, id1, found = 1;
1097 EXEC SQL END DECLARE SECTION;
1100 EXEC SQL DECLARE csr210 CURSOR FOR
1101 SELECT filsys_id FROM fsgroup
1102 WHERE group_id = :iid;
1103 EXEC SQL OPEN csr210;
1106 EXEC SQL FETCH csr210 INTO :id1;
1111 if ((f = hash_lookup(filesys, id1)))
1112 printf("Missing fsgroup %d has member filesystem %s\n", iid, f->name);
1114 printf("Missing fsgroup %d has member filesystem %d\n", iid, id1);
1116 EXEC SQL CLOSE csr210;
1120 int show_fsg_type(void *filesys)
1122 struct filesys *f = filesys;
1148 printf("FSGroup %s has type %s instead of FSGROUP\n", f->name, t);
1152 void fix_fsg_type(void *filesys)
1154 struct filesys *f = filesys;
1155 EXEC SQL BEGIN DECLARE SECTION;
1156 int rowcount, id = f->filsys_id;
1157 EXEC SQL END DECLARE SECTION;
1159 EXEC SQL UPDATE filesys SET type = 'FSGROUP' WHERE filsys_id = :id;
1160 rowcount = sqlca.sqlerrd[2];
1162 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1164 printf("Not fixed\n");
1165 modified("filesys");
1168 int show_fsg_nomember(void *id)
1170 EXEC SQL BEGIN DECLARE SECTION;
1171 int iid = (int)id, id1, found = 1;
1172 EXEC SQL END DECLARE SECTION;
1175 EXEC SQL DECLARE csr211 CURSOR FOR
1176 SELECT group_id FROM fsgroup
1177 WHERE filsys_id = :iid;
1178 EXEC SQL OPEN csr211;
1181 EXEC SQL FETCH csr211 INTO :id1;
1186 if ((f = hash_lookup(filesys, id1)))
1187 printf("FSGroup %s has missing member %d\n", f->name, iid);
1189 printf("FSGroup %d has missing member %d\n", id1, iid);
1191 EXEC SQL CLOSE csr211;
1195 int show_quota_nouser(void *id)
1197 EXEC SQL BEGIN DECLARE SECTION;
1198 int iid = (int)id, id1, found = 1;
1199 EXEC SQL END DECLARE SECTION;
1201 EXEC SQL DECLARE csr212 CURSOR FOR
1202 SELECT filsys_id FROM quota
1203 WHERE entity_id = :iid AND type = 'USER';
1204 EXEC SQL OPEN csr212;
1207 EXEC SQL FETCH csr212 INTO :id1;
1212 printf("Quota on fs %d for non-existant user %d\n", id1, iid);
1214 EXEC SQL CLOSE csr212;
1218 int show_quota_nolist(void *id)
1220 EXEC SQL BEGIN DECLARE SECTION;
1221 int iid = (int)id, id1, found = 1;
1222 EXEC SQL END DECLARE SECTION;
1224 EXEC SQL DECLARE csr213 CURSOR FOR
1225 SELECT filsys_id FROM quota
1226 WHERE entity_id = :iid AND type = 'GROUP';
1227 EXEC SQL OPEN csr213;
1230 EXEC SQL FETCH csr213 INTO :id1;
1235 printf("Quota on fs %d for non-existant list %d\n", id1, iid);
1237 EXEC SQL CLOSE csr213;
1241 void fix_quota_nouser(void *id)
1243 EXEC SQL BEGIN DECLARE SECTION;
1244 int iid = (int)id, rowcount, id1;
1245 EXEC SQL END DECLARE SECTION;
1247 id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
1248 EXEC SQL DELETE FROM quota
1249 WHERE entity_id = :iid AND type = 'USER';
1250 rowcount = sqlca.sqlerrd[2];
1252 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1254 printf("Not deleted\n");
1258 void fix_quota_nolist(void *id)
1260 EXEC SQL BEGIN DECLARE SECTION;
1261 int iid = (int)id, rowcount, id1;
1262 EXEC SQL END DECLARE SECTION;
1264 id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
1265 EXEC SQL DELETE FROM quota WHERE entity_id = :iid AND type = 'GROUP';
1266 rowcount = sqlca.sqlerrd[2];
1268 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1270 printf("Not deleted\n");
1274 int show_quota_nofs(void *id)
1276 EXEC SQL BEGIN DECLARE SECTION;
1277 int iid = (int)id, id1, found = 1;
1279 EXEC SQL END DECLARE SECTION;
1281 EXEC SQL DECLARE csr214 CURSOR FOR
1282 SELECT entity_id, type FROM quota
1283 WHERE filsys_id = :iid;
1284 EXEC SQL OPEN csr214;
1287 EXEC SQL FETCH csr214 INTO :id1, :type;
1292 printf("Quota for %s %d on non-existant filesys %d\n", type, id1, iid);
1294 EXEC SQL CLOSE csr214;
1298 void fix_quota_nofs(void *id)
1300 single_delete("quota", "filsys_id", (int)id);
1303 int show_quota_wrongpid(void *id)
1305 EXEC SQL BEGIN DECLARE SECTION;
1306 int iid = (int)id, id1, found = 1;
1308 EXEC SQL END DECLARE SECTION;
1311 f = hash_lookup(filesys, iid);
1312 EXEC SQL DECLARE csr215 CURSOR FOR
1313 SELECT entity_id, type FROM quota
1314 WHERE filsys_id = :iid;
1315 EXEC SQL OPEN csr215;
1318 EXEC SQL FETCH csr215 INTO :id1, :type;
1323 printf("Quota for %s %d on filesys %s has wrong phys_id %d\n",
1324 type, id1, f->name, iid);
1326 EXEC SQL CLOSE csr215;
1330 void fix_quota_physid(void *id)
1332 EXEC SQL BEGIN DECLARE SECTION;
1333 int iid = (int)id, rowcount, id1;
1334 EXEC SQL END DECLARE SECTION;
1336 id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
1337 EXEC SQL UPDATE quota SET phys_id = :id1
1338 WHERE filsys_id = :iid AND phys_id != :id1;
1339 rowcount = sqlca.sqlerrd[2];
1341 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1343 printf("Not fixed\n");
1347 int show_srv_user(void *id)
1349 EXEC SQL BEGIN DECLARE SECTION;
1352 EXEC SQL END DECLARE SECTION;
1355 EXEC SQL DECLARE csr216 CURSOR FOR
1356 SELECT name FROM servers
1357 WHERE acl_type = 'USER' and acl_id = :iid;
1358 EXEC SQL OPEN csr216;
1361 EXEC SQL FETCH csr216 INTO :name;
1366 printf("Service %s has acl non-existant user %d\n", name, iid);
1369 EXEC SQL CLOSE csr216;
1373 int show_srv_list(void *id)
1375 EXEC SQL BEGIN DECLARE SECTION;
1378 EXEC SQL END DECLARE SECTION;
1381 EXEC SQL DECLARE csr217 CURSOR FOR
1382 SELECT name FROM servers
1383 WHERE acl_type = 'LIST' AND acl_id = :iid;
1384 EXEC SQL OPEN csr217;
1387 EXEC SQL FETCH csr217 INTO :name;
1392 printf("Service %s has acl non-existant list %d\n", name, iid);
1395 EXEC SQL CLOSE csr217;
1399 void zero_srv_user(void *id)
1401 EXEC SQL BEGIN DECLARE SECTION;
1402 int iid = (int)id, rowcount;
1403 EXEC SQL END DECLARE SECTION;
1405 EXEC SQL UPDATE servers SET acl_id = 0 WHERE acl_id = :iid AND
1407 rowcount = sqlca.sqlerrd[2];
1409 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1411 printf("Not fixed\n");
1412 modified("servers");
1415 void zero_srv_list(void *id)
1417 EXEC SQL BEGIN DECLARE SECTION;
1418 int iid = (int)id, rowcount;
1419 EXEC SQL END DECLARE SECTION;
1421 EXEC SQL UPDATE servers SET acl_id = 0 WHERE acl_id = :iid AND
1423 rowcount = sqlca.sqlerrd[2];
1425 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1427 printf("Not fixed\n");
1428 modified("servers");
1431 int show_krb_usr(void *id)
1433 EXEC SQL BEGIN DECLARE SECTION;
1434 int iid = (int)id, found = 1, id1;
1435 EXEC SQL END DECLARE SECTION;
1439 EXEC SQL DECLARE csr218 CURSOR FOR
1440 SELECT string_id FROM krbmap
1441 WHERE users_id = :iid;
1442 EXEC SQL OPEN csr218;
1445 EXEC SQL FETCH csr218 INTO :id1;
1449 if ((s = hash_lookup(strings, id1)))
1454 printf("Kerberos map for non-existant user %d to principal %s\n",
1457 EXEC SQL CLOSE csr218;
1461 int show_krb_str(void *id)
1463 EXEC SQL BEGIN DECLARE SECTION;
1464 int iid = (int)id, found = 1, id1;
1465 EXEC SQL END DECLARE SECTION;
1469 EXEC SQL DECLARE csr219 CURSOR FOR
1470 SELECT users_id FROM krbmap
1471 WHERE string_id = :iid;
1472 EXEC SQL OPEN csr219;
1475 EXEC SQL FETCH csr219 INTO :id1;
1479 if ((u = hash_lookup(users, id1)))
1484 printf("Kerberos map for user %s (%d) to non-existant string %d\n",
1487 EXEC SQL CLOSE csr219;
1491 int show_pdm_mach(void *id)
1493 EXEC SQL BEGIN DECLARE SECTION;
1496 EXEC SQL END DECLARE SECTION;
1499 EXEC SQL DECLARE csr220 CURSOR FOR
1500 SELECT name FROM palladium
1501 WHERE mach_id = :iid;
1502 EXEC SQL OPEN csr220;
1505 EXEC SQL FETCH csr220 INTO :name;
1510 printf("Palladium server/supervisor %s is on non-existant machine %d\n",
1514 EXEC SQL CLOSE csr220;
1521 EXEC SQL BEGIN DECLARE SECTION;
1522 int id1, id2, id3, id4, id5;
1523 char type[9], name[33];
1524 EXEC SQL END DECLARE SECTION;
1525 struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5;
1531 printf("Phase 2 - Checking references\n");
1533 dprintf("Checking users...\n");
1534 hash_step(users, user_check, NULL);
1536 dprintf("Checking machines...\n");
1537 hash_step(machines, mach_check, NULL);
1539 dprintf("Checking subnets...\n");
1540 hash_step(subnets, subnet_check, NULL);
1542 dprintf("Checking clusters...\n");
1543 hash_step(clusters, cluster_check, NULL);
1545 dprintf("Checking mcmap...\n");
1548 EXEC SQL DECLARE csr221 CURSOR FOR
1549 SELECT mach_id, clu_id FROM mcmap;
1550 EXEC SQL OPEN csr221;
1553 EXEC SQL FETCH csr221 INTO :id1, :id2;
1557 if (!(m = hash_lookup(machines, id1)))
1558 sq_save_unique_data(sq1, (void *)id1);
1559 else if (!hash_lookup(clusters, id2))
1560 sq_save_unique_data(sq2, (void *)id2);
1564 EXEC SQL CLOSE csr221;
1565 generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1);
1566 generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1);
1568 dprintf("Checking service clusters...\n");
1570 EXEC SQL DECLARE csr222 CURSOR FOR
1571 SELECT clu_id FROM svc;
1572 EXEC SQL OPEN csr222;
1575 EXEC SQL FETCH csr222 INTO :id1;
1579 if (!hash_lookup(clusters, id1))
1580 sq_save_unique_data(sq1, (void *)id1);
1582 EXEC SQL CLOSE csr222;
1583 generic_delete(sq1, show_svc, "svc", "clu_id", 1);
1585 dprintf("Checking lists...\n");
1586 hash_step(lists, list_check, NULL);
1588 dprintf("Checking members...\n");
1595 EXEC SQL DECLARE csr223 CURSOR FOR
1596 SELECT list_id, member_type, member_id, ref_count, direct
1597 FROM imembers FOR UPDATE OF member_id;
1598 EXEC SQL OPEN csr223;
1601 EXEC SQL FETCH csr223 INTO :id1, :type, :id2, :id3, :id4;
1605 if (!(l = hash_lookup(lists, id1)))
1606 sq_save_unique_data(sq1, (void *)id1);
1607 else if (type[0] == 'U' && !hash_lookup(users, id2))
1608 sq_save_unique_data(sq2, (void *)id2);
1609 else if (type[0] == 'L' && !hash_lookup(lists, id2))
1610 sq_save_unique_data(sq3, (void *)id2);
1611 else if (type[0] == 'S' && !maybe_fixup_unref_string2("imembers", "member_id", "csr223", id2))
1612 sq_save_unique_data(sq4, (void *)id2);
1613 else if (type[0] == 'K' && !maybe_fixup_unref_string2("imembers", "member_id", "csr223", id2))
1614 sq_save_unique_data(sq5, (void *)id2);
1618 EXEC SQL CLOSE csr223;
1619 generic_delete(sq1, show_member_list, "imembers", "list_id", 1);
1620 generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1);
1621 generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1);
1622 generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1);
1623 generic_fix(sq5, show_mem_krb, "Delete", del_mem_krb, 1);
1625 dprintf("Checking servers...\n");
1628 EXEC SQL DECLARE csr224 CURSOR FOR
1629 SELECT name, acl_type, acl_id, modby FROM servers
1630 FOR UPDATE of modby;
1631 EXEC SQL OPEN csr224;
1634 EXEC SQL FETCH csr224 INTO :name, :type, :id1, :id2;
1638 maybe_fixup_modby2("servers", "modby", "csr224", id2);
1640 if (!strcmp(type, "USER") && !hash_lookup(users, id1))
1641 sq_save_data(sq1, (void *)id1);
1642 else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1))
1643 sq_save_data(sq2, (void *)id1);
1645 EXEC SQL CLOSE csr224;
1646 generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
1647 generic_fix(sq2, show_srv_list, "Fix", zero_srv_list, 1);
1649 dprintf("Checking serverhosts...\n");
1651 EXEC SQL DECLARE csr225 CURSOR FOR
1652 SELECT mach_id, modby FROM serverhosts
1653 FOR UPDATE OF modby;
1654 EXEC SQL OPEN csr225;
1657 EXEC SQL FETCH csr225 INTO :id1, :id2;
1661 maybe_fixup_modby2("serverhosts", "modby", "csr225", id2);
1662 if (!hash_lookup(machines, id1))
1663 sq_save_data(sq, (void *)id1);
1665 EXEC SQL CLOSE csr225;
1666 generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
1668 dprintf("Checking nfsphys...\n");
1669 hash_step(nfsphys, check_nfsphys, NULL);
1671 dprintf("Checking filesys...\n");
1672 hash_step(filesys, check_fs, NULL);
1674 dprintf("Checking filesystem groups...\n");
1678 EXEC SQL DECLARE csr226 CURSOR FOR
1679 SELECT group_id, filsys_id FROM fsgroup;
1680 EXEC SQL OPEN csr226;
1683 EXEC SQL FETCH csr226 INTO :id1, :id2;
1687 if (!(f = hash_lookup(filesys, id1)))
1688 sq_save_data(sq1, (void *)id1);
1689 if (!hash_lookup(filesys, id2))
1690 sq_save_data(sq3, (void *)id2);
1692 EXEC SQL CLOSE csr226;
1693 generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
1694 generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
1696 dprintf("Checking quotas...\n");
1701 EXEC SQL DECLARE csr227 CURSOR FOR
1702 SELECT entity_id, type, filsys_id, phys_id, quota, modby
1703 FROM quota FOR UPDATE OF modby;
1704 EXEC SQL OPEN csr227;
1707 EXEC SQL FETCH csr227 INTO :id1, :type, :id2, :id3, :id4, :id5;
1711 maybe_fixup_modby2("quota", "modby", "csr227", id5);
1712 if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
1713 sq_save_data(sq1, (void *)id1);
1714 else if (type[0] == 'G' && !hash_lookup(lists, id1))
1715 sq_save_data(sq4, (void *)id1);
1716 else if (!(f = hash_lookup(filesys, id2)))
1717 sq_save_data(sq2, (void *)id2);
1718 else if (id3 != f->phys_id || !(n = hash_lookup(nfsphys, id3)))
1719 sq_save_data(sq3, (void *)id2);
1723 EXEC SQL CLOSE csr227;
1724 generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
1725 generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
1726 generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
1727 generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
1729 dprintf("Not checking zephyr.\n");
1731 dprintf("Checking hostaccess...\n");
1732 EXEC SQL DECLARE csr228 CURSOR FOR
1733 SELECT mach_id, acl_type, acl_id, modby FROM hostaccess
1734 FOR UPDATE OF modby;
1735 EXEC SQL OPEN csr228;
1738 EXEC SQL FETCH csr228 INTO :id1, :type, :id2, :id3;
1742 maybe_fixup_modby2("hostaccess", "modby", "csr228", id3);
1744 if (!hash_lookup(machines, id1))
1746 printf("Hostaccess for non-existant host %d\n", id1);
1747 printf("Not fixing this error\n");
1749 if (!strcmp(type, "USER") && !hash_lookup(users, id2))
1751 printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
1752 printf("Not fixing this error\n");
1754 else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2))
1756 printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
1757 printf("Not fixing this error\n");
1760 EXEC SQL CLOSE csr228;
1762 dprintf("Checking palladium...\n");
1764 EXEC SQL DECLARE csr229 CURSOR FOR
1765 SELECT mach_id, modby FROM palladium
1766 FOR UPDATE OF modby;
1767 EXEC SQL OPEN csr229;
1770 EXEC SQL FETCH csr229 INTO :id1, :id2;
1774 maybe_fixup_modby2("palladium", "modby", "csr229", id2);
1775 if (!hash_lookup(machines, id1))
1776 sq_save_unique_data(sq1, (void *)id1);
1778 EXEC SQL CLOSE csr229;
1779 generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
1781 dprintf("Checking krbmap...\n");
1784 EXEC SQL DECLARE csr230 CURSOR FOR
1785 SELECT users_id, string_id FROM krbmap
1786 FOR UPDATE OF string_id;
1787 EXEC SQL OPEN csr230;
1790 EXEC SQL FETCH csr230 INTO :id1, :id2;
1794 if (!hash_lookup(users, id1))
1795 sq_save_unique_data(sq1, (void *)id1);
1796 else if (!maybe_fixup_unref_string2("krbmap", "string_id", "csr230", id2))
1797 sq_save_unique_data(sq2, (void *)id2);
1799 EXEC SQL CLOSE csr230;
1800 generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
1801 generic_delete(sq2, show_krb_str, "krbmap", "string_id", 1);
1803 dprintf("Checking capacls...\n");
1804 EXEC SQL DECLARE csr231 CURSOR FOR
1805 SELECT list_id, tag FROM capacls;
1806 EXEC SQL OPEN csr231;
1809 EXEC SQL FETCH csr231 INTO :id1, :name;
1813 if (!hash_lookup(lists, id1))
1815 printf("Capacl for %s is non-existant list %d\n", name, id1);
1816 printf("Not fixing this error\n");
1819 EXEC SQL CLOSE csr231;
1821 dprintf("Checking hostaliases\n");
1823 EXEC SQL DECLARE csr232 CURSOR FOR
1824 SELECT mach_id FROM hostalias;
1825 EXEC SQL OPEN csr232;
1828 EXEC SQL FETCH csr232 INTO :id1;
1832 if (!hash_lookup(machines, id1))
1833 sq_save_unique_data(sq1, (void *)id1);
1835 EXEC SQL CLOSE csr232;
1836 generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
1838 dprintf("Checking printcaps\n");
1841 EXEC SQL DECLARE csr233 CURSOR FOR
1842 SELECT mach_id, quotaserver, modby FROM printcap;
1843 EXEC SQL OPEN csr233;
1846 EXEC SQL FETCH csr233 INTO :id1, :id2, :id3;
1850 maybe_fixup_modby2("printcap", "modby", "csr233", id3);
1851 if (!hash_lookup(machines, id1))
1852 sq_save_unique_data(sq1, (void *)id1);
1853 else if (!hash_lookup(machines, id2))
1854 sq_save_unique_data(sq2, (void *)id2);
1856 EXEC SQL CLOSE csr233;
1857 generic_delete(sq1, show_pcap_mach, "printcap", "mach_id", 1);
1858 generic_delete(sq2, show_pcap_quota, "printcap", "quotaserver", 1);