]> andersk Git - moira.git/blame - dbck/phase2.qc
string check user comments & signature
[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
351 if (f->type == 'N' || f->type == 'R') {
352 if (!hash_lookup(machines, f->mach_id)) {
353 printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
354 if (single_fix("Fix", 0)) {
355## replace filesys (mach_id = 0) where filesys.filsys_id = id
356## inquire_equel(rowcount = "rowcount")
357 if (rowcount > 0)
358 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
359 else
360 printf("Not fixed\n");
8ccfc7d5 361 modified("filesys");
d2543f8c 362 f->mach_id = 0;
363 }
364 }
1c934a31 365 }
366 if (f->type == 'N' || f->type == 'R' || f->type == 'A') {
d2543f8c 367 if (!hash_lookup(users, f->owner)) {
368 printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
369 if (single_fix("Fix", 1)) {
370 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
371 f->owner = 0;
372 }
373 }
374 if (!hash_lookup(lists, f->owners)) {
375 printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
376 if (single_fix("Fix", 1)) {
377 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
378 f->owners = 0;
379 }
380 }
381 }
382
383 if (f->type == 'N') {
384 if (!hash_lookup(nfsphys, f->phys_id)) {
385 m = (struct machine *)hash_lookup(machines, f->mach_id);
386 printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
387 if (single_fix("Fix", 1)) {
388 fnchecklen = 0;
389 hash_step(nfsphys, fsmatch, f);
390 if (fnchecklen != 0) {
391 id1 = f->phys_id;
392 id2 = f->filsys_id;
393 id3 = f->mach_id;
394## replace filesys (phys_id = id1) where filesys.filsys_id = id2
395## inquire_equel(rowcount = "rowcount")
396 if (rowcount > 0)
397 printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
398 else
399 printf("Not fixed\n");
8ccfc7d5 400 modified("filesys");
d2543f8c 401 } else {
402 printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
403 if (single_fix("Create", 0)) {
404 dir = f->dir;
405 id1 = f->phys_id;
406 id2 = f->filsys_id;
407 id3 = f->mach_id;
408 if (set_next_object_id("nfsphys_id", "nfsphys") !=
2ce085d2 409 MR_SUCCESS) {
d2543f8c 410 printf("Unable to assign unique ID\n");
411 return;
412 }
413## retrieve (id1 = values.value)
414## where values.name = "nfsphys_id"
415## inquire_equel(rowcount = "rowcount")
416 if (rowcount != 1) {
417 printf("Unable to retrieve unique ID\n");
418 return;
419 }
420## append nfsphys (nfsphys_id = id1, mach_id = id3,
421## device = "???", #dir = dir, status = 0,
422## allocated = 0, size = 0,
423## modtime = "now", modby = 0,
424## modwith = "dbck")
425## inquire_equel(rowcount = "rowcount")
426 if (rowcount > 0)
427 printf("%d entr%s created\n", rowcount,
428 rowcount==1?"y":"ies");
429 else
430 printf("Not created\n");
8ccfc7d5 431 modified("nfsphys");
d2543f8c 432 n = (struct nfsphys *)malloc(sizeof(struct nfsphys));
1c934a31 433 if (n == NULL)
434 out_of_mem("storing new nfsphys");
d2543f8c 435 strcpy(n->dir, dir);
436 n->mach_id = id3;
437 n->nfsphys_id = id1;
438 n->allocated = 0;
439 n->count = 0;
440 hash_store(nfsphys, id1, n);
441## replace filesys (phys_id = id1)
8ccfc7d5 442## where filesys.filsys_id = id2
d2543f8c 443## inquire_equel(rowcount = "rowcount")
444 if (rowcount > 0)
445 printf("%d filesys entr%s fixed\n", rowcount,
446 rowcount==1?"y":"ies");
447 else
448 printf("Not fixed\n");
8ccfc7d5 449 modified("filesys");
d2543f8c 450 }
451 }
452 }
453 }
454 }
455##}
456
457
458check_nfsphys(id, n, hint)
459int id;
460struct nfsphys *n;
461int hint;
462{
463 if (!hash_lookup(machines, n->mach_id)) {
464 printf("NFSphys %d(%s) on non-existant machine %d\n",
465 id, n->dir, n->mach_id);
466 if (single_fix("Delete", 0))
467 single_delete("nfsphys", "nfsphys_id", id);
468 }
469}
470
6d2387f8 471##show_fsg_missing(id)
472##int id;
473##{
474## int id1, found = 1;
475 struct filesys *f;
476
477## retrieve (id1 = fsgroup.filsys_id) where fsgroup.group_id = id {
478 found = 0;
479 if (f = (struct filesys *) hash_lookup(filesys, id1))
480 printf("Missing fsgroup %d has member filesystem %s\n", id, f->name);
481 else
482 printf("Missing fsgroup %d has member filesystem %d\n", id, id1);
483## }
484 return(found);
485##}
486
487show_fsg_type(f)
488struct filesys *f;
489{
490 char *t;
491
492 switch (f->type) {
493 case 'N':
494 t = "NFS";
495 break;
496 case 'R':
497 t = "RVD";
498 break;
1c934a31 499 case 'A':
500 t = "AFS";
501 break;
6d2387f8 502 case 'E':
503 t = "ERR";
504 break;
505 case 'F':
506 t = "FSGROUP";
507 break;
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);
872 if (f->type != 'F')
873 sq_save_data(sq2, f);
874 if (!hash_lookup(filesys, id2))
875 sq_save_data(sq3, id2);
876## }
877 generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
878 generic_fix(sq2, show_fsg_type, "Change to \"FSTYPE\"", fix_fsg_type, 0);
879 generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
880
23386be8 881 dprintf("Checking quotas...\n");
d2543f8c 882 sq1 = sq_create();
883 sq2 = sq_create();
884 sq3 = sq_create();
23386be8 885 sq4 = sq_create();
886## retrieve (id1 = quota.entity_id, type = quota.#type, id2 = quota.filsys_id,
887## id3 = quota.phys_id, id4 = quota.quota) {
888 if (type[0] == 'U' && id1 != 0 && !hash_lookup(users, id1))
d2543f8c 889 sq_save_data(sq1, id1);
23386be8 890 else if (type[0] == 'G' && !hash_lookup(lists, id1))
891 sq_save_data(sq4, id1);
d2543f8c 892 else if (!(f = (struct filesys *) hash_lookup(filesys, id2)))
893 sq_save_data(sq2, id2);
894 else if (id3 != f->phys_id ||
895 ((n = (struct nfsphys*) hash_lookup(nfsphys, id3)) ==
896 (struct nfsphys *)NULL))
897 sq_save_data(sq3, id2);
898 else
899 n->count += id4;
900## }
901 generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
902 generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
903 generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
23386be8 904 generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1);
d2543f8c 905
906 dprintf("Not checking zephyr.\n");
907
908 dprintf("Checking hostaccess...\n");
909## range of h is hostaccess
910## retrieve (id1 = h.mach_id, type = h.acl_type, id2 = h.acl_id) {
911 strtrim(type);
38e6880d 912 if (!hash_lookup(machines, id1)) {
913 printf("Hostaccess for non-existant host %d\n", id1);
914 printf("Not fixing this error\n");
915 }
916 if (!strcmp(type, "USER") && !hash_lookup(users, id2)) {
917 printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
918 printf("Not fixing this error\n");
919 } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) {
920 printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
921 printf("Not fixing this error\n");
922 }
d2543f8c 923## }
924
1c934a31 925 dprintf("Checking palladium...\n");
926 sq1 = sq_create();
927## range of p is palladium
928## retrieve (id1 = p.mach_id) {
929 if (!hash_lookup(machines, id1)) {
930 sq_save_unique_data(sq1, id1);
931 }
932## }
933 generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
934
935 dprintf("Checking krbmap...\n");
936 sq1 = sq_create();
937 sq2 = sq_create();
938## range of k is krbmap
939## retrieve (id1 = k.users_id, id2 = k.string_id) {
940 if (!hash_lookup(users, id1))
941 sq_save_unique_data(sq1, id1);
942 if (!string_check(id2))
943 sq_save_unique_data(sq2, id2);
944## }
945 generic_delete(sq1, show_krb_usr, "krbmap", "users_id", 1);
946 generic_delete(sq2, show_krb_str, "krbmap", "string_id", 1);
947
d2543f8c 948 dprintf("Checking capacls...\n");
949## retrieve (id1 = capacls.list_id, name = capacls.tag) {
38e6880d 950 if (!hash_lookup(lists, id1)) {
951 printf("Capacl for %s is non-existant list %d\n", name, id1);
952 printf("Not fixing this error\n");
953 }
d2543f8c 954## }
955
956##}
957
This page took 0.205903 seconds and 5 git commands to generate.