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_mcntmap_mach(void *id);
25 int show_mcntmap_cnt(void *id);
26 int show_hostalias(void *id);
27 int show_printer_mach(void *id);
28 int show_printer_server(void *id);
29 int show_printer_loghost(void *id);
30 int show_printer_spool(void *id);
31 int show_printer_quota(void *id);
32 int show_printer_ac(void *id);
33 int show_printer_lpc_acl(void *id);
34 void fix_printer_ac(void *id);
35 void fix_printer_lpc_acl(void *id);
36 void user_check(int id, void *user, void *hint);
37 int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
38 char *field, char *idfield);
39 int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
40 char *field, char *idfield);
41 int maybe_fixup_unref_string2(char *table, char *field, char *rowid, int sid);
42 int maybe_fixup_modby2(char *table, char *field, char *rowid, int id);
43 void pobox_check(int id, struct user *u);
44 void remove_pobox(int id);
45 void fix_smtp_pobox(int id, int sid);
46 void mach_check(int id, void *machine, void *hint);
47 void subnet_check(int id, void *subnet, void *hint);
48 void clear_subnet_owner(struct subnet *s);
49 void clear_mach_owner(struct machine *m);
50 void cluster_check(int id, void *cluster, void *hint);
51 int show_svc(void *id);
52 void list_check(int id, void *list, void *hint);
53 void fix_list_acl(int id);
54 void fix_list_memacl(int id);
55 int show_member_list(void *id);
56 int show_mem_user(void *id);
57 int show_mem_list(void *id);
58 int show_mem_str(void *id);
59 int show_mem_krb(void *id);
60 int show_mem_mach(void *id);
61 void del_mem_user(void *id);
62 void del_mem_list(void *id);
63 void del_mem_str(void *id);
64 void del_mem_krb(void *id);
65 void del_mem_mach(void *id);
66 int show_sh(void *id);
67 void del_sh_mach(void *id);
68 void fsmatch(int id, void *nfsphys, void *filesys);
69 void check_fs(int id, void *filesys, void *hint);
70 void check_nfsphys(int id, void *nfsphys, void *hint);
71 void check_ps(int id, void *printserver, void *hint);
72 void check_container(int id, void *container, void *hint);
73 void fix_container_acl(int id);
74 void fix_container_memacl(int id);
75 int show_fsg_missing(void *id);
76 int show_fsg_type(void *filesys);
77 void fix_fsg_type(void *filesys);
78 int show_fsg_nomember(void *id);
79 int show_quota_nouser(void *id);
80 int show_quota_nolist(void *id);
81 void fix_quota_nouser(void *id);
82 void fix_quota_nolist(void *id);
83 int show_quota_nofs(void *id);
84 void fix_quota_nofs(void *id);
85 int show_quota_wrongpid(void *id);
86 void fix_quota_physid(void *id);
87 int show_srv_user(void *id);
88 int show_srv_list(void *id);
89 void zero_srv_user(void *id);
90 void zero_srv_list(void *id);
91 int show_krb_usr(void *id);
92 int show_krb_str(void *id);
93 int show_pdm_mach(void *id);
95 int show_mcm_mach(void *id)
97 EXEC SQL BEGIN DECLARE SECTION;
98 int iid = (int)id, found = 1;
99 char name[CLUSTERS_NAME_SIZE];
100 EXEC SQL END DECLARE SECTION;
102 EXEC SQL DECLARE csr201 CURSOR FOR
103 SELECT clusters.name FROM clusters, mcmap
104 WHERE clusters.clu_id = mcmap.clu_id AND mcmap.mach_id = :iid;
105 EXEC SQL OPEN csr201;
108 EXEC SQL FETCH csr201 INTO :name;
114 printf("Cluster %s, non-existant machine %d in cluster map\n",
117 EXEC SQL CLOSE csr201;
121 int show_mcm_clu(void *id)
123 EXEC SQL BEGIN DECLARE SECTION;
124 int iid = (int)id, found = 1;
125 char name[MACHINE_NAME_SIZE];
126 EXEC SQL END DECLARE SECTION;
128 EXEC SQL DECLARE csr202 CURSOR FOR
129 SELECT machine.name FROM machine, mcmap
130 WHERE machine.mach_id = mcmap.mach_id AND mcmap.clu_id = :iid;
131 EXEC SQL OPEN csr202;
134 EXEC SQL FETCH csr202 INTO :name;
141 printf("Machine %s, non-existant cluster %d in cluster map\n",
144 EXEC SQL CLOSE csr202;
148 int show_mcntmap_mach(void *id)
150 EXEC SQL BEGIN DECLARE SECTION;
151 int iid = (int)id, found = 1;
152 char name[CONTAINERS_NAME_SIZE];
153 EXEC SQL END DECLARE SECTION;
155 EXEC SQL DECLARE csr_show_mcnt_mach CURSOR FOR
156 SELECT cnt.name FROM container cnt, mcntmap mc
157 WHERE cnt.cnt_id = mc.cnt_id AND mc.mach_id = :iid;
158 EXEC SQL OPEN csr_show_mcnt_mach;
161 EXEC SQL FETCH csr_show_mcnt_mach INTO :name;
167 printf("Container %s, non-existant machine %d in container map\n",
170 EXEC SQL CLOSE csr_show_mcnt_mach;
174 int show_mcntmap_cnt(void *id)
176 EXEC SQL BEGIN DECLARE SECTION;
177 int iid = (int)id, found = 1;
178 char name[MACHINE_NAME_SIZE];
179 EXEC SQL END DECLARE SECTION;
181 EXEC SQL DECLARE csr_show_mcnt_cnt CURSOR FOR
182 SELECT m.name FROM machine m, mcntmap mc
183 WHERE m.mach_id = mc.mach_id AND mc.cnt_id = :iid;
184 EXEC SQL OPEN csr_show_mcnt_cnt;
187 EXEC SQL FETCH csr_show_mcnt_cnt INTO :name;
194 printf("Machine %s, non-existant container %d in container map\n",
197 EXEC SQL CLOSE csr_show_mcnt_cnt;
201 int show_hostalias(void *id)
203 EXEC SQL BEGIN DECLARE SECTION;
204 int iid = (int)id, found = 1;
205 char name[HOSTALIAS_NAME_SIZE];
206 EXEC SQL END DECLARE SECTION;
208 EXEC SQL DECLARE csr234 CURSOR FOR
209 SELECT name FROM hostalias WHERE mach_id = :iid;
210 EXEC SQL OPEN csr234;
213 EXEC SQL FETCH csr234 INTO :name;
220 printf("Alias %s, non-existant machine %d in hostalias map\n",
223 EXEC SQL CLOSE csr234;
227 int show_printer_mach(void *id)
229 EXEC SQL BEGIN DECLARE SECTION;
230 int iid = (int)id, found = 1;
231 char name[PRINTERS_NAME_SIZE];
232 EXEC SQL END DECLARE SECTION;
234 EXEC SQL DECLARE csr235 CURSOR FOR
235 SELECT name FROM printers WHERE mach_id = :iid;
236 EXEC SQL OPEN csr235;
239 EXEC SQL FETCH csr235 INTO :name;
246 printf("Printer %s, non-existant machine %d in printers table\n",
249 EXEC SQL CLOSE csr235;
253 int show_printer_server(void *id)
255 EXEC SQL BEGIN DECLARE SECTION;
256 int iid = (int)id, found = 1;
257 char name[PRINTERS_NAME_SIZE];
258 EXEC SQL END DECLARE SECTION;
260 EXEC SQL DECLARE csr_sps CURSOR FOR
261 SELECT name FROM printers WHERE mach_id = :iid;
262 EXEC SQL OPEN csr_sps;
265 EXEC SQL FETCH csr_sps INTO :name;
272 printf("Printer %s, non-existant printserver %d in printers table\n",
275 EXEC SQL CLOSE csr_sps;
279 int show_printer_loghost(void *id)
281 EXEC SQL BEGIN DECLARE SECTION;
282 int iid = (int)id, found = 1;
283 char name[PRINTERS_NAME_SIZE];
284 EXEC SQL END DECLARE SECTION;
286 EXEC SQL DECLARE csr236 CURSOR FOR
287 SELECT name FROM printers WHERE loghost = :iid;
288 EXEC SQL OPEN csr236;
291 EXEC SQL FETCH csr236 INTO :name;
298 printf("Printer %s, non-existant spool machine %d in printers table\n",
301 EXEC SQL CLOSE csr236;
305 int show_printer_spool(void *id)
307 EXEC SQL BEGIN DECLARE SECTION;
308 int iid = (int)id, found = 1;
309 char name[PRINTERS_NAME_SIZE];
310 EXEC SQL END DECLARE SECTION;
312 EXEC SQL DECLARE csr237 CURSOR FOR
313 SELECT name FROM printers WHERE rm = :iid;
314 EXEC SQL OPEN csr237;
317 EXEC SQL FETCH csr237 INTO :name;
324 printf("Printer %s, non-existant spool machine %d in printers table\n",
327 EXEC SQL CLOSE csr237;
331 int show_printer_quota(void *id)
333 EXEC SQL BEGIN DECLARE SECTION;
334 int iid = (int)id, found = 1;
335 char name[PRINTERS_NAME_SIZE];
336 EXEC SQL END DECLARE SECTION;
338 EXEC SQL DECLARE csr238 CURSOR FOR
339 SELECT name FROM printers WHERE rq = :iid;
340 EXEC SQL OPEN csr238;
343 EXEC SQL FETCH csr238 INTO :name;
350 printf("Printer %s, non-existant quota server %d in printers table\n",
353 EXEC SQL CLOSE csr238;
357 int show_printer_ac(void *id)
359 EXEC SQL BEGIN DECLARE SECTION;
360 int iid = (int)id, found = 1;
361 char name[PRINTERS_NAME_SIZE];
362 EXEC SQL END DECLARE SECTION;
364 EXEC SQL DECLARE csr239 CURSOR FOR
365 SELECT name FROM printers WHERE ac = :iid;
366 EXEC SQL OPEN csr239;
369 EXEC SQL FETCH csr239 INTO :name;
376 printf("Printer %s, non-existant restrict list %d in printers table\n",
379 EXEC SQL CLOSE csr239;
383 int show_printer_lpc_acl(void *id)
385 EXEC SQL BEGIN DECLARE SECTION;
386 int iid = (int)id, found = 1;
387 char name[PRINTERS_NAME_SIZE];
388 EXEC SQL END DECLARE SECTION;
390 EXEC SQL DECLARE csr240 CURSOR FOR
391 SELECT name FROM printers WHERE lpc_acl = :iid;
392 EXEC SQL OPEN csr240;
395 EXEC SQL FETCH csr240 INTO :name;
402 printf("Printer %s, non-existant lpc ACL %d in printers table\n",
405 EXEC SQL CLOSE csr240;
409 void fix_printer_ac(void *id)
411 EXEC SQL BEGIN DECLARE SECTION;
412 int rowcount, iid = (int)id;
413 EXEC SQL END DECLARE SECTION;
415 EXEC SQL UPDATE printers SET ac = 0 WHERE ac = :iid;
416 rowcount = sqlca.sqlerrd[2];
418 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
420 printf("Not fixed\n");
421 modified("printers");
424 void fix_printer_lpc_acl(void *id)
426 EXEC SQL BEGIN DECLARE SECTION;
427 int rowcount, iid = (int)id;
428 EXEC SQL END DECLARE SECTION;
430 EXEC SQL UPDATE printers SET lpc_acl = 0 WHERE lpc_acl = :iid;
431 rowcount = sqlca.sqlerrd[2];
433 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
435 printf("Not fixed\n");
436 modified("printers");
439 void user_check(int id, void *user, void *hint)
441 struct user *u = user;
443 u->comment = maybe_fixup_unref_string(u->comment, id, u->login, "users",
444 "comments", "users_id");
446 u->modby = maybe_fixup_modby(u->modby, id, u->login, "users",
447 "modby", "users_id");
449 u->fmodby = maybe_fixup_modby(u->fmodby, id, u->login, "users",
450 "fmodby", "users_id");
452 u->pmodby = maybe_fixup_modby(u->pmodby, id, u->login, "users",
453 "pmodby", "users_id");
455 u->sigwho = maybe_fixup_unref_string(u->sigwho, id, u->login, "users",
456 "sigwho", "users_id");
461 int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
462 char *field, char *idfield)
464 int ret = (sid < 0) ? -sid : sid, doit = 0, newid;
465 EXEC SQL BEGIN DECLARE SECTION;
468 EXEC SQL END DECLARE SECTION;
470 if ((newid = (int)hash_lookup(string_dups, ret)))
472 printf("%s entry %s(%d) has a %s with duplicate string %d\n",
473 table, oname, oid, field, ret);
474 if (single_fix("Replace duplicate", 0))
481 else if (!string_check(ret))
483 printf("%s entry %s(%d) has a %s with non-existant string %d\n",
484 table, oname, oid, field, ret);
485 if (single_fix("Delete", 1))
494 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE %s = %d",
495 table, field, (sid < 0) ? -ret : ret, idfield, oid);
496 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
497 rowcount = sqlca.sqlerrd[2];
501 printf("Not fixed, rowcount = %d\n", rowcount);
505 return (sid < 0) ? -ret : ret;
508 int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
509 char *field, char *idfield)
511 EXEC SQL BEGIN DECLARE SECTION;
514 EXEC SQL END DECLARE SECTION;
517 return maybe_fixup_unref_string(sid, oid, oname, table, field, idfield);
520 if (!hash_lookup(users, sid))
522 printf("%s entry %s(%d) has a %s with non-existant user %d\n",
523 table, oname, oid, field, sid);
524 if (single_fix("Delete", 1))
526 sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE %s = %d",
527 table, field, idfield, oid);
528 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
529 rowcount = sqlca.sqlerrd[2];
533 printf("Not fixed, rowcount = %d\n", rowcount);
542 int maybe_fixup_unref_string2(char *table, char *field, char *rowid, int sid)
544 int ret = (sid < 0) ? -sid : sid, doit = 0, newid;
545 EXEC SQL BEGIN DECLARE SECTION;
548 EXEC SQL END DECLARE SECTION;
550 if ((newid = (int)hash_lookup(string_dups, ret)))
552 printf("%s entry has a %s with duplicate string %d\n",
554 if (single_fix("Replace duplicate", 0))
561 else if (!string_check(ret))
563 printf("%s entry has a %s with non-existant string %d\n",
565 if (single_fix("Clear", 1))
574 sprintf(stmt_buf, "UPDATE %s SET %s = %d WHERE rowid = '%s'",
575 table, field, (sid < 0) ? -ret : ret, rowid);
576 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
577 rowcount = sqlca.sqlerrd[2];
581 printf("Not fixed, rowcount = %d\n", rowcount);
584 return (sid < 0) ? -ret : ret;
587 int maybe_fixup_modby2(char *table, char *field, char *rowid, int id)
589 EXEC SQL BEGIN DECLARE SECTION;
592 EXEC SQL END DECLARE SECTION;
595 return maybe_fixup_unref_string2(table, field, rowid, id);
598 if (!hash_lookup(users, id))
600 printf("%s entry has a %s with non-existant user %d\n",
602 if (single_fix("Clear", 1))
604 sprintf(stmt_buf, "UPDATE %s SET %s = 0 WHERE rowid = '%s'",
605 table, field, rowid);
606 EXEC SQL EXECUTE IMMEDIATE :stmt_buf;
607 rowcount = sqlca.sqlerrd[2];
611 printf("Not fixed, rowcount = %d\n", rowcount);
620 void pobox_check(int id, struct user *u)
627 if (!hash_lookup(machines, u->pobox_id))
629 printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
630 u->login, u->fullname, u->pobox_id);
631 if (single_fix("Delete", 0))
633 remove_pobox(u->users_id);
640 if (hash_lookup(string_dups, u->pobox_id))
642 printf("User %s(%s) has P.O.Box with duplicate string %d\n",
643 u->login, u->fullname, u->pobox_id);
644 if (single_fix("Update", 0))
646 printf("Replacing box_id dup string ID %d with %d\n",
648 (int)hash_lookup(string_dups, u->pobox_id));
649 u->pobox_id = (int)hash_lookup(string_dups, u->pobox_id);
650 fix_smtp_pobox(u->users_id, u->pobox_id);
651 string_check(u->pobox_id);
654 else if (!string_check(u->pobox_id))
656 printf("User %s(%s) has P.O.Box with non-existant string %d\n",
657 u->login, u->fullname, u->pobox_id);
658 if (single_fix("Delete", 0))
660 remove_pobox(u->users_id);
667 fs = hash_lookup(filesys, u->pobox_id);
670 printf("User %s(%s) has P.O.Box on non-existant filesystem %d\n",
671 u->login, u->fullname, u->pobox_id);
672 if (single_fix("Delete", 0))
674 remove_pobox(u->users_id);
678 else if (fs->type != 'I')
680 printf("User %s(%s) has IMAP P.O.Box on non-IMAP filesystem %s\n",
681 u->login, u->fullname, fs->name);
682 if (single_fix("Delete", 0))
684 remove_pobox(u->users_id);
696 void remove_pobox(int id)
698 EXEC SQL BEGIN DECLARE SECTION;
699 int rowcount, iid = (int)id;
700 EXEC SQL END DECLARE SECTION;
702 EXEC SQL UPDATE users SET potype = 'NONE' WHERE users.users_id = :iid;
703 rowcount = sqlca.sqlerrd[2];
705 printf("%d entr%s removed\n", rowcount, rowcount == 1 ? "y" : "ies");
707 printf("Not removed\n");
711 void fix_smtp_pobox(int id, int sid)
713 EXEC SQL BEGIN DECLARE SECTION;
714 int rowcount, iid = id, isid = sid;
715 EXEC SQL END DECLARE SECTION;
717 EXEC SQL UPDATE users SET box_id = :isid WHERE users.users_id = :iid;
718 rowcount = sqlca.sqlerrd[2];
720 printf("%d entr%s updated\n", rowcount, rowcount == 1 ? "y" : "ies");
722 printf("Not updated\n");
726 void mach_check(int id, void *machine, void *hint)
728 struct machine *m = machine;
730 if (!hash_lookup(subnets, m->snet_id))
732 printf("Machine %s is on a non-existant subnet %d\n",
733 m->name, m->snet_id);
734 if (single_fix("Move to null-subnet", 1))
736 EXEC SQL BEGIN DECLARE SECTION;
737 int rowcount, iid = id;
738 EXEC SQL END DECLARE SECTION;
740 EXEC SQL UPDATE machine SET snet_id = 0 WHERE mach_id = :iid;
741 rowcount = sqlca.sqlerrd[2];
743 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
745 printf("Not fixed\n");
750 switch (m->owner_type)
753 if (!hash_lookup(users, m->owner_id))
755 printf("Machine %s has non-existant USER owner %d\n",
756 m->name, m->owner_id);
757 if (single_fix("Set to no owner", 1))
762 if (!hash_lookup(lists, m->owner_id))
764 printf("Machine %s has non-existant LIST owner %d\n",
765 m->name, m->owner_id);
766 if (single_fix("Set to no owner", 1))
773 m->owner_id = maybe_fixup_unref_string(m->owner_id, id, m->name,
774 "machine", "owner_id",
776 if (m->owner_id == 0)
781 m->acomment = maybe_fixup_unref_string(m->acomment, id, m->name,
782 "machine", "acomment", "mach_id");
784 m->ocomment = maybe_fixup_unref_string(m->ocomment, id, m->name,
785 "machine", "ocomment", "mach_id");
787 m->creator = maybe_fixup_modby(m->creator, id, m->name, "machine",
788 "creator", "mach_id");
789 m->modby = maybe_fixup_modby(m->modby, id, m->name, "machine",
793 void subnet_check(int id, void *subnet, void *hint)
795 struct subnet *s = subnet;
797 switch (s->owner_type)
800 if (!hash_lookup(users, s->owner_id))
802 printf("Subnet %s has non-existant USER owner %d\n",
803 s->name, s->owner_id);
804 if (single_fix("Set to no owner", 1))
805 clear_subnet_owner(s);
809 if (!hash_lookup(lists, s->owner_id))
811 printf("Machine %s has non-existant LIST owner %d\n",
812 s->name, s->owner_id);
813 if (single_fix("Set to no owner", 1))
814 clear_subnet_owner(s);
820 s->owner_id = maybe_fixup_unref_string(s->owner_id, id, s->name,
821 "machine", "owner_id",
823 if (s->owner_id == 0)
824 clear_subnet_owner(s);
827 s->modby = maybe_fixup_modby(s->modby, id, s->name, "subnet",
831 void clear_subnet_owner(struct subnet *s)
833 EXEC SQL BEGIN DECLARE SECTION;
834 int rowcount, id = s->snet_id;
835 EXEC SQL END DECLARE SECTION;
837 EXEC SQL UPDATE subnet SET owner_type = 'NONE', owner_id = 0
839 rowcount = sqlca.sqlerrd[2];
841 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
843 printf("Not fixed\n");
847 void clear_mach_owner(struct machine *m)
849 EXEC SQL BEGIN DECLARE SECTION;
850 int rowcount, id = m->mach_id;
851 EXEC SQL END DECLARE SECTION;
853 EXEC SQL UPDATE machine SET owner_type = 'NONE', owner_id = 0
855 rowcount = sqlca.sqlerrd[2];
857 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
859 printf("Not fixed\n");
863 void cluster_check(int id, void *cluster, void *hint)
865 struct cluster *c = cluster;
867 c->modby = maybe_fixup_modby(c->modby, id, c->name, "clusters",
871 int show_svc(void *id)
873 EXEC SQL BEGIN DECLARE SECTION;
874 int iid = (int)id, found = 1;
875 char label[SVC_SERV_LABEL_SIZE], data[SVC_SERV_CLUSTER_SIZE];
876 EXEC SQL END DECLARE SECTION;
878 EXEC SQL DECLARE csr203 CURSOR FOR
879 SELECT serv_label, serv_cluster FROM svc
881 EXEC SQL OPEN csr203;
884 EXEC SQL FETCH csr203 INTO :label, :data;
891 printf("Cluster data [%s] %s for non-existant cluster %d\n",
894 EXEC SQL CLOSE csr203;
898 void list_check(int id, void *list, void *hint)
900 struct list *l = list;
902 l->modby = maybe_fixup_modby(l->modby, id, l->name, "list",
908 if (!hash_lookup(lists, l->acl_id))
910 printf("List %s has bad LIST acl %d\n", l->name, l->acl_id);
911 if (single_fix("Patch", 1))
912 fix_list_acl(l->list_id);
916 if (!hash_lookup(users, l->acl_id))
918 printf("List %s has bad USER acl %d\n", l->name, l->acl_id);
919 if (single_fix("Patch", 1))
920 fix_list_acl(l->list_id);
924 l->acl_id = maybe_fixup_unref_string(l->acl_id, id, l->name,
925 "list", "acl_id", "list_id");
928 printf("List %s has bad KERBEROS acl %d\n", l->name, l->acl_id);
929 if (single_fix("Patch", 1))
930 fix_list_acl(l->list_id);
935 switch (l->memacl_type)
938 if (!hash_lookup(lists, l->memacl_id))
940 printf("List %s has bad LIST memacl %d\n", l->name, l->memacl_id);
941 if (single_fix("Patch", 1))
942 fix_list_memacl(l->list_id);
946 if (!hash_lookup(users, l->memacl_id))
948 printf("List %s has bad USER acl %d\n", l->name, l->memacl_id);
949 if (single_fix("Patch", 1))
950 fix_list_memacl(l->list_id);
954 l->memacl_id = maybe_fixup_unref_string(l->memacl_id, id, l->name,
955 "list", "memacl_id", "list_id");
958 printf("List %s has bad KERBEROS acl %d\n", l->name,
960 if (single_fix("Patch", 1))
961 fix_list_memacl(l->list_id);
967 void fix_list_acl(int id)
969 EXEC SQL BEGIN DECLARE SECTION;
970 int rowcount, iid = (int)id;
971 EXEC SQL END DECLARE SECTION;
973 EXEC SQL UPDATE list SET acl_id = :iid, acl_type = 'LIST'
974 WHERE list_id = :iid;
975 rowcount = sqlca.sqlerrd[2];
977 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
979 printf("Not fixed\n");
983 void fix_list_memacl(int id)
985 EXEC SQL BEGIN DECLARE SECTION;
986 int rowcount, iid = (int)id;
987 EXEC SQL END DECLARE SECTION;
989 EXEC SQL UPDATE list SET memacl_id = 0, memacl_type = 'NONE'
990 WHERE list_id = :iid;
991 rowcount = sqlca.sqlerrd[2];
993 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
995 printf("Not fixed\n");
999 int show_member_list(void *id)
1001 EXEC SQL BEGIN DECLARE SECTION;
1002 int mid, iid = (int)id, found = 1;
1003 char mtype[IMEMBERS_MEMBER_TYPE_SIZE], *name = NULL;
1004 EXEC SQL END DECLARE SECTION;
1006 EXEC SQL DECLARE csr204 CURSOR FOR
1007 SELECT member_type, member_id FROM imembers
1008 WHERE list_id = :iid;
1009 EXEC SQL OPEN csr204;
1012 EXEC SQL FETCH csr204 INTO :mtype, :mid;
1018 if (mtype[0] == 'L')
1020 struct list *l = hash_lookup(lists, mid);
1024 else if (mtype[0] == 'U')
1026 struct user *u = hash_lookup(users, mid);
1030 else if (mtype[0] == 'S' || mtype[0] == 'K')
1032 struct string *s = hash_lookup(strings, mid);
1037 printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
1040 printf("Non-existant list %d has non-existent member %s %d\n",
1044 EXEC SQL CLOSE csr204;
1048 int show_mem_user(void *id)
1050 EXEC SQL BEGIN DECLARE SECTION;
1051 int lid, iid = (int)id, found = 1;
1052 EXEC SQL END DECLARE SECTION;
1055 EXEC SQL DECLARE csr205 CURSOR FOR
1056 SELECT list_id FROM imembers
1057 WHERE member_id = :iid AND member_type = 'USER';
1058 EXEC SQL OPEN csr205;
1061 EXEC SQL FETCH csr205 INTO :lid;
1064 l = hash_lookup(lists, lid);
1069 printf("List %s has non-existant user member, id %d\n", l->name, iid);
1071 EXEC SQL CLOSE csr205;
1075 int show_mem_list(void *id)
1077 EXEC SQL BEGIN DECLARE SECTION;
1078 int lid, iid = (int)id, found = 1;
1079 EXEC SQL END DECLARE SECTION;
1082 EXEC SQL DECLARE csr206 CURSOR FOR
1083 SELECT list_id FROM imembers
1084 WHERE member_id = :iid AND member_type = 'LIST';
1085 EXEC SQL OPEN csr206;
1088 EXEC SQL FETCH csr206 INTO :lid;
1091 l = hash_lookup(lists, lid);
1096 printf("List %s has non-existant list member, id %d\n", l->name, iid);
1098 EXEC SQL CLOSE csr206;
1102 int show_mem_str(void *id)
1104 EXEC SQL BEGIN DECLARE SECTION;
1105 int lid, iid = (int)id, found = 1;
1106 EXEC SQL END DECLARE SECTION;
1109 EXEC SQL DECLARE csr207 CURSOR FOR
1110 SELECT list_id FROM imembers
1111 WHERE member_id = :iid AND member_type = 'STRING';
1112 EXEC SQL OPEN csr207;
1115 EXEC SQL FETCH csr207 INTO :lid;
1118 l = hash_lookup(lists, lid);
1123 printf("List %s has non-existant string member, id %d\n", l->name, iid);
1125 EXEC SQL CLOSE csr207;
1130 int show_mem_krb(void *id)
1132 EXEC SQL BEGIN DECLARE SECTION;
1133 int lid, iid = (int)id, found = 1;
1134 EXEC SQL END DECLARE SECTION;
1137 EXEC SQL DECLARE csr208 CURSOR FOR
1138 SELECT list_id FROM imembers
1139 WHERE member_id = :iid AND member_type = 'KERBEROS';
1140 EXEC SQL OPEN csr208;
1143 EXEC SQL FETCH csr208 INTO :lid;
1146 l = hash_lookup(lists, lid);
1151 printf("List %s has non-existant kerberos member, id %d\n",
1154 EXEC SQL CLOSE csr208;
1158 int show_mem_mach(void *id)
1160 EXEC SQL BEGIN DECLARE SECTION;
1161 int lid, iid = (int)id, found = 1;
1162 EXEC SQL END DECLARE SECTION;
1165 EXEC SQL DECLARE csr208a CURSOR FOR
1166 SELECT list_id FROM imembers
1167 WHERE member_id = :iid AND member_type = 'MACHINE';
1168 EXEC SQL OPEN csr208a;
1171 EXEC SQL FETCH csr208a INTO :lid;
1174 l = hash_lookup(lists, lid);
1179 printf("List %s has nonexistant machine member, id %d\n",
1182 EXEC SQL CLOSE csr208a;
1186 void del_mem_user(void *id)
1188 EXEC SQL BEGIN DECLARE SECTION;
1189 int iid = (int)id, rowcount;
1190 EXEC SQL END DECLARE SECTION;
1192 EXEC SQL DELETE FROM imembers WHERE member_type = 'USER' AND
1194 rowcount = sqlca.sqlerrd[2];
1196 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1198 printf("Not deleted\n");
1199 modified("imembers");
1202 void del_mem_list(void *id)
1204 EXEC SQL BEGIN DECLARE SECTION;
1205 int iid = (int)id, rowcount;
1206 EXEC SQL END DECLARE SECTION;
1208 EXEC SQL DELETE FROM imembers WHERE member_type = 'LIST' AND
1210 rowcount = sqlca.sqlerrd[2];
1212 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1214 printf("Not deleted\n");
1215 modified("imembers");
1218 void del_mem_str(void *id)
1220 EXEC SQL BEGIN DECLARE SECTION;
1221 int iid = (int)id, rowcount;
1222 EXEC SQL END DECLARE SECTION;
1224 EXEC SQL DELETE FROM imembers WHERE member_type = 'STRING' AND
1226 rowcount = sqlca.sqlerrd[2];
1228 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1230 printf("Not deleted\n");
1231 modified("imembers");
1235 void del_mem_krb(void *id)
1237 EXEC SQL BEGIN DECLARE SECTION;
1238 int iid = (int)id, rowcount;
1239 EXEC SQL END DECLARE SECTION;
1241 EXEC SQL DELETE FROM imembers WHERE member_type = 'KERBEROS' AND
1243 rowcount = sqlca.sqlerrd[2];
1245 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1247 printf("Not deleted\n");
1248 modified("imembers");
1251 void del_mem_mach(void *id)
1253 EXEC SQL BEGIN DECLARE SECTION;
1254 int iid = (int)id, rowcount;
1255 EXEC SQL END DECLARE SECTION;
1257 EXEC SQL DELETE FROM imembers WHERE member_type = 'MACHINE' AND
1259 rowcount = sqlca.sqlerrd[2];
1261 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1263 printf("Not deleted\n");
1264 modified("imembers");
1267 int show_sh(void *id)
1269 EXEC SQL BEGIN DECLARE SECTION;
1270 char name[SERVERHOSTS_SERVICE_SIZE];
1272 EXEC SQL END DECLARE SECTION;
1275 EXEC SQL DECLARE csr209 CURSOR FOR
1276 SELECT service FROM serverhosts
1277 WHERE mach_id = :iid;
1278 EXEC SQL OPEN csr209;
1281 EXEC SQL FETCH csr209 INTO :name;
1286 printf("ServerHost entry for service %s non-existant host %d\n",
1289 EXEC SQL CLOSE csr209;
1293 void del_sh_mach(void *id)
1295 EXEC SQL BEGIN DECLARE SECTION;
1296 int iid = (int)id, rowcount;
1297 EXEC SQL END DECLARE SECTION;
1299 EXEC SQL DELETE FROM serverhosts WHERE mach_id = :iid;
1300 rowcount = sqlca.sqlerrd[2];
1302 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1304 printf("Not deleted\n");
1305 modified("serverhosts");
1309 static int fnchecklen;
1311 void fsmatch(int id, void *nfsphys, void *filesys)
1313 struct nfsphys *n = nfsphys;
1314 struct filesys *f = filesys;
1316 if (n->mach_id == f->mach_id &&
1317 !strncmp(f->dir, n->dir, strlen(n->dir)) &&
1318 strlen(n->dir) > fnchecklen)
1321 fnchecklen = strlen(n->dir);
1326 void check_fs(int id, void *filesys, void *hint)
1328 EXEC SQL BEGIN DECLARE SECTION;
1329 int iid = id, id1, id2, id3, rowcount;
1331 EXEC SQL END DECLARE SECTION;
1332 struct filesys *f = filesys;
1336 if (!hash_lookup(machines, f->mach_id))
1338 printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
1339 if (single_fix("Fix", 0))
1341 EXEC SQL UPDATE filesys SET mach_id = 0 WHERE filsys_id = :iid;
1342 rowcount = sqlca.sqlerrd[2];
1344 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1346 printf("Not fixed\n");
1347 modified("filesys");
1352 if (!hash_lookup(users, f->owner))
1354 printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
1355 if (single_fix("Fix", 1))
1357 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
1361 if (!hash_lookup(lists, f->owners))
1363 printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
1364 if (single_fix("Fix", 1))
1366 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
1371 if (f->type == 'N' || f->type == 'I')
1373 if (!hash_lookup(nfsphys, f->phys_id))
1375 m = hash_lookup(machines, f->mach_id);
1376 printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
1377 if (single_fix("Fix", 1))
1380 hash_step(nfsphys, fsmatch, f);
1381 if (fnchecklen != 0)
1386 EXEC SQL UPDATE filesys SET phys_id = :id1
1387 WHERE filsys_id = :id2;
1388 rowcount = sqlca.sqlerrd[2];
1390 printf("%d entr%s fixed\n", rowcount,
1391 rowcount == 1 ? "y" : "ies");
1393 printf("Not fixed\n");
1394 modified("filesys");
1398 printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
1399 if (single_fix("Create", 0))
1405 if (set_next_object_id("nfsphys_id", "nfsphys") !=
1408 printf("Unable to assign unique ID\n");
1411 EXEC SQL SELECT COUNT(*) INTO :rowcount FROM numvalues
1412 WHERE name = 'nfsphys_id';
1415 printf("Unable to retrieve unique ID\n");
1418 EXEC SQL INSERT INTO nfsphys
1419 (nfsphys_id, mach_id, device, dir, status, allocated,
1420 size, modtime, modby, modwith) VALUES
1421 (:id1, :id3, '\?\?\?', :dir, 0, 0, 0, SYSDATE, 0,
1423 rowcount = sqlca.sqlerrd[2];
1426 printf("%d entr%s created\n", rowcount,
1427 rowcount == 1 ? "y" : "ies");
1430 printf("Not created\n");
1431 modified("nfsphys");
1432 n = malloc(sizeof(struct nfsphys));
1434 out_of_mem("storing new nfsphys");
1435 strcpy(n->dir, dir);
1437 n->nfsphys_id = id1;
1440 if (hash_store(nfsphys, id1, n) == -1)
1441 out_of_mem("storing nfsphys in hash table");
1442 EXEC SQL UPDATE filesys SET phys_id = :id1
1443 WHERE filsys_id = :id2;
1444 rowcount = sqlca.sqlerrd[2];
1447 printf("%d filesys entr%s fixed\n", rowcount,
1448 rowcount == 1 ? "y" : "ies");
1451 printf("Not fixed\n");
1452 modified("filesys");
1460 void check_nfsphys(int id, void *nfsphys, void *hint)
1462 struct nfsphys *n = nfsphys;
1464 n->modby = maybe_fixup_modby(n->modby, id, n->dir, "nfsphys",
1465 "modby", "nfsphys_id");
1467 if (!hash_lookup(machines, n->mach_id))
1469 printf("NFSphys %d(%s) on non-existant machine %d\n",
1470 id, n->dir, n->mach_id);
1471 if (single_fix("Delete", 0))
1472 single_delete("nfsphys", "nfsphys_id", id);
1476 static void clear_ps_owner(struct printserver *ps)
1478 EXEC SQL BEGIN DECLARE SECTION;
1479 int rowcount, id = ps->mach_id;
1480 EXEC SQL END DECLARE SECTION;
1482 EXEC SQL UPDATE printserver SET owner_type = 'NONE', owner_id = 0
1483 WHERE mach_id = :id;
1484 rowcount = sqlca.sqlerrd[2];
1486 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1488 printf("Not fixed\n");
1489 modified("printservers");
1492 static void clear_ps_lpc(struct printserver *ps)
1494 EXEC SQL BEGIN DECLARE SECTION;
1495 int rowcount, id = ps->mach_id;
1496 EXEC SQL END DECLARE SECTION;
1498 EXEC SQL UPDATE printserver SET lpc_acl = 0
1499 WHERE mach_id = :id;
1500 rowcount = sqlca.sqlerrd[2];
1502 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1504 printf("Not fixed\n");
1505 modified("printservers");
1508 void check_ps(int id, void *printserver, void *hint)
1510 struct printserver *ps = printserver;
1514 m = hash_lookup(machines, id);
1517 printf("Printserver on non-existant machine %d\n", id);
1518 if (single_fix("Delete", 0))
1520 single_delete("printservers", "mach_id", id);
1529 ps->modby = maybe_fixup_modby(ps->modby, id, name, "printservers",
1530 "modby", "mach_id");
1531 ps->printer_types = maybe_fixup_unref_string(ps->printer_types, id, name,
1532 "printservers", "printer_types",
1535 switch (ps->owner_type)
1538 if (!hash_lookup(users, ps->owner_id))
1540 printf("Printserver %s has non-existant USER owner %d\n",
1541 name, ps->owner_id);
1542 if (single_fix("Set to no owner", 1))
1547 if (!hash_lookup(lists, ps->owner_id))
1549 printf("Printserver %s has non-existant LIST owner %d\n",
1550 name, ps->owner_id);
1551 if (single_fix("Set to no owner", 1))
1557 ps->owner_id = maybe_fixup_unref_string(ps->owner_id, id, name,
1558 "printserver", "owner_id",
1560 if (ps->owner_id == 0)
1564 if (!hash_lookup(lists, ps->lpc_acl))
1566 printf("Printserver %s has non-existent lpc_acl %d\n",
1568 if (single_fix("Set to no lpc_acl", 1))
1573 static void clear_container_list(struct container *cnt)
1575 EXEC SQL BEGIN DECLARE SECTION;
1576 int rowcount, id = cnt->cnt_id;
1577 EXEC SQL END DECLARE SECTION;
1579 EXEC SQL UPDATE containers SET list_id = 0
1581 rowcount = sqlca.sqlerrd[2];
1583 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1585 printf("Not fixed\n");
1586 modified("containers");
1589 void fix_container_acl(int id)
1591 EXEC SQL BEGIN DECLARE SECTION;
1592 int rowcount, iid = (int)id;
1593 EXEC SQL END DECLARE SECTION;
1595 EXEC SQL UPDATE containers SET acl_id = 0, acl_type = 'NONE'
1596 WHERE cnt_id = :iid;
1597 rowcount = sqlca.sqlerrd[2];
1599 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1601 printf("Not fixed\n");
1602 modified("containers");
1605 void fix_container_memacl(int id)
1607 EXEC SQL BEGIN DECLARE SECTION;
1608 int rowcount, iid = (int)id;
1609 EXEC SQL END DECLARE SECTION;
1611 EXEC SQL UPDATE containers SET memacl_id = 0, memacl_type = 'NONE'
1612 WHERE cnt_id = :iid;
1613 rowcount = sqlca.sqlerrd[2];
1615 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1617 printf("Not fixed\n");
1618 modified("containers");
1621 void check_container(int id, void *container, void *hint)
1623 struct container *cnt = container;
1625 if (!hash_lookup(lists, cnt->list_id))
1627 printf("Container %s has non-existent associated list_id %d\n",
1628 cnt->name, cnt->list_id);
1629 if (single_fix("Set to no associated list", 1))
1630 clear_container_list(cnt);
1633 switch (cnt->acl_type)
1636 if (!hash_lookup(lists, cnt->acl_id))
1638 printf("Container %s has bad LIST acl %d\n", cnt->name, cnt->acl_id);
1639 if (single_fix("Patch", 1))
1640 fix_container_acl(cnt->cnt_id);
1644 if (!hash_lookup(users, cnt->acl_id))
1646 printf("Container %s has bad USER acl %d\n", cnt->name, cnt->acl_id);
1647 if (single_fix("Patch", 1))
1648 fix_container_acl(cnt->cnt_id);
1652 cnt->acl_id = maybe_fixup_unref_string(cnt->acl_id, id, cnt->name,
1653 "container", "acl_id", "cnt_id");
1656 printf("Container %s has bad KERBEROS acl %d\n", cnt->name,
1658 if (single_fix("Patch", 1))
1659 fix_container_acl(cnt->cnt_id);
1664 switch (cnt->memacl_type)
1667 if (!hash_lookup(lists, cnt->memacl_id))
1669 printf("Container %s has bad LIST memacl %d\n", cnt->name,
1671 if (single_fix("Patch", 1))
1672 fix_container_memacl(cnt->cnt_id);
1676 if (!hash_lookup(users, cnt->memacl_id))
1678 printf("Container %s has bad USER memacl %d\n", cnt->name,
1680 if (single_fix("Patch", 1))
1681 fix_container_memacl(cnt->cnt_id);
1685 cnt->memacl_id = maybe_fixup_unref_string(cnt->memacl_id, id, cnt->name,
1686 "container", "memacl_id",
1688 if (!cnt->memacl_id)
1690 printf("Container %s has bad KERBEROS memacl %d\n", cnt->name,
1692 if (single_fix("Patch", 1))
1693 fix_container_memacl(cnt->cnt_id);
1698 cnt->modby = maybe_fixup_modby(cnt->modby, id, cnt->name, "containers",
1702 int show_fsg_missing(void *id)
1704 EXEC SQL BEGIN DECLARE SECTION;
1705 int iid = (int)id, id1, found = 1;
1706 EXEC SQL END DECLARE SECTION;
1709 EXEC SQL DECLARE csr210 CURSOR FOR
1710 SELECT filsys_id FROM fsgroup
1711 WHERE group_id = :iid;
1712 EXEC SQL OPEN csr210;
1715 EXEC SQL FETCH csr210 INTO :id1;
1720 if ((f = hash_lookup(filesys, id1)))
1721 printf("Missing fsgroup %d has member filesystem %s\n", iid, f->name);
1723 printf("Missing fsgroup %d has member filesystem %d\n", iid, id1);
1725 EXEC SQL CLOSE csr210;
1729 int show_fsg_type(void *filesys)
1731 struct filesys *f = filesys;
1757 printf("FSGroup %s has type %s instead of FSGROUP\n", f->name, t);
1761 void fix_fsg_type(void *filesys)
1763 struct filesys *f = filesys;
1764 EXEC SQL BEGIN DECLARE SECTION;
1765 int rowcount, id = f->filsys_id;
1766 EXEC SQL END DECLARE SECTION;
1768 EXEC SQL UPDATE filesys SET type = 'FSGROUP' WHERE filsys_id = :id;
1769 rowcount = sqlca.sqlerrd[2];
1771 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1773 printf("Not fixed\n");
1774 modified("filesys");
1777 int show_fsg_nomember(void *id)
1779 EXEC SQL BEGIN DECLARE SECTION;
1780 int iid = (int)id, id1, found = 1;
1781 EXEC SQL END DECLARE SECTION;
1784 EXEC SQL DECLARE csr211 CURSOR FOR
1785 SELECT group_id FROM fsgroup
1786 WHERE filsys_id = :iid;
1787 EXEC SQL OPEN csr211;
1790 EXEC SQL FETCH csr211 INTO :id1;
1795 if ((f = hash_lookup(filesys, id1)))
1796 printf("FSGroup %s has missing member %d\n", f->name, iid);
1798 printf("FSGroup %d has missing member %d\n", id1, iid);
1800 EXEC SQL CLOSE csr211;
1804 int show_quota_nouser(void *id)
1806 EXEC SQL BEGIN DECLARE SECTION;
1807 int iid = (int)id, id1, found = 1;
1808 EXEC SQL END DECLARE SECTION;
1810 EXEC SQL DECLARE csr212 CURSOR FOR
1811 SELECT filsys_id FROM quota
1812 WHERE entity_id = :iid AND type = 'USER';
1813 EXEC SQL OPEN csr212;
1816 EXEC SQL FETCH csr212 INTO :id1;
1821 printf("Quota on fs %d for non-existant user %d\n", id1, iid);
1823 EXEC SQL CLOSE csr212;
1827 int show_quota_nolist(void *id)
1829 EXEC SQL BEGIN DECLARE SECTION;
1830 int iid = (int)id, id1, found = 1;
1831 EXEC SQL END DECLARE SECTION;
1833 EXEC SQL DECLARE csr213 CURSOR FOR
1834 SELECT filsys_id FROM quota
1835 WHERE entity_id = :iid AND type = 'GROUP';
1836 EXEC SQL OPEN csr213;
1839 EXEC SQL FETCH csr213 INTO :id1;
1844 printf("Quota on fs %d for non-existant list %d\n", id1, iid);
1846 EXEC SQL CLOSE csr213;
1850 void fix_quota_nouser(void *id)
1852 EXEC SQL BEGIN DECLARE SECTION;
1853 int iid = (int)id, rowcount;
1854 EXEC SQL END DECLARE SECTION;
1856 EXEC SQL DELETE FROM quota
1857 WHERE entity_id = :iid AND type = 'USER';
1858 rowcount = sqlca.sqlerrd[2];
1860 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1862 printf("Not deleted\n");
1866 void fix_quota_nolist(void *id)
1868 EXEC SQL BEGIN DECLARE SECTION;
1869 int iid = (int)id, rowcount;
1870 EXEC SQL END DECLARE SECTION;
1872 EXEC SQL DELETE FROM quota WHERE entity_id = :iid AND type = 'GROUP';
1873 rowcount = sqlca.sqlerrd[2];
1875 printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
1877 printf("Not deleted\n");
1881 int show_quota_nofs(void *id)
1883 EXEC SQL BEGIN DECLARE SECTION;
1884 int iid = (int)id, id1, found = 1;
1885 char type[QUOTA_TYPE_SIZE];
1886 EXEC SQL END DECLARE SECTION;
1888 EXEC SQL DECLARE csr214 CURSOR FOR
1889 SELECT entity_id, type FROM quota
1890 WHERE filsys_id = :iid;
1891 EXEC SQL OPEN csr214;
1894 EXEC SQL FETCH csr214 INTO :id1, :type;
1899 printf("Quota for %s %d on non-existant filesys %d\n", type, id1, iid);
1901 EXEC SQL CLOSE csr214;
1905 void fix_quota_nofs(void *id)
1907 single_delete("quota", "filsys_id", (int)id);
1910 int show_quota_wrongpid(void *id)
1912 EXEC SQL BEGIN DECLARE SECTION;
1913 int iid = (int)id, id1, found = 1;
1914 char type[QUOTA_TYPE_SIZE];
1915 EXEC SQL END DECLARE SECTION;
1918 f = hash_lookup(filesys, iid);
1919 EXEC SQL DECLARE csr215 CURSOR FOR
1920 SELECT entity_id, type FROM quota
1921 WHERE filsys_id = :iid;
1922 EXEC SQL OPEN csr215;
1925 EXEC SQL FETCH csr215 INTO :id1, :type;
1930 printf("Quota for %s %d on filesys %s has wrong phys_id %d\n",
1931 type, id1, f->name, iid);
1933 EXEC SQL CLOSE csr215;
1937 void fix_quota_physid(void *id)
1939 EXEC SQL BEGIN DECLARE SECTION;
1940 int iid = (int)id, rowcount, id1;
1941 EXEC SQL END DECLARE SECTION;
1943 id1 = ((struct filesys *)hash_lookup(filesys, iid))->phys_id;
1944 EXEC SQL UPDATE quota SET phys_id = :id1
1945 WHERE filsys_id = :iid AND phys_id != :id1;
1946 rowcount = sqlca.sqlerrd[2];
1948 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
1950 printf("Not fixed\n");
1954 int show_srv_user(void *id)
1956 EXEC SQL BEGIN DECLARE SECTION;
1957 char name[SERVERS_NAME_SIZE];
1959 EXEC SQL END DECLARE SECTION;
1962 EXEC SQL DECLARE csr216 CURSOR FOR
1963 SELECT name FROM servers
1964 WHERE acl_type = 'USER' and acl_id = :iid;
1965 EXEC SQL OPEN csr216;
1968 EXEC SQL FETCH csr216 INTO :name;
1973 printf("Service %s has acl non-existant user %d\n", name, iid);
1976 EXEC SQL CLOSE csr216;
1980 int show_srv_list(void *id)
1982 EXEC SQL BEGIN DECLARE SECTION;
1983 char name[SERVERS_NAME_SIZE];
1985 EXEC SQL END DECLARE SECTION;
1988 EXEC SQL DECLARE csr217 CURSOR FOR
1989 SELECT name FROM servers
1990 WHERE acl_type = 'LIST' AND acl_id = :iid;
1991 EXEC SQL OPEN csr217;
1994 EXEC SQL FETCH csr217 INTO :name;
1999 printf("Service %s has acl non-existant list %d\n", name, iid);
2002 EXEC SQL CLOSE csr217;
2006 void zero_srv_user(void *id)
2008 EXEC SQL BEGIN DECLARE SECTION;
2009 int iid = (int)id, rowcount;
2010 EXEC SQL END DECLARE SECTION;
2012 EXEC SQL UPDATE servers SET acl_id = 0 WHERE acl_id = :iid AND
2014 rowcount = sqlca.sqlerrd[2];
2016 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
2018 printf("Not fixed\n");
2019 modified("servers");
2022 void zero_srv_list(void *id)
2024 EXEC SQL BEGIN DECLARE SECTION;
2025 int iid = (int)id, rowcount;
2026 EXEC SQL END DECLARE SECTION;
2028 EXEC SQL UPDATE servers SET acl_id = 0 WHERE acl_id = :iid AND
2030 rowcount = sqlca.sqlerrd[2];
2032 printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
2034 printf("Not fixed\n");
2035 modified("servers");
2038 int show_krb_usr(void *id)
2040 EXEC SQL BEGIN DECLARE SECTION;
2041 int iid = (int)id, found = 1, id1;
2042 EXEC SQL END DECLARE SECTION;
2046 EXEC SQL DECLARE csr218 CURSOR FOR
2047 SELECT string_id FROM krbmap
2048 WHERE users_id = :iid;
2049 EXEC SQL OPEN csr218;
2052 EXEC SQL FETCH csr218 INTO :id1;
2056 if ((s = hash_lookup(strings, id1)))
2061 printf("Kerberos map for non-existant user %d to principal %s\n",
2064 EXEC SQL CLOSE csr218;
2068 int show_krb_str(void *id)
2070 EXEC SQL BEGIN DECLARE SECTION;
2071 int iid = (int)id, found = 1, id1;
2072 EXEC SQL END DECLARE SECTION;
2076 EXEC SQL DECLARE csr219 CURSOR FOR
2077 SELECT users_id FROM krbmap
2078 WHERE string_id = :iid;
2079 EXEC SQL OPEN csr219;
2082 EXEC SQL FETCH csr219 INTO :id1;
2086 if ((u = hash_lookup(users, id1)))
2091 printf("Kerberos map for user %s (%d) to non-existant string %d\n",
2094 EXEC SQL CLOSE csr219;
2100 struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5, *sq6;
2107 printf("Phase 2 - Checking references\n");
2109 dprintf("Checking users...\n");
2110 hash_step(users, user_check, NULL);
2112 dprintf("Checking machines...\n");
2113 hash_step(machines, mach_check, NULL);
2115 dprintf("Checking subnets...\n");
2116 hash_step(subnets, subnet_check, NULL);
2118 dprintf("Checking clusters...\n");
2119 hash_step(clusters, cluster_check, NULL);
2121 dprintf("Checking mcmap...\n");
2124 EXEC SQL DECLARE csr221 CURSOR FOR
2125 SELECT mach_id, clu_id FROM mcmap;
2126 EXEC SQL OPEN csr221;
2129 EXEC SQL BEGIN DECLARE SECTION;
2130 int mach_id, clu_id;
2131 EXEC SQL END DECLARE SECTION;
2133 EXEC SQL FETCH csr221 INTO :mach_id, :clu_id;
2137 if (!(m = hash_lookup(machines, mach_id)))
2138 sq_save_unique_data(sq1, (void *)mach_id);
2139 else if (!hash_lookup(clusters, clu_id))
2140 sq_save_unique_data(sq2, (void *)clu_id);
2144 EXEC SQL CLOSE csr221;
2145 generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1);
2146 generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1);
2148 dprintf("Checking service clusters...\n");
2150 EXEC SQL DECLARE csr222 CURSOR FOR
2151 SELECT clu_id FROM svc;
2152 EXEC SQL OPEN csr222;
2155 EXEC SQL BEGIN DECLARE SECTION;
2157 EXEC SQL END DECLARE SECTION;
2159 EXEC SQL FETCH csr222 INTO :clu_id;
2163 if (!hash_lookup(clusters, clu_id))
2164 sq_save_unique_data(sq1, (void *)clu_id);
2166 EXEC SQL CLOSE csr222;
2167 generic_delete(sq1, show_svc, "svc", "clu_id", 1);
2169 dprintf("Checking lists...\n");
2170 hash_step(lists, list_check, NULL);
2172 dprintf("Checking members...\n");
2180 EXEC SQL DECLARE csr223 CURSOR FOR
2181 SELECT list_id, member_type, member_id, tag, ref_count, direct, rowid
2182 FROM imembers FOR UPDATE OF member_id;
2183 EXEC SQL OPEN csr223;
2186 EXEC SQL BEGIN DECLARE SECTION;
2187 int list_id, id, tag, ref_count, direct;
2188 char type[IMEMBERS_MEMBER_TYPE_SIZE];
2189 EXEC SQL END DECLARE SECTION;
2191 EXEC SQL FETCH csr223 INTO :list_id, :type, :id, :tag,
2192 :ref_count, :direct, :rowid;
2197 if (!(l = hash_lookup(lists, list_id)))
2198 sq_save_unique_data(sq1, (void *)list_id);
2199 else if (type[0] == 'U' && !hash_lookup(users, id))
2200 sq_save_unique_data(sq2, (void *)id);
2201 else if (type[0] == 'L' && !hash_lookup(lists, id))
2202 sq_save_unique_data(sq3, (void *)id);
2203 else if (type[0] == 'S' && !maybe_fixup_unref_string2("imembers", "member_id", rowid, id))
2204 sq_save_unique_data(sq4, (void *)id);
2205 else if (type[0] == 'K' && !maybe_fixup_unref_string2("imembers", "member_id", rowid, id))
2206 sq_save_unique_data(sq5, (void *)id);
2207 else if (type[0] == 'M' && !hash_lookup(machines, id))
2208 sq_save_unique_data(sq6, (void *)id);
2211 maybe_fixup_unref_string2("imembers", "tag", rowid, tag);
2213 EXEC SQL CLOSE csr223;
2214 generic_delete(sq1, show_member_list, "imembers", "list_id", 1);
2215 generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1);
2216 generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1);
2217 generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1);
2218 generic_fix(sq5, show_mem_krb, "Delete", del_mem_krb, 1);
2219 generic_fix(sq6, show_mem_mach, "Delete", del_mem_mach, 1);
2221 dprintf("Checking servers...\n");
2224 EXEC SQL DECLARE csr224 CURSOR FOR
2225 SELECT name, acl_type, acl_id, modby, rowid FROM servers
2226 FOR UPDATE of modby;
2227 EXEC SQL OPEN csr224;
2230 EXEC SQL BEGIN DECLARE SECTION;
2232 char name[SERVERS_NAME_SIZE], acl_type[SERVERS_ACL_TYPE_SIZE];
2233 EXEC SQL END DECLARE SECTION;
2235 EXEC SQL FETCH csr224 INTO :name, :acl_type, :acl_id, :modby, :rowid;
2239 maybe_fixup_modby2("servers", "modby", strtrim(rowid), modby);
2241 if (!strcmp(acl_type, "USER") && !hash_lookup(users, acl_id))
2242 sq_save_data(sq1, (void *)acl_id);
2243 else if (!strcmp(acl_type, "LIST") && !hash_lookup(lists, acl_id))
2244 sq_save_data(sq2, (void *)acl_id);
2246 EXEC SQL CLOSE csr224;
2247 generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
2248 generic_fix(sq2, show_srv_list, "Fix", zero_srv_list, 1);
2250 dprintf("Checking serverhosts...\n");
2252 EXEC SQL DECLARE csr225 CURSOR FOR
2253 SELECT mach_id, modby, rowid FROM serverhosts
2254 FOR UPDATE OF modby;
2255 EXEC SQL OPEN csr225;
2258 EXEC SQL BEGIN DECLARE SECTION;
2260 EXEC SQL END DECLARE SECTION;
2262 EXEC SQL FETCH csr225 INTO :mach_id, :modby, :rowid;
2266 maybe_fixup_modby2("serverhosts", "modby", strtrim(rowid), modby);
2267 if (!hash_lookup(machines, mach_id))
2268 sq_save_data(sq, (void *)mach_id);
2270 EXEC SQL CLOSE csr225;
2271 generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
2273 dprintf("Checking nfsphys...\n");
2274 hash_step(nfsphys, check_nfsphys, NULL);
2276 dprintf("Checking filesys...\n");
2277 hash_step(filesys, check_fs, NULL);
2279 dprintf("Checking filesystem groups...\n");
2283 EXEC SQL DECLARE csr226 CURSOR FOR
2284 SELECT group_id, filsys_id FROM fsgroup;
2285 EXEC SQL OPEN csr226;
2288 EXEC SQL BEGIN DECLARE SECTION;
2289 int group_id, filsys_id;
2290 EXEC SQL END DECLARE SECTION;
2292 EXEC SQL FETCH csr226 INTO :group_id, :filsys_id;
2296 if (!(f = hash_lookup(filesys, group_id)))
2297 sq_save_data(sq1, (void *)group_id);
2298 if (!hash_lookup(filesys, filsys_id))
2299 sq_save_data(sq3, (void *)filsys_id);
2301 EXEC SQL CLOSE csr226;
2302 generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
2303 generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
2305 dprintf("Checking quotas...\n");
2310 EXEC SQL DECLARE csr227 CURSOR FOR
2311 SELECT entity_id, type, filsys_id, phys_id, quota, modby, rowid
2312 FROM quota FOR UPDATE OF modby;
2313 EXEC SQL OPEN csr227;
2316 EXEC SQL BEGIN DECLARE SECTION;
2317 int entity_id, filsys_id, phys_id, quota, modby;
2318 char type[QUOTA_TYPE_SIZE];
2319 EXEC SQL END DECLARE SECTION;
2321 EXEC SQL FETCH csr227 INTO :entity_id, :type, :filsys_id,
2322 :phys_id, :quota, :modby, :rowid;
2326 maybe_fixup_modby2("quota", "modby", strtrim(rowid), modby);
2327 if (type[0] == 'U' && entity_id != 0 && !hash_lookup(users, entity_id))
2328 sq_save_data(sq1, (void *)entity_id);
2329 else if (type[0] == 'G' && !hash_lookup(lists, entity_id))
2330 sq_save_data(sq4, (void *)entity_id);
2331 else if (!(f = hash_lookup(filesys, filsys_id)))
2332 sq_save_data(sq2, (void *)filsys_id);
2333 else if (phys_id != f->phys_id || !(n = hash_lookup(nfsphys, phys_id)))
2334 sq_save_data(sq3, (void *)phys_id);
2338 EXEC SQL CLOSE csr227;
2339 generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
2340 generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
2341 generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
2342 generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
2344 dprintf("Checking zephyr...\n");
2345 EXEC SQL DECLARE csr_zc CURSOR FOR
2346 SELECT class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id,
2347 iui_type, iui_id, modby FROM zephyr;
2348 EXEC SQL OPEN csr_zc;
2351 EXEC SQL BEGIN DECLARE SECTION;
2352 int xmt_id, sub_id, iws_id, iui_id, modby;
2353 char class[ZEPHYR_CLASS_SIZE];
2354 char xmt_type[ZEPHYR_XMT_TYPE_SIZE];
2355 char sub_type[ZEPHYR_SUB_TYPE_SIZE];
2356 char iws_type[ZEPHYR_IWS_TYPE_SIZE];
2357 char iui_type[ZEPHYR_IUI_TYPE_SIZE];
2358 EXEC SQL END DECLARE SECTION;
2360 EXEC SQL FETCH csr_zc INTO :class, :xmt_type, :xmt_id, :sub_type,
2361 :sub_id, :iws_type, :iws_id, :iui_type, :iui_id, :modby;
2366 maybe_fixup_modby2("zephyr", "modby", strtrim(rowid), modby);
2369 if (!strcmp(xmt_type, "USER") && !hash_lookup(users, xmt_id))
2371 printf("xmt acl for %s is non-existant user %d\n", class, xmt_id);
2372 printf("Not fixing this error\n");
2374 else if (!strcmp(xmt_type, "LIST") && !hash_lookup(lists, xmt_id))
2376 printf("xmt acl for %s is non-existant list %d\n", class, xmt_id);
2377 printf("Not fixing this error\n");
2379 else if (!strcmp(xmt_type, "STRING") || !strcmp(xmt_type, "KERBEROS"))
2380 maybe_fixup_unref_string2("zephyr", "xmt_id", strtrim(rowid), xmt_id);
2383 if (!strcmp(sub_type, "USER") && !hash_lookup(users, sub_id))
2385 printf("sub acl for %s is non-existant user %d\n", class, sub_id);
2386 printf("Not fixing this error\n");
2388 else if (!strcmp(sub_type, "LIST") && !hash_lookup(lists, sub_id))
2390 printf("sub acl for %s is non-existant list %d\n", class, sub_id);
2391 printf("Not fixing this error\n");
2393 else if (!strcmp(sub_type, "STRING") || !strcmp(sub_type, "KERBEROS"))
2394 maybe_fixup_unref_string2("zephyr", "sub_id", strtrim(rowid), sub_id);
2397 if (!strcmp(iws_type, "USER") && !hash_lookup(users, iws_id))
2399 printf("iws acl for %s is non-existant user %d\n", class, iws_id);
2400 printf("Not fixing this error\n");
2402 else if (!strcmp(iws_type, "LIST") && !hash_lookup(lists, iws_id))
2404 printf("iws acl for %s is non-existant list %d\n", class, iws_id);
2405 printf("Not fixing this error\n");
2407 else if (!strcmp(iws_type, "STRING") || !strcmp(iws_type, "KERBEROS"))
2408 maybe_fixup_unref_string2("zephyr", "iws_id", strtrim(rowid), iws_id);
2411 if (!strcmp(iui_type, "USER") && !hash_lookup(users, iui_id))
2413 printf("iui acl for %s is non-existant user %d\n", class, iui_id);
2414 printf("Not fixing this error\n");
2416 else if (!strcmp(iui_type, "LIST") && !hash_lookup(lists, iui_id))
2418 printf("iui acl for %s is non-existant list %d\n", class, iui_id);
2419 printf("Not fixing this error\n");
2421 else if (!strcmp(iui_type, "STRING") || !strcmp(iui_type, "KERBEROS"))
2422 maybe_fixup_unref_string2("zephyr", "iui_id", strtrim(rowid), iui_id);
2425 dprintf("Checking hostaccess...\n");
2426 EXEC SQL DECLARE csr228 CURSOR FOR
2427 SELECT mach_id, acl_type, acl_id, modby, rowid FROM hostaccess
2428 FOR UPDATE OF modby;
2429 EXEC SQL OPEN csr228;
2432 EXEC SQL BEGIN DECLARE SECTION;
2433 int mach_id, acl_id, modby;
2434 char acl_type[HOSTACCESS_ACL_TYPE_SIZE];
2435 EXEC SQL END DECLARE SECTION;
2437 EXEC SQL FETCH csr228 INTO :mach_id, :acl_type, :acl_id, :modby, :rowid;
2441 maybe_fixup_modby2("hostaccess", "modby", strtrim(rowid), modby);
2443 if (!hash_lookup(machines, mach_id))
2445 printf("Hostaccess for non-existant host %d\n", mach_id);
2446 printf("Not fixing this error\n");
2448 if (!strcmp(acl_type, "USER") && !hash_lookup(users, acl_id))
2450 printf("Hostaccess for %d is non-existant user %d\n", mach_id, acl_id);
2451 printf("Not fixing this error\n");
2453 else if (!strcmp(acl_type, "LIST") && !hash_lookup(lists, acl_id))
2455 printf("Hostaccess for %d is non-existant list %d\n", mach_id, acl_id);
2456 printf("Not fixing this error\n");
2459 EXEC SQL CLOSE csr228;
2461 dprintf("Checking krbmap...\n");
2464 EXEC SQL DECLARE csr230 CURSOR FOR
2465 SELECT users_id, string_id, rowid FROM krbmap
2466 FOR UPDATE OF string_id;
2467 EXEC SQL OPEN csr230;
2470 EXEC SQL BEGIN DECLARE SECTION;
2471 int users_id, string_id;
2472 EXEC SQL END DECLARE SECTION;
2474 EXEC SQL FETCH csr230 INTO :users_id, :string_id, :rowid;
2478 if (!hash_lookup(users, users_id))
2479 sq_save_unique_data(sq1, (void *)users_id);
2480 else if (!maybe_fixup_unref_string2("krbmap", "string_id", strtrim(rowid), string_id))
2481 sq_save_unique_data(sq2, (void *)string_id);
2483 EXEC SQL CLOSE csr230;
2484 generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
2485 generic_delete(sq2, show_krb_str, "krbmap", "string_id", 1);
2487 dprintf("Checking capacls...\n");
2488 EXEC SQL DECLARE csr231 CURSOR FOR
2489 SELECT list_id, tag FROM capacls;
2490 EXEC SQL OPEN csr231;
2493 EXEC SQL BEGIN DECLARE SECTION;
2495 char tag[CAPACLS_TAG_SIZE];
2496 EXEC SQL END DECLARE SECTION;
2498 EXEC SQL FETCH csr231 INTO :list_id, :tag;
2502 if (!hash_lookup(lists, list_id))
2504 printf("Capacl for %s is non-existant list %d\n", tag, list_id);
2505 printf("Not fixing this error\n");
2508 EXEC SQL CLOSE csr231;
2510 dprintf("Checking hostaliases...\n");
2512 EXEC SQL DECLARE csr232 CURSOR FOR
2513 SELECT mach_id FROM hostalias;
2514 EXEC SQL OPEN csr232;
2517 EXEC SQL BEGIN DECLARE SECTION;
2519 EXEC SQL END DECLARE SECTION;
2521 EXEC SQL FETCH csr232 INTO :mach_id;
2525 if (!hash_lookup(machines, mach_id))
2526 sq_save_unique_data(sq1, (void *)mach_id);
2528 EXEC SQL CLOSE csr232;
2529 generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
2531 dprintf("Checking printers...\n");
2538 EXEC SQL DECLARE csr233 CURSOR FOR
2539 SELECT mach_id, loghost, rm, rq, ac, lpc_acl, modby, rowid FROM printers;
2540 EXEC SQL OPEN csr233;
2543 EXEC SQL BEGIN DECLARE SECTION;
2544 int mach_id, loghost, rm, rq, ac, lpc_acl, modby;
2545 EXEC SQL END DECLARE SECTION;
2547 EXEC SQL FETCH csr233 INTO :mach_id, :loghost, :rm, :rq, :ac,
2548 :lpc_acl, :modby, :rowid;
2552 maybe_fixup_modby2("printers", "modby", strtrim(rowid), modby);
2553 if (!hash_lookup(machines, mach_id))
2554 sq_save_unique_data(sq1, (void *)mach_id);
2555 else if (!hash_lookup(machines, rm))
2556 sq_save_unique_data(sq2, (void *)rm);
2557 else if (!hash_lookup(printservers, rm))
2558 sq_save_unique_data(sq6, (void *)mach_id);
2559 else if (!hash_lookup(machines, rq))
2560 sq_save_unique_data(sq3, (void *)rq);
2562 if (!hash_lookup(lists, ac))
2563 sq_save_unique_data(sq4, (void *)ac);
2564 if (!hash_lookup(lists, lpc_acl))
2565 sq_save_unique_data(sq5, (void *)lpc_acl);
2566 if (!hash_lookup(machines, loghost))
2568 show_printer_loghost((void *)loghost);
2573 EXEC SQL CLOSE csr233;
2574 generic_delete(sq1, show_printer_mach, "printers", "mach_id", 1);
2575 generic_delete(sq6, show_printer_server, "printers", "mach_id", 1);
2576 generic_delete(sq2, show_printer_spool, "printers", "rm", 1);
2577 generic_delete(sq3, show_printer_quota, "printers", "rq", 1);
2578 generic_fix(sq4, show_printer_ac, "Clear", fix_printer_ac, 1);
2579 generic_fix(sq5, show_printer_lpc_acl, "Clear", fix_printer_lpc_acl, 1);
2581 dprintf("Checking printservers...\n");
2582 hash_step(printservers, check_ps, NULL);
2584 dprintf("Checking containers...\n");
2585 hash_step(containers, check_container, NULL);
2587 dprintf("Checking mcntmap...\n");
2590 EXEC SQL DECLARE csr_mcntmap CURSOR FOR
2591 SELECT mach_id, cnt_id FROM mcntmap;
2592 EXEC SQL OPEN csr_mcntmap;
2595 EXEC SQL BEGIN DECLARE SECTION;
2596 int mach_id, cnt_id;
2597 EXEC SQL END DECLARE SECTION;
2599 EXEC SQL FETCH csr_mcntmap INTO :mach_id, :cnt_id;
2603 if (!(m = hash_lookup(machines, mach_id)))
2604 sq_save_unique_data(sq1, (void *)mach_id);
2605 else if (!hash_lookup(containers, cnt_id))
2606 sq_save_unique_data(sq2, (void *)cnt_id);
2608 EXEC SQL CLOSE csr_mcntmap;
2609 generic_delete(sq1, show_mcntmap_mach, "mcntmap", "mach_id", 1);
2610 generic_delete(sq2, show_mcntmap_cnt, "mcntmap", "cnt_id", 1);