]> andersk Git - moira.git/blame - dbck/phase2.qc
Used /bin/sh format instead of /bin/csh format, by accident.
[moira.git] / dbck / phase2.qc
CommitLineData
d2543f8c 1/* $Header$
2 *
3 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
5 * <mit-copyright.h>.
6 */
7
8#include <mit-copyright.h>
9#include <stdio.h>
2ce085d2 10#include <moira.h>
d2543f8c 11#include "dbck.h"
12
8ccfc7d5 13static char phase2_qc_rcsid[] = "$Header$";
14
15
d2543f8c 16show_mcm_mach(id)
17int id;
18##{
19## int iid = id, found = 1;
20## char name[33];
21
22## retrieve (name = cluster.#name) where cluster.clu_id = mcmap.clu_id
23## and mcmap.mach_id = iid {
24 strtrim(name);
25 found = 0;
26 printf("Cluster %s, non-existant machine %d in cluster map\n", name, id);
27## }
28 return(found);
29##}
30
31show_mcm_clu(id)
32int id;
33##{
34## int iid = id, found = 1;
35## char name[33];
36
37## retrieve (name = machine.#name) where machine.mach_id = mcmap.mach_id
38## and mcmap.clu_id = iid {
39 strtrim(name);
40 found = 0;
41 printf("Machine %s, non-existant cluster %d in cluster map\n", name, id);
42## }
43 return(found);
44##}
45
46pobox_check(id, u, hint)
47int id;
48struct user *u;
49int hint;
50{
51 switch (u->potype) {
52 case 'P':
53 if (!hash_lookup(machines, u->pobox_id)) {
54 printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
55 u->login, u->fullname, u->pobox_id);
56 if (single_fix("Delete", 0)) {
57 remove_pobox(u->users_id);
58 u->potype = 'N';
59 }
60 }
61 break;
62 case 'S':
63 if (!string_check(u->pobox_id)) {
64 printf("User %s(%s) has P.O.Box with non-existant string %d\n",
65 u->login, u->fullname, u->pobox_id);
66 if (single_fix("Delete", 0)) {
67 remove_pobox(u->users_id);
68 u->potype = 'N';
69 }
70 }
71 break;
72 default:
73 ;
74 }
75}
76
77
78remove_pobox(id)
79int id;
80##{
81## int rowcount, iid = id;
82## replace users (potype = "NONE") where users.users_id = iid
83## inquire_equel(rowcount = "rowcount")
84 if (rowcount > 0)
85 printf("%d entr%s removed\n", rowcount, rowcount==1?"y":"ies");
86 else
87 printf("Not removed\n");
8ccfc7d5 88 modified("users");
d2543f8c 89##}
90
91show_svc(id)
92int id;
93##{
94## int iid = id, found = 1;
95## char label[17], data[33];
96
97## retrieve (label = svc.serv_label, data = svc.serv_cluster)
98## where svc.clu_id = iid {
99 strtrim(label);
100 strtrim(data);
101 found = 0;
102 printf("Cluster data [%s] %s for non-existant cluster %d\n",
103 label, data, id);
104## }
105 return(found);
106##}
107
108list_check(id, l, hint)
109int id;
110struct list *l;
111int hint;
112{
113 switch (l->acl_type) {
114 case 'L':
115 if (!hash_lookup(lists, l->acl_id)) {
116 printf("List %s has bad LIST acl %d\n", l->name, l->acl_id);
117 if (single_fix("Patch", 1)) {
118 fix_list_acl(l->list_id);
119 }
120 }
121 break;
122 case 'U':
123 if (!hash_lookup(users, l->acl_id)) {
124 printf("List %s has bad USER acl %d\n", l->name, l->acl_id);
125 if (single_fix("Patch", 1)) {
126 fix_list_acl(l->list_id);
127 }
128 }
129 break;
130 }
131}
132
133fix_list_acl(id)
134int id;
135##{
136## int rowcount, iid = id;
137## replace list (acl_id = iid, acl_type = "LIST") where list.list_id = iid
138## inquire_equel(rowcount = "rowcount")
139 if (rowcount > 0)
140 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
141 else
142 printf("Not fixed\n");
8ccfc7d5 143 modified("list");
d2543f8c 144##}
145
146
147show_member_list(id)
148int id;
149##{
150## int mid, iid = id, found = 1;
1c934a31 151## char mtype[9], *name = "";
d2543f8c 152
1c934a31 153## retrieve (mtype = imembers.member_type, mid = imembers.member_id)
154## where imembers.list_id = iid and imembers.direct = 1 {
d2543f8c 155 strtrim(mtype);
156 found = 0;
157 if (mtype[0] == 'L')
1c934a31 158 name = ((struct list *) hash_lookup(lists, mid))->name;
d2543f8c 159 else if (mtype[0] == 'U')
1c934a31 160 name = ((struct user *) hash_lookup(users, mid))->login;
161 else if (mtype[0] == 'S' || mtype[0] == 'K')
162 name = ((struct string *) hash_lookup(strings, mid))->name;
d2543f8c 163 printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
164## }
165 return(found);
166##}
167
168show_mem_user(id)
169int id;
170##{
171## int lid, iid = id, found = 1;
172## char name[33];
173
1c934a31 174## retrieve (lid = imembers.list_id)
175## where imembers.member_id = iid and imembers.member_type = "USER" and
176## imembers.direct = 1 {
d2543f8c 177 found = 0;
178 printf("List %s has non-existant user member, id %d\n",
179 ((struct list *)hash_lookup(lists, lid))->name, iid);
180## }
181 return(found);
182##}
183
184show_mem_list(id)
185int id;
186##{
187## int lid, iid = id, found = 1;
188## char name[33];
189
1c934a31 190## retrieve (lid = imembers.list_id)
191## where imembers.member_id = iid and imembers.member_type = "LIST" and
192## imembers.direct = 1 {
d2543f8c 193 found = 0;
194 printf("List %s has non-existant list member, id %d\n",
195 ((struct list *)hash_lookup(lists, lid))->name, iid);
196## }
197 return(found);
198##}
199
200show_mem_str(id)
201int id;
202##{
203## int lid, iid = id, found = 1;
204## char name[33];
205
1c934a31 206## retrieve (lid = imembers.list_id)
207## where imembers.member_id = iid and imembers.member_type = "STRING" and
208## imembers.direct = 1 {
d2543f8c 209 found = 0;
210 printf("List %s has non-existant string member, id %d\n",
211 ((struct list *)hash_lookup(lists, lid))->name, iid);
212## }
213 return(found);
214##}
215
216
1c934a31 217show_mem_krb(id)
218int id;
219##{
220## int lid, iid = id, found = 1;
221## char name[33];
222
223## retrieve (lid = imembers.list_id)
224## where imembers.member_id = iid and imembers.member_type = "KERBEROS" and
225## imembers.direct = 1 {
226 found = 0;
227 printf("List %s has non-existant kerberos member, id %d\n",
228 ((struct list *)hash_lookup(lists, lid))->name, iid);
229## }
230 return(found);
231##}
232
233
d2543f8c 234##del_mem_user(id)
235##int id;
236##{
237## int rowcount;
238
1c934a31 239## delete imembers where imembers.member_type = "USER" and
240## imembers.member_id = id and imembers.direct = 1
d2543f8c 241## inquire_equel(rowcount = "rowcount");
242 if (rowcount > 0)
243 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
244 else
245 printf("Not deleted\n");
1c934a31 246 modified("imembers");
d2543f8c 247##}
248
249##del_mem_list(id)
250##int id;
251##{
252## int rowcount;
253
1c934a31 254## delete imembers where imembers.member_type = "LIST" and
255## imembers.member_id = id and imembers.direct = 1
d2543f8c 256## inquire_equel(rowcount = "rowcount");
257 if (rowcount > 0)
258 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
259 else
260 printf("Not deleted\n");
1c934a31 261 modified("imembers");
d2543f8c 262##}
263
264##del_mem_str(id)
265##int id;
266##{
267## int rowcount;
268
1c934a31 269## delete imembers where imembers.member_type = "STRING" and
270## imembers.member_id = id and imembers.direct = 1
d2543f8c 271## inquire_equel(rowcount = "rowcount");
272 if (rowcount > 0)
273 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
274 else
275 printf("Not deleted\n");
1c934a31 276 modified("imembers");
277##}
278
279
280##del_mem_krb(id)
281##int id;
282##{
283## int rowcount;
284
285## delete imembers where imembers.member_type = "KERBEROS" and
286## imembers.member_id = id and imembers.direct = 1
287## inquire_equel(rowcount = "rowcount");
288 if (rowcount > 0)
289 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
290 else
291 printf("Not deleted\n");
292 modified("imembers");
d2543f8c 293##}
294
295
296##show_sh(id)
297##int id;
298##{
299## char name[33];
300 int found = 1;
301
302## retrieve (name = serverhosts.service) where serverhosts.mach_id = id {
303 found = 0;
304 printf("ServerHost entry for service %s non-existant host %d\n",
305 name, id);
306## }
307 return(found);
308##}
309
310##del_sh_mach(id)
311##int id;
312##{
313## int rowcount;
314
315## delete serverhosts where serverhosts.mach_id = id
316## inquire_equel(rowcount = "rowcount");
317 if (rowcount > 0)
318 printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
319 else
320 printf("Not deleted\n");
8ccfc7d5 321 modified("serverhosts");
d2543f8c 322##}
323
324
325static int fnchecklen;
326
327fsmatch(id, n, f)
328int id;
329struct nfsphys *n;
330struct filesys *f;
331{
332 if (n->mach_id == f->mach_id &&
333 !strncmp(f->dir, n->dir, strlen(n->dir)) &&
334 strlen(n->dir) > fnchecklen) {
335 f->phys_id = id;
336 fnchecklen = strlen(n->dir);
337 }
338}
339
340
341##check_fs(id, f, hint)
342##int id;
343register struct filesys *f;
344int hint;
345##{
346## int id1, id2, id3, rowcount;
347## char *dir;
348 struct nfsphys *n;
349 struct machine *m;
350
75a94e6b 351 if (!hash_lookup(machines, f->mach_id)) {
352 printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
353 if (single_fix("Fix", 0)) {
354## replace filesys (mach_id = 0) where filesys.filsys_id = id
355## inquire_equel(rowcount = "rowcount")
356 if (rowcount > 0)
357 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
358 else
359 printf("Not fixed\n");
360 modified("filesys");
361 f->mach_id = 0;
d2543f8c 362 }
1c934a31 363 }
75a94e6b 364
365 if (!hash_lookup(users, f->owner)) {
366 printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
367 if (single_fix("Fix", 1)) {
368 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
369 f->owner = 0;
d2543f8c 370 }
75a94e6b 371 }
372 if (!hash_lookup(lists, f->owners)) {
373 printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
374 if (single_fix("Fix", 1)) {
375 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
376 f->owners = 0;
d2543f8c 377 }
378 }
379
380 if (f->type == 'N') {
381 if (!hash_lookup(nfsphys, f->phys_id)) {
382 m = (struct machine *)hash_lookup(machines, f->mach_id);
383 printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
384 if (single_fix("Fix", 1)) {
385 fnchecklen = 0;
386 hash_step(nfsphys, fsmatch, f);
387 if (fnchecklen != 0) {
388 id1 = f->phys_id;
389 id2 = f->filsys_id;
390 id3 = f->mach_id;
391## replace filesys (phys_id = id1) where filesys.filsys_id = id2
392## inquire_equel(rowcount = "rowcount")
393 if (rowcount > 0)
394 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
395 else
396 printf("Not fixed\n");
8ccfc7d5 397 modified("filesys");
d2543f8c 398 } else {
399 printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
400 if (single_fix("Create", 0)) {
401 dir = f->dir;
402 id1 = f->phys_id;
403 id2 = f->filsys_id;
404 id3 = f->mach_id;
405 if (set_next_object_id("nfsphys_id", "nfsphys") !=
2ce085d2 406 MR_SUCCESS) {
d2543f8c 407 printf("Unable to assign unique ID\n");
408 return;
409 }
410## retrieve (id1 = values.value)
411## where values.name = "nfsphys_id"
412## inquire_equel(rowcount = "rowcount")
413 if (rowcount != 1) {
414 printf("Unable to retrieve unique ID\n");
415 return;
416 }
417## append nfsphys (nfsphys_id = id1, mach_id = id3,
418## device = "???", #dir = dir, status = 0,
419## allocated = 0, size = 0,
420## modtime = "now", modby = 0,
421## modwith = "dbck")
422## inquire_equel(rowcount = "rowcount")
423 if (rowcount > 0)
424 printf("%d entr%s created\n", rowcount,
425 rowcount==1?"y":"ies");
426 else
427 printf("Not created\n");
8ccfc7d5 428 modified("nfsphys");
d2543f8c 429 n = (struct nfsphys *)malloc(sizeof(struct nfsphys));
1c934a31 430 if (n == NULL)
431 out_of_mem("storing new nfsphys");
d2543f8c 432 strcpy(n->dir, dir);
433 n->mach_id = id3;
434 n->nfsphys_id = id1;
435 n->allocated = 0;
436 n->count = 0;
437 hash_store(nfsphys, id1, n);
438## replace filesys (phys_id = id1)
8ccfc7d5 439## where filesys.filsys_id = id2
d2543f8c 440## inquire_equel(rowcount = "rowcount")
441 if (rowcount > 0)
442 printf("%d filesys entr%s fixed\n", rowcount,
443 rowcount==1?"y":"ies");
444 else
445 printf("Not fixed\n");
8ccfc7d5 446 modified("filesys");
d2543f8c 447 }
448 }
449 }
450 }
451 }
452##}
453
454
455check_nfsphys(id, n, hint)
456int id;
457struct nfsphys *n;
458int hint;
459{
460 if (!hash_lookup(machines, n->mach_id)) {
461 printf("NFSphys %d(%s) on non-existant machine %d\n",
462 id, n->dir, n->mach_id);
463 if (single_fix("Delete", 0))
464 single_delete("nfsphys", "nfsphys_id", id);
465 }
466}
467
6d2387f8 468##show_fsg_missing(id)
469##int id;
470##{
471## int id1, found = 1;
472 struct filesys *f;
473
474## retrieve (id1 = fsgroup.filsys_id) where fsgroup.group_id = id {
475 found = 0;
476 if (f = (struct filesys *) hash_lookup(filesys, id1))
477 printf("Missing fsgroup %d has member filesystem %s\n", id, f->name);
478 else
479 printf("Missing fsgroup %d has member filesystem %d\n", id, id1);
480## }
481 return(found);
482##}
483
484show_fsg_type(f)
485struct filesys *f;
486{
487 char *t;
488
489 switch (f->type) {
490 case 'N':
491 t = "NFS";
492 break;
493 case 'R':
494 t = "RVD";
495 break;
1c934a31 496 case 'A':
497 t = "AFS";
498 break;
6d2387f8 499 case 'E':
500 t = "ERR";
501 break;
502 case 'F':
503 t = "FSGROUP";
504 break;
75a94e6b 505 case 'M':
506 t = "MUL";
507 break;
6d2387f8 508 default:
509 t = "???";
510 }
511 printf("FSGroup %s has type %s instead of FSGROUP\n", f->name, t);
512 return(0);
513}
514
515fix_fsg_type(f)
516struct filesys *f;
517##{
518## int rowcount, id = f->filsys_id;
519
520## replace filesys (type = "FSGROUP") where filesys.filsys_id = id
521## inquire_equel(rowcount = "rowcount")
522 if (rowcount > 0)
523 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
524 else
525 printf("Not fixed\n");
526 modified("filesys");
527##}
528
529##show_fsg_nomember(id)
530##int id;
531##{
532## int id1, found = 1;
533 struct filesys *f;
534
535## retrieve (id1 = fsgroup.group_id) where fsgroup.filsys_id = id {
536 found = 0;
537 if (f = (struct filesys *) hash_lookup(filesys, id1))
538 printf("FSGroup %s has missing member %d\n", f->name, id);
539 else
540 printf("FSGroup %d has missing member %d\n", id1, id);
541## }
542 return(found);
543##}
544
d2543f8c 545##show_quota_nouser(id)
546##int id;
547##{
548## int id1, found = 1;
549
23386be8 550## retrieve (id1 = quota.filsys_id) where quota.entity_id = id and
551## quota.type = "USER" {
d2543f8c 552 found = 0;
23386be8 553 printf("Quota on fs %d for non-existant user %d\n", id1, id);
d2543f8c 554## }
555 return(found);
556##}
557
23386be8 558##show_quota_nolist(id)
559##int id;
560##{
561## int id1, found = 1;
562
563## retrieve (id1 = quota.filsys_id) where quota.entity_id = id and
564## quota.type = "GROUP" {
565 found = 0;
566 printf("Quota on fs %d for non-existant list %d\n", id1, id);
567## }
568 return(found);
569##}
570
571##fix_quota_nouser(id)
572##int id;
573##{
574## int rowcount, id1;
575
576 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
577## delete quota where quota.entity_id = id and quota.type = "USER"
578## inquire_equel(rowcount = "rowcount")
579 if (rowcount > 0)
580 printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
581 else
582 printf("Not deleted\n");
583 modified("quota");
584##}
585
586##fix_quota_nolist(id)
587##int id;
588##{
589## int rowcount, id1;
590
591 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
592## delete quota where quota.entity_id = id and quota.type = "GROUP"
593## inquire_equel(rowcount = "rowcount")
594 if (rowcount > 0)
595 printf("%d entr%s deleted\n",rowcount, rowcount==1?"y":"ies");
596 else
597 printf("Not deleted\n");
598 modified("quota");
599##}
d2543f8c 600
601##show_quota_nofs(id)
602##int id;
603##{
604## int id1, found = 1;
23386be8 605## char type[9];
d2543f8c 606
23386be8 607## retrieve (id1 = quota.entity_id, type = quota.#type)
608## where quota.filsys_id = id {
d2543f8c 609 found = 0;
23386be8 610 printf("Quota for %s %d on non-existant filesys %d\n", type, id1, id);
d2543f8c 611## }
612 return(found);
613##}
614
615fix_quota_nofs(id)
616{
23386be8 617 single_delete("quota", "filsys_id", id);
d2543f8c 618}
619
620##show_quota_wrongpid(id)
621##int id;
622##{
623## int id1, found = 1;
23386be8 624## char type[9];
d2543f8c 625 struct user *u;
626 struct filesys *f;
627
628 f = (struct filesys *)hash_lookup(filesys, id);
23386be8 629## retrieve (id1 = quota.entity_id, type = quota.#type)
630## where quota.filsys_id = id {
d2543f8c 631 found = 0;
23386be8 632 printf("Quota for %s %d on filesys %s has wrong phys_id %d\n",
633 type, id1, f->name, id);
d2543f8c 634## }
635 return(found);
636##}
637
638##fix_quota_physid(id)
639##int id;
640##{
641## int rowcount, id1;
642
643 id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
23386be8 644## replace quota (phys_id = id1) where quota.filsys_id = id and
645## quota.phys_id != id1
d2543f8c 646## inquire_equel(rowcount = "rowcount")
647 if (rowcount > 0)
648 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
649 else
650 printf("Not fixed\n");
23386be8 651 modified("quota");
d2543f8c 652##}
653
c90986aa 654##show_srv_user(id)
655##int id;
656##{
657## char name[33];
658 int found = 1;
659
660## retrieve (name = s.#name) where s.acl_type = "USER" and s.acl_id = id {
661 strtrim(name);
662 printf("Service %s has acl non-existant user %d\n", name, id);
663 found = 0;
664## }
665 return(found);
666##}
667
668##show_srv_list(id)
669##int id;
670##{
671## char name[33];
672 int found = 1;
673
674## retrieve (name = s.#name) where s.acl_type = "LIST" and s.acl_id = id {
675 strtrim(name);
676 printf("Service %s has acl non-existant list %d\n", name, id);
677 found = 0;
678## }
679 return(found);
680##}
681
682##zero_srv_user(id)
683##int id;
684##{
685## int rowcount;
686
687## replace servers (acl_id = 0) where servers.acl_id = id and
688## servers.acl_type = "USER"
689## inquire_equel(rowcount = "rowcount")
690 if (rowcount > 0)
691 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
692 else
693 printf("Not fixed\n");
694 modified("servers");
695##}
696
697##zero_srv_list(id)
698##int id;
699##{
700## int rowcount;
701
702## replace servers (acl_id = 0) where servers.acl_id = id and
703## servers.acl_type = "LIST"
704## inquire_equel(rowcount = "rowcount")
705 if (rowcount > 0)
706 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
707 else
708 printf("Not fixed\n");
709 modified("servers");
710##}
711
712
1c934a31 713##show_krb_usr(id)
714##int id;
715##{
716## int found = 1, id1;
717 struct string *s;
718 char *ss;
719
720## retrieve (id1 = krbmap.string_id) where krbmap.users_id = id {
721 if (s = ((struct string *)hash_lookup(strings, id1)))
722 ss = s->name;
723 else
724 ss = "[unknown]";
725 found = 0;
726 printf("Kerberos map for non-existant user %d to principal %s\n",
727 id, s);
728## }
729 return(found);
730##}
731
732
733##show_krb_str(id)
734##int id;
735##{
736## int found = 1, id1;
737 struct user *u;
738 char *s;
739
740## retrieve (id1 = krbmap.users_id) where krbmap.string_id = id {
741 if (u = ((struct user *)hash_lookup(users, id1)))
742 s = u->login;
743 else
744 s = "[???]";
745 found = 0;
746 printf("Kerberos map for user %s (%d) to non-existant string %d\n",
747 s, id1, id);
748## }
749 return(found);
750##}
751
752
753##show_pdm_mach(id)
754##int id;
755##{
756## char name[33];
757 int found = 1;
758
759## retrieve (name = palladium.#name) where palladium.mach_id = id {
760 strtrim(name);
761 printf("Palladium server/supervisor %s is on non-existant machine %d\n",
762 name, id);
763 found = 0;
764## }
765 return(found);
766##}
767
d2543f8c 768
769phase2()
770##{
771## int id1, id2, id3, id4, id5;
772## char type[9], name[33];
1c934a31 773 struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5;
d2543f8c 774 struct filesys *f;
775 struct list *l;
776 struct nfsphys *n;
777 struct machine *m;
778
779 printf("Phase 2 - Checking references\n");
780
781 dprintf("Checking users...\n");
782 hash_step(users, pobox_check, NULL);
783
784 dprintf("Checking mcmap...\n");
785 sq1 = sq_create();
786 sq2 = sq_create();
787## retrieve (id1 = mcmap.mach_id, id2 = mcmap.clu_id) {
788 if (!(m = (struct machine *)hash_lookup(machines, id1)))
789 sq_save_unique_data(sq1, id1);
790 if (!hash_lookup(clusters, id2))
791 sq_save_unique_data(sq2, id2);
0e37bdb8 792 if (m) m->clucount++;
d2543f8c 793## }
794 generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1);
795 generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1);
796
797 dprintf("Checking service clusters...\n");
798 sq1 = sq_create();
799## retrieve (id1 = svc.clu_id) {
800 if (!hash_lookup(clusters, id1))
801 sq_save_unique_data(sq1, id1);
802## }
803 generic_delete(sq1, show_svc, "svc", "clu_id", 1);
804
805 dprintf("Checking lists...\n");
806 hash_step(lists, list_check, NULL);
807
808 dprintf("Checking members...\n");
809 sq1 = sq_create();
810 sq2 = sq_create();
811 sq3 = sq_create();
812 sq4 = sq_create();
1c934a31 813 sq5 = sq_create();
814## range of m is imembers
815## retrieve (id1 = m.list_id, type = m.member_type, id2 = m.member_id,
816## id3 = m.ref_count, id4 = m.direct) {
d2543f8c 817 if ((l = (struct list *) hash_lookup(lists, id1)) == NULL)
818 sq_save_unique_data(sq1, id1);
1c934a31 819 else if (type[0] == 'U' && !hash_lookup(users, id2))
d2543f8c 820 sq_save_unique_data(sq2, id2);
1c934a31 821 else if (type[0] == 'L' && !hash_lookup(lists, id2))
d2543f8c 822 sq_save_unique_data(sq3, id2);
1c934a31 823 else if (type[0] == 'S' && !string_check(id2))
d2543f8c 824 sq_save_unique_data(sq4, id2);
1c934a31 825 else if (type[0] == 'K' && !string_check(id2))
826 sq_save_unique_data(sq5, id2);
827 else
828 l->members++;
d2543f8c 829## }
273b2786 830 generic_delete(sq1, show_member_list, "imembers", "list_id", 1);
d2543f8c 831 generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1);
832 generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1);
833 generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1);
1c934a31 834 generic_fix(sq5, show_mem_krb, "Delete", del_mem_krb, 1);
d2543f8c 835
836 dprintf("Checking servers...\n");
c90986aa 837 sq1 = sq_create();
838 sq2 = sq_create();
d2543f8c 839## range of s is servers
840## retrieve (name = s.#name, type = s.acl_type, id1 = s.acl_id) {
841 strtrim(type);
38e6880d 842 if (!strcmp(type, "USER") && !hash_lookup(users, id1)) {
c90986aa 843 sq_save_data(sq1, id1);
38e6880d 844 } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1)) {
c90986aa 845 sq_save_data(sq2, id1);
38e6880d 846 }
d2543f8c 847## }
c90986aa 848 generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
849 generic_fix(sq2, show_srv_list, "Fix", zero_srv_list, 1);
d2543f8c 850
851 dprintf("Checking servershosts...\n");
852 sq = sq_create();
853## retrieve (id1 = serverhosts.mach_id) {
854 if (!hash_lookup(machines, id1))
855 sq_save_data(sq, id1);
856## }
c90986aa 857 generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
d2543f8c 858
859 dprintf("Checking nfsphys...\n");
860 hash_step(nfsphys, check_nfsphys, NULL);
861
862 dprintf("Checking filesys...\n");
863 hash_step(filesys, check_fs, NULL);
864
6d2387f8 865 dprintf("Checking filesystem groups...\n");
866 sq1 = sq_create();
867 sq2 = sq_create();
868 sq3 = sq_create();
869## retrieve (id1 = fsgroup.group_id, id2 = fsgroup.filsys_id) {
870 if (!(f = (struct filesys *) hash_lookup(filesys, id1)))
871 sq_save_data(sq1, id1);
6d2387f8 872 if (!hash_lookup(filesys, id2))
873 sq_save_data(sq3, id2);
874## }
875 generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
6d2387f8 876 generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
877
23386be8 878 dprintf("Checking quotas...\n");
d2543f8c 879 sq1 = sq_create();
880 sq2 = sq_create();
881 sq3 = sq_create();
23386be8 882 sq4 = sq_create();
883## retrieve (id1 = quota.entity_id, type = quota.#type, id2 = quota.filsys_id,
884## id3 = quota.phys_id, id4 = quota.quota) {
885 if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
d2543f8c 886 sq_save_data(sq1, id1);
23386be8 887 else if (type[0] == 'G' && !hash_lookup(lists, id1))
888 sq_save_data(sq4, id1);
d2543f8c 889 else if (!(f = (struct filesys *) hash_lookup(filesys, id2)))
890 sq_save_data(sq2, id2);
891 else if (id3 != f->phys_id ||
892 ((n = (struct nfsphys*) hash_lookup(nfsphys, id3)) ==
893 (struct nfsphys *)NULL))
894 sq_save_data(sq3, id2);
895 else
896 n->count += id4;
897## }
898 generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
899 generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
900 generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
23386be8 901 generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
d2543f8c 902
903 dprintf("Not checking zephyr.\n");
904
905 dprintf("Checking hostaccess...\n");
906## range of h is hostaccess
907## retrieve (id1 = h.mach_id, type = h.acl_type, id2 = h.acl_id) {
908 strtrim(type);
38e6880d 909 if (!hash_lookup(machines, id1)) {
910 printf("Hostaccess for non-existant host %d\n", id1);
911 printf("Not fixing this error\n");
912 }
913 if (!strcmp(type, "USER") && !hash_lookup(users, id2)) {
914 printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
915 printf("Not fixing this error\n");
916 } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) {
917 printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
918 printf("Not fixing this error\n");
919 }
d2543f8c 920## }
921
1c934a31 922 dprintf("Checking palladium...\n");
923 sq1 = sq_create();
924## range of p is palladium
925## retrieve (id1 = p.mach_id) {
926 if (!hash_lookup(machines, id1)) {
927 sq_save_unique_data(sq1, id1);
928 }
929## }
930 generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
931
932 dprintf("Checking krbmap...\n");
933 sq1 = sq_create();
934 sq2 = sq_create();
935## range of k is krbmap
936## retrieve (id1 = k.users_id, id2 = k.string_id) {
937 if (!hash_lookup(users, id1))
938 sq_save_unique_data(sq1, id1);
939 if (!string_check(id2))
940 sq_save_unique_data(sq2, id2);
941## }
942 generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
943 generic_delete(sq2, show_krb_str, "krbmap", "string_id", 1);
944
d2543f8c 945 dprintf("Checking capacls...\n");
946## retrieve (id1 = capacls.list_id, name = capacls.tag) {
38e6880d 947 if (!hash_lookup(lists, id1)) {
948 printf("Capacl for %s is non-existant list %d\n", name, id1);
949 printf("Not fixing this error\n");
950 }
d2543f8c 951## }
952
953##}
954
This page took 0.281803 seconds and 5 git commands to generate.