]> andersk Git - moira.git/blob - dbck/phase2.qc
fix a couple of null pointer problems
[moira.git] / dbck / phase2.qc
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>
10 #include <sms.h>
11 #include "dbck.h"
12
13 static char phase2_qc_rcsid[] = "$Header$";
14
15
16 show_mcm_mach(id)
17 int 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
31 show_mcm_clu(id)
32 int 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
46 pobox_check(id, u, hint)
47 int id;
48 struct user *u;
49 int 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
78 remove_pobox(id)
79 int 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");
88     modified("users");
89 ##}
90
91 show_svc(id)
92 int 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
108 list_check(id, l, hint)
109 int id;
110 struct list *l;
111 int 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
133 fix_list_acl(id)
134 int 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");
143     modified("list");
144 ##}
145
146
147 show_member_list(id)
148 int id;
149 ##{
150 ##  int mid, iid = id, found = 1;
151 ##  char mtype[9], *name;
152
153 ##  retrieve (mtype = member.member_type, mid = member.member_id)
154 ##      where member.list_id = iid {
155       strtrim(mtype);
156       found = 0;
157       if (mtype[0] == 'L')
158         strcpy(name, ((struct list *) hash_lookup(lists, mid))->name);
159       else if (mtype[0] == 'U')
160         strcpy(name, ((struct user *) hash_lookup(users, mid))->login);
161       else if (mtype[0] == 'S')
162         strcpy(name, ((struct string *) hash_lookup(strings, mid))->name);
163       printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
164 ##  }
165     return(found);
166 ##}
167
168 show_mem_user(id)
169 int id;
170 ##{
171 ##  int lid, iid = id, found = 1;
172 ##  char name[33];
173
174 ##  retrieve (lid = members.list_id)
175 ##      where members.member_id = iid and members.member_type = "USER" {
176       found = 0;
177       printf("List %s has non-existant user member, id %d\n",
178              ((struct list *)hash_lookup(lists, lid))->name, iid);
179 ##  }
180     return(found);
181 ##}
182
183 show_mem_list(id)
184 int id;
185 ##{
186 ##  int lid, iid = id, found = 1;
187 ##  char name[33];
188
189 ##  retrieve (lid = members.list_id)
190 ##      where members.member_id = iid and members.member_type = "LIST" {
191       found = 0;
192       printf("List %s has non-existant list member, id %d\n",
193              ((struct list *)hash_lookup(lists, lid))->name, iid);
194 ##  }
195     return(found);
196 ##}
197
198 show_mem_str(id)
199 int id;
200 ##{
201 ##  int lid, iid = id, found = 1;
202 ##  char name[33];
203
204 ##  retrieve (lid = members.list_id)
205 ##      where members.member_id = iid and members.member_type = "STRING" {
206       found = 0;
207       printf("List %s has non-existant string member, id %d\n",
208              ((struct list *)hash_lookup(lists, lid))->name, iid);
209 ##  }
210     return(found);
211 ##}
212
213
214 ##del_mem_user(id)
215 ##int id;
216 ##{
217 ##  int rowcount;
218
219 ##  delete members where members.member_type = "USER" and
220 ##      members.member_id = id
221 ##  inquire_equel(rowcount = "rowcount");
222     if (rowcount > 0)
223       printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
224     else
225       printf("Not deleted\n");
226     modified("members");
227 ##}
228
229 ##del_mem_list(id)
230 ##int id;
231 ##{
232 ##  int rowcount;
233
234 ##  delete members where members.member_type = "LIST" and
235 ##      members.member_id = id
236 ##  inquire_equel(rowcount = "rowcount");
237     if (rowcount > 0)
238       printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
239     else
240       printf("Not deleted\n");
241     modified("members");
242 ##}
243
244 ##del_mem_str(id)
245 ##int id;
246 ##{
247 ##  int rowcount;
248
249 ##  delete members where members.member_type = "STRING" and
250 ##      members.member_id = id
251 ##  inquire_equel(rowcount = "rowcount");
252     if (rowcount > 0)
253       printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
254     else
255       printf("Not deleted\n");
256     modified("members");
257 ##}
258
259
260 ##show_sh(id)
261 ##int id;
262 ##{
263 ##  char name[33];
264     int found = 1;
265
266 ##  retrieve (name = serverhosts.service) where serverhosts.mach_id = id {
267       found = 0;
268       printf("ServerHost entry for service %s non-existant host %d\n",
269              name, id);
270 ##  }
271     return(found);
272 ##}
273
274 ##del_sh_mach(id)
275 ##int id;
276 ##{
277 ##  int rowcount;
278
279 ##  delete serverhosts where serverhosts.mach_id = id
280 ##  inquire_equel(rowcount = "rowcount");
281     if (rowcount > 0)
282       printf("%d entr%s deleted\n", rowcount, rowcount==1?"y":"ies");
283     else
284       printf("Not deleted\n");
285     modified("serverhosts");
286 ##}
287
288
289 static int fnchecklen;
290
291 fsmatch(id, n, f)
292 int id;
293 struct nfsphys *n;
294 struct filesys *f;
295 {
296     if (n->mach_id == f->mach_id &&
297         !strncmp(f->dir, n->dir, strlen(n->dir)) &&
298         strlen(n->dir) > fnchecklen) {
299         f->phys_id = id;
300         fnchecklen = strlen(n->dir);
301     }
302 }
303
304
305 ##check_fs(id, f, hint)
306 ##int id;
307 register struct filesys *f;
308 int hint;
309 ##{
310 ##  int id1, id2, id3, rowcount;
311 ##  char *dir;
312     struct nfsphys *n;
313     struct machine *m;
314
315     if (f->type == 'N' || f->type == 'R') {
316         if (!hash_lookup(machines, f->mach_id)) {
317             printf("Filesys %s with bad machine %d\n", f->name, f->mach_id);
318             if (single_fix("Fix", 0)) {
319 ##              replace filesys (mach_id = 0) where filesys.filsys_id = id
320 ##              inquire_equel(rowcount = "rowcount")
321                 if (rowcount > 0)
322                   printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
323                 else
324                   printf("Not fixed\n");
325                 modified("filesys");
326                 f->mach_id = 0;
327             }
328         }
329         if (!hash_lookup(users, f->owner)) {
330             printf("Filesys %s with bad owning user %d\n", f->name, f->owner);
331             if (single_fix("Fix", 1)) {
332                 zero_fix("filesys", "owner", "filsys_id", f->filsys_id);
333                 f->owner = 0;
334             }
335         }
336         if (!hash_lookup(lists, f->owners)) {
337             printf("Filesys %s with bad owning group %d\n", f->name, f->owners);
338             if (single_fix("Fix", 1)) {
339                 zero_fix("filesys", "owners", "filsys_id", f->filsys_id);
340                 f->owners = 0;
341             }
342         }
343     }
344
345     if (f->type == 'N') {
346         if (!hash_lookup(nfsphys, f->phys_id)) {
347             m = (struct machine *)hash_lookup(machines, f->mach_id);
348             printf("Filesys %s with bad phys_id %d\n", f->name, f->phys_id);
349             if (single_fix("Fix", 1)) {
350                 fnchecklen = 0;
351                 hash_step(nfsphys, fsmatch, f);
352                 if (fnchecklen != 0) {
353                   id1 = f->phys_id;
354                   id2 = f->filsys_id;
355                   id3 = f->mach_id;
356 ##                replace filesys (phys_id = id1) where filesys.filsys_id = id2
357 ##                inquire_equel(rowcount = "rowcount")
358                   if (rowcount > 0)
359                     printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
360                   else
361                     printf("Not fixed\n");
362                   modified("filesys");
363                 } else {
364                     printf("No NFSphys exsits for %s:%s\n", m->name, f->dir);
365                     if (single_fix("Create", 0)) {
366                         dir = f->dir;
367                         id1 = f->phys_id;
368                         id2 = f->filsys_id;
369                         id3 = f->mach_id;
370                         if (set_next_object_id("nfsphys_id", "nfsphys") !=
371                                 SMS_SUCCESS) {
372                             printf("Unable to assign unique ID\n");
373                             return;
374                         }
375 ##                      retrieve (id1 = values.value)
376 ##                        where values.name = "nfsphys_id"
377 ##                      inquire_equel(rowcount = "rowcount")
378                         if (rowcount != 1) {
379                             printf("Unable to retrieve unique ID\n");
380                             return;
381                         }
382 ##                      append nfsphys (nfsphys_id = id1, mach_id = id3,
383 ##                                      device = "???", #dir = dir, status = 0,
384 ##                                      allocated = 0, size = 0,
385 ##                                      modtime = "now", modby = 0,
386 ##                                      modwith = "dbck")
387 ##                      inquire_equel(rowcount = "rowcount")
388                         if (rowcount > 0)
389                           printf("%d entr%s created\n", rowcount,
390                                  rowcount==1?"y":"ies");
391                         else
392                           printf("Not created\n");
393                         modified("nfsphys");
394                         n = (struct nfsphys *)malloc(sizeof(struct nfsphys));
395                         strcpy(n->dir, dir);
396                         n->mach_id = id3;
397                         n->nfsphys_id = id1;
398                         n->allocated = 0;
399                         n->count = 0;
400                         hash_store(nfsphys, id1, n);
401 ##                      replace filesys (phys_id = id1)
402 ##                        where filesys.filsys_id = id2
403 ##                      inquire_equel(rowcount = "rowcount")
404                         if (rowcount > 0)
405                           printf("%d filesys entr%s fixed\n", rowcount,
406                                  rowcount==1?"y":"ies");
407                         else
408                           printf("Not fixed\n");
409                         modified("filesys");
410                     }
411                 }
412             }
413         }
414     }
415 ##}
416
417
418 check_nfsphys(id, n, hint)
419 int id;
420 struct nfsphys *n;
421 int hint;
422 {
423     if (!hash_lookup(machines, n->mach_id)) {
424         printf("NFSphys %d(%s) on non-existant machine %d\n",
425                id, n->dir, n->mach_id);
426         if (single_fix("Delete", 0))
427           single_delete("nfsphys", "nfsphys_id", id);
428     }
429 }
430
431 ##show_fsg_missing(id)
432 ##int id;
433 ##{
434 ##  int id1, found = 1;
435     struct filesys *f;
436
437 ##  retrieve (id1 = fsgroup.filsys_id) where fsgroup.group_id = id {
438       found = 0;
439       if (f = (struct filesys *) hash_lookup(filesys, id1))
440         printf("Missing fsgroup %d has member filesystem %s\n", id, f->name);
441       else
442         printf("Missing fsgroup %d has member filesystem %d\n", id, id1);
443 ##  }
444     return(found);
445 ##}
446
447 show_fsg_type(f)
448 struct filesys *f;
449 {
450     char *t;
451
452     switch (f->type) {
453     case 'N':
454         t = "NFS";
455         break;
456     case 'R':
457         t = "RVD";
458         break;
459     case 'E':
460         t = "ERR";
461         break;
462     case 'F':
463         t = "FSGROUP";
464         break;
465     default:
466         t = "???";
467     }
468     printf("FSGroup %s has type %s instead of FSGROUP\n", f->name, t);
469     return(0);
470 }
471
472 fix_fsg_type(f)
473 struct filesys *f;
474 ##{
475 ##  int rowcount, id = f->filsys_id;
476
477 ##  replace filesys (type = "FSGROUP") where filesys.filsys_id = id
478 ##  inquire_equel(rowcount = "rowcount")
479     if (rowcount > 0)
480       printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
481     else
482       printf("Not fixed\n");
483     modified("filesys");
484 ##}
485
486 ##show_fsg_nomember(id)
487 ##int id;
488 ##{
489 ##  int id1, found = 1;
490     struct filesys *f;
491
492 ##  retrieve (id1 = fsgroup.group_id) where fsgroup.filsys_id = id {
493       found = 0;
494       if (f = (struct filesys *) hash_lookup(filesys, id1))
495         printf("FSGroup %s has missing member %d\n", f->name, id);
496       else
497         printf("FSGroup %d has missing member %d\n", id1, id);
498 ##  }
499     return(found);
500 ##}
501
502 ##show_quota_nouser(id)
503 ##int id;
504 ##{
505 ##  int id1, found = 1;
506
507 ##  retrieve (id1 = nfsquota.filsys_id) where nfsquota.users_id = id {
508       found = 0;
509       printf("NFSquota on fs %d for non-existant user %d\n", id1, id);
510 ##  }
511     return(found);
512 ##}
513
514 fix_quota_nouser(id)
515 {
516     single_delete("nfsquota", "users_id", id);
517 }
518
519 ##show_quota_nofs(id)
520 ##int id;
521 ##{
522 ##  int id1, found = 1;
523     struct user *u;
524
525 ##  retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id {
526       u = (struct user *)hash_lookup(users, id1);
527       found = 0;
528       printf("NFSquota for user %s on non-existant filesys %d\n", u->login, id);
529 ##  }
530     return(found);
531 ##}
532
533 fix_quota_nofs(id)
534 {
535     single_delete("nfsquota", "filsys_id", id);
536 }
537
538 ##show_quota_wrongpid(id)
539 ##int id;
540 ##{
541 ##  int id1, found = 1;
542     struct user *u;
543     struct filesys *f;
544
545     f = (struct filesys *)hash_lookup(filesys, id);
546 ##  retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id {
547       u = (struct user *)hash_lookup(users, id1);
548       found = 0;
549       printf("NFSquota for user %s on filesys %s has wrong phys_id %d\n",
550              u->login, f->name, id);
551 ##  }
552     return(found);
553 ##}
554
555 ##fix_quota_physid(id)
556 ##int id;
557 ##{
558 ##  int rowcount, id1;
559
560     id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id;
561 ##  replace nfsquota (phys_id = id1) where nfsquota.filsys_id = id and
562 ##      nfsquota.phys_id != id1 
563 ##  inquire_equel(rowcount = "rowcount")
564     if (rowcount > 0)
565       printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies");
566     else
567       printf("Not fixed\n");
568     modified("nfsquota");
569 ##}
570
571 ##show_srv_user(id)
572 ##int id;
573 ##{
574 ##  char name[33];
575     int found = 1;
576
577 ##  retrieve (name = s.#name) where s.acl_type = "USER" and s.acl_id = id {
578         strtrim(name);
579         printf("Service %s has acl non-existant user %d\n", name, id);
580         found = 0;
581 ##  }
582     return(found);
583 ##}
584
585 ##show_srv_list(id)
586 ##int id;
587 ##{
588 ##  char name[33];
589     int found = 1;
590
591 ##  retrieve (name = s.#name) where s.acl_type = "LIST" and s.acl_id = id {
592         strtrim(name);
593         printf("Service %s has acl non-existant list %d\n", name, id);
594         found = 0;
595 ##  }
596     return(found);
597 ##}
598
599 ##zero_srv_user(id)
600 ##int id;
601 ##{
602 ##  int rowcount;
603
604 ##  replace servers (acl_id = 0) where servers.acl_id = id and
605 ##      servers.acl_type = "USER"
606 ##  inquire_equel(rowcount = "rowcount")
607     if (rowcount > 0)
608       printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
609     else
610       printf("Not fixed\n");
611     modified("servers");
612 ##}
613
614 ##zero_srv_list(id)
615 ##int id;
616 ##{
617 ##  int rowcount;
618
619 ##  replace servers (acl_id = 0) where servers.acl_id = id and
620 ##      servers.acl_type = "LIST"
621 ##  inquire_equel(rowcount = "rowcount")
622     if (rowcount > 0)
623       printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
624     else
625       printf("Not fixed\n");
626     modified("servers");
627 ##}
628
629
630
631 phase2()
632 ##{
633 ##  int id1, id2, id3, id4, id5;
634 ##  char type[9], name[33];
635     struct save_queue *sq, *sq1, *sq2, *sq3, *sq4;
636     struct filesys *f;
637     struct list *l;
638     struct nfsphys *n;
639     struct machine *m;
640
641     printf("Phase 2 - Checking references\n");
642
643     dprintf("Checking users...\n");
644     hash_step(users, pobox_check, NULL);
645
646     dprintf("Checking mcmap...\n");
647     sq1 = sq_create();
648     sq2 = sq_create();
649 ##  retrieve (id1 = mcmap.mach_id, id2 = mcmap.clu_id) {
650         if (!(m = (struct machine *)hash_lookup(machines, id1)))
651           sq_save_unique_data(sq1, id1);
652         if (!hash_lookup(clusters, id2))
653           sq_save_unique_data(sq2, id2);
654         if (m) m->clucount++;
655 ##  }
656     generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1);
657     generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1);
658
659     dprintf("Checking service clusters...\n");
660     sq1 = sq_create();
661 ##  retrieve (id1 = svc.clu_id) {
662         if (!hash_lookup(clusters, id1))
663           sq_save_unique_data(sq1, id1);
664 ##  }
665     generic_delete(sq1, show_svc, "svc", "clu_id", 1);
666
667     dprintf("Checking lists...\n");
668     hash_step(lists, list_check, NULL);
669
670     dprintf("Checking members...\n");
671     sq1 = sq_create();
672     sq2 = sq_create();
673     sq3 = sq_create();
674     sq4 = sq_create();
675 ##  range of m is members
676 ##  retrieve (id1 = m.list_id, type = m.member_type, id2 = m.member_id) {
677         strtrim(type);
678         if ((l = (struct list *) hash_lookup(lists, id1)) == NULL)
679           sq_save_unique_data(sq1, id1);
680         else
681           l->members++;
682         if (!strcmp(type, "USER") && !hash_lookup(users, id2))
683           sq_save_unique_data(sq2, id2);
684         else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2))
685           sq_save_unique_data(sq3, id2);
686         else if (!strcmp(type, "STRING") && !string_check(id2))
687           sq_save_unique_data(sq4, id2);
688 ##  }
689     generic_delete(sq1, show_member_list, "members", "list_id", 1);
690     generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1);
691     generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1);
692     generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1);
693
694     dprintf("Checking servers...\n");
695     sq1 = sq_create();
696     sq2 = sq_create();
697 ##  range of s is servers
698 ##  retrieve (name = s.#name, type = s.acl_type, id1 = s.acl_id) {
699         strtrim(type);
700         if (!strcmp(type, "USER") && !hash_lookup(users, id1)) {
701             sq_save_data(sq1, id1);
702         } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1)) {
703             sq_save_data(sq2, id1);
704         }
705 ##  }
706     generic_fix(sq1, show_srv_user, "Fix", zero_srv_user, 1);
707     generic_fix(sq2, show_srv_list, "Fix", zero_srv_list, 1);
708
709     dprintf("Checking servershosts...\n");
710     sq = sq_create();
711 ##  retrieve (id1 = serverhosts.mach_id) {
712         if (!hash_lookup(machines, id1))
713           sq_save_data(sq, id1);
714 ##  }
715     generic_fix(sq, show_sh, "Delete", del_sh_mach, 0);
716
717     dprintf("Checking nfsphys...\n");
718     hash_step(nfsphys, check_nfsphys, NULL);
719
720     dprintf("Checking filesys...\n");
721     hash_step(filesys, check_fs, NULL);
722
723     dprintf("Checking filesystem groups...\n");
724     sq1 = sq_create();
725     sq2 = sq_create();
726     sq3 = sq_create();
727 ##  retrieve (id1 = fsgroup.group_id, id2 = fsgroup.filsys_id) {
728         if (!(f = (struct filesys *) hash_lookup(filesys, id1)))
729           sq_save_data(sq1, id1);
730         if (f->type  != 'F')
731           sq_save_data(sq2, f);
732         if (!hash_lookup(filesys, id2))
733           sq_save_data(sq3, id2);
734 ##  }
735     generic_delete(sq1, show_fsg_missing, "fsgroup", "group_id", 0);
736     generic_fix(sq2, show_fsg_type, "Change to \"FSTYPE\"", fix_fsg_type, 0);
737     generic_delete(sq3, show_fsg_nomember, "fsgroup", "filsys_id", 1);
738
739     dprintf("Checking nfsquota...\n");
740     sq1 = sq_create();
741     sq2 = sq_create();
742     sq3 = sq_create();
743 ##  retrieve (id1 = nfsquota.users_id, id2 = nfsquota.filsys_id,
744 ##            id3 = nfsquota.phys_id, id4 = nfsquota.quota) {
745         if (!hash_lookup(users, id1))
746           sq_save_data(sq1, id1);
747         else if (!(f = (struct filesys *) hash_lookup(filesys, id2)))
748           sq_save_data(sq2, id2);
749         else if (id3 != f->phys_id ||
750             ((n = (struct nfsphys*) hash_lookup(nfsphys, id3)) ==
751             (struct nfsphys *)NULL))
752           sq_save_data(sq3, id2);
753         else
754           n->count += id4;
755 ##  }
756     generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1);
757     generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0);
758     generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1);
759
760     dprintf("Not checking zephyr.\n");
761
762     dprintf("Checking hostaccess...\n");
763 ##  range of h is hostaccess
764 ##  retrieve (id1 = h.mach_id, type = h.acl_type, id2 = h.acl_id) {
765         strtrim(type);
766         if (!hash_lookup(machines, id1)) {
767             printf("Hostaccess for non-existant host %d\n", id1);
768             printf("Not fixing this error\n");
769         }
770         if (!strcmp(type, "USER") && !hash_lookup(users, id2)) {
771             printf("Hostaccess for %d is non-existant user %d\n", id1, id2);
772             printf("Not fixing this error\n");
773         } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) {
774             printf("Hostaccess for %d is non-existant list %d\n", id1, id2);
775             printf("Not fixing this error\n");
776         }
777 ##  }
778
779     dprintf("Checking capacls...\n");
780 ##  retrieve (id1 = capacls.list_id, name = capacls.tag) {
781         if (!hash_lookup(lists, id1)) {
782             printf("Capacl for %s is non-existant list %d\n", name, id1);
783             printf("Not fixing this error\n");
784         }
785 ##  }
786
787 ##}
788
This page took 0.10701 seconds and 5 git commands to generate.