]>
Commit | Line | Data |
---|---|---|
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> | |
10 | #include <sms.h> | |
11 | #include "dbck.h" | |
12 | ||
8ccfc7d5 | 13 | static char phase2_qc_rcsid[] = "$Header$"; |
14 | ||
15 | ||
d2543f8c | 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"); | |
8ccfc7d5 | 88 | modified("users"); |
d2543f8c | 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"); | |
8ccfc7d5 | 143 | modified("list"); |
d2543f8c | 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"); | |
8ccfc7d5 | 226 | modified("members"); |
d2543f8c | 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"); | |
8ccfc7d5 | 241 | modified("members"); |
d2543f8c | 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"); | |
8ccfc7d5 | 256 | modified("members"); |
d2543f8c | 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"); | |
8ccfc7d5 | 285 | modified("serverhosts"); |
d2543f8c | 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"); | |
8ccfc7d5 | 325 | modified("filesys"); |
d2543f8c | 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"); | |
8ccfc7d5 | 362 | modified("filesys"); |
d2543f8c | 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"); | |
8ccfc7d5 | 393 | modified("nfsphys"); |
d2543f8c | 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) | |
8ccfc7d5 | 402 | ## where filesys.filsys_id = id2 |
d2543f8c | 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"); | |
8ccfc7d5 | 409 | modified("filesys"); |
d2543f8c | 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_quota_nouser(id) | |
432 | ##int id; | |
433 | ##{ | |
434 | ## int id1, found = 1; | |
435 | ||
436 | ## retrieve (id1 = nfsquota.filsys_id) where nfsquota.users_id = id { | |
437 | found = 0; | |
438 | printf("NFSquota on fs %d for non-existant user %d\n", id1, id); | |
439 | ## } | |
440 | return(found); | |
441 | ##} | |
442 | ||
443 | fix_quota_nouser(id) | |
444 | { | |
445 | single_delete("nfsquota", "users_id", id); | |
446 | } | |
447 | ||
448 | ##show_quota_nofs(id) | |
449 | ##int id; | |
450 | ##{ | |
451 | ## int id1, found = 1; | |
452 | struct user *u; | |
453 | ||
454 | ## retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id { | |
455 | u = (struct user *)hash_lookup(users, id1); | |
456 | found = 0; | |
457 | printf("NFSquota for user %s on non-existant filesys %d\n", u->login, id); | |
458 | ## } | |
459 | return(found); | |
460 | ##} | |
461 | ||
462 | fix_quota_nofs(id) | |
463 | { | |
464 | single_delete("nfsquota", "filsys_id", id); | |
465 | } | |
466 | ||
467 | ##show_quota_wrongpid(id) | |
468 | ##int id; | |
469 | ##{ | |
470 | ## int id1, found = 1; | |
471 | struct user *u; | |
472 | struct filesys *f; | |
473 | ||
474 | f = (struct filesys *)hash_lookup(filesys, id); | |
475 | ## retrieve (id1 = nfsquota.users_id) where nfsquota.filsys_id = id { | |
476 | u = (struct user *)hash_lookup(users, id1); | |
477 | found = 0; | |
478 | printf("NFSquota for user %s on filesys %s has wrong phys_id %d\n", | |
479 | u->login, f->name, id); | |
480 | ## } | |
481 | return(found); | |
482 | ##} | |
483 | ||
484 | ##fix_quota_physid(id) | |
485 | ##int id; | |
486 | ##{ | |
487 | ## int rowcount, id1; | |
488 | ||
489 | id1 = ((struct filesys *)hash_lookup(filesys, id))->phys_id; | |
490 | ## replace nfsquota (phys_id = id1) where nfsquota.filsys_id = id and | |
491 | ## nfsquota.phys_id != id1 | |
492 | ## inquire_equel(rowcount = "rowcount") | |
493 | if (rowcount > 0) | |
494 | printf("%d entr%s fixed\n",rowcount, rowcount==1?"y":"ies"); | |
495 | else | |
496 | printf("Not fixed\n"); | |
8ccfc7d5 | 497 | modified("nfsquota"); |
d2543f8c | 498 | ##} |
499 | ||
500 | ||
501 | phase2() | |
502 | ##{ | |
503 | ## int id1, id2, id3, id4, id5; | |
504 | ## char type[9], name[33]; | |
505 | struct save_queue *sq, *sq1, *sq2, *sq3, *sq4; | |
506 | struct filesys *f; | |
507 | struct list *l; | |
508 | struct nfsphys *n; | |
509 | struct machine *m; | |
510 | ||
511 | printf("Phase 2 - Checking references\n"); | |
512 | ||
513 | dprintf("Checking users...\n"); | |
514 | hash_step(users, pobox_check, NULL); | |
515 | ||
516 | dprintf("Checking mcmap...\n"); | |
517 | sq1 = sq_create(); | |
518 | sq2 = sq_create(); | |
519 | ## retrieve (id1 = mcmap.mach_id, id2 = mcmap.clu_id) { | |
520 | if (!(m = (struct machine *)hash_lookup(machines, id1))) | |
521 | sq_save_unique_data(sq1, id1); | |
522 | if (!hash_lookup(clusters, id2)) | |
523 | sq_save_unique_data(sq2, id2); | |
524 | m->clucount++; | |
525 | ## } | |
526 | generic_delete(sq1, show_mcm_mach, "mcmap", "mach_id", 1); | |
527 | generic_delete(sq2, show_mcm_clu, "mcmap", "clu_id", 1); | |
528 | ||
529 | dprintf("Checking service clusters...\n"); | |
530 | sq1 = sq_create(); | |
531 | ## retrieve (id1 = svc.clu_id) { | |
532 | if (!hash_lookup(clusters, id1)) | |
533 | sq_save_unique_data(sq1, id1); | |
534 | ## } | |
535 | generic_delete(sq1, show_svc, "svc", "clu_id", 1); | |
536 | ||
537 | dprintf("Checking lists...\n"); | |
538 | hash_step(lists, list_check, NULL); | |
539 | ||
540 | dprintf("Checking members...\n"); | |
541 | sq1 = sq_create(); | |
542 | sq2 = sq_create(); | |
543 | sq3 = sq_create(); | |
544 | sq4 = sq_create(); | |
545 | ## range of m is members | |
546 | ## retrieve (id1 = m.list_id, type = m.member_type, id2 = m.member_id) { | |
547 | strtrim(type); | |
548 | if ((l = (struct list *) hash_lookup(lists, id1)) == NULL) | |
549 | sq_save_unique_data(sq1, id1); | |
550 | l->members++; | |
551 | if (!strcmp(type, "USER") && !hash_lookup(users, id2)) | |
552 | sq_save_unique_data(sq2, id2); | |
553 | else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) | |
554 | sq_save_unique_data(sq3, id2); | |
555 | else if (!strcmp(type, "STRING") && !string_check(id2)) | |
556 | sq_save_unique_data(sq4, id2); | |
557 | ## } | |
558 | generic_delete(sq1, show_member_list, "members", "list_id", 1); | |
559 | generic_fix(sq2, show_mem_user, "Delete", del_mem_user, 1); | |
560 | generic_fix(sq3, show_mem_list, "Delete", del_mem_list, 1); | |
561 | generic_fix(sq4, show_mem_str, "Delete", del_mem_str, 1); | |
562 | ||
563 | dprintf("Checking servers...\n"); | |
564 | ## range of s is servers | |
565 | ## retrieve (name = s.#name, type = s.acl_type, id1 = s.acl_id) { | |
566 | strtrim(type); | |
38e6880d | 567 | if (!strcmp(type, "USER") && !hash_lookup(users, id1)) { |
568 | printf("Service %s has acl non-existant user %d\n", name, id1); | |
569 | printf("Not fixing this error\n"); | |
570 | } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id1)) { | |
571 | printf("Service %s has acl non-existant list %d\n", name, id1); | |
572 | printf("Not fixing this error\n"); | |
573 | } | |
d2543f8c | 574 | ## } |
575 | ||
576 | dprintf("Checking servershosts...\n"); | |
577 | sq = sq_create(); | |
578 | ## retrieve (id1 = serverhosts.mach_id) { | |
579 | if (!hash_lookup(machines, id1)) | |
580 | sq_save_data(sq, id1); | |
581 | ## } | |
582 | generic_fix(sq, show_sh, "Delete", del_sh_mach, 1); | |
583 | ||
584 | dprintf("Checking nfsphys...\n"); | |
585 | hash_step(nfsphys, check_nfsphys, NULL); | |
586 | ||
587 | dprintf("Checking filesys...\n"); | |
588 | hash_step(filesys, check_fs, NULL); | |
589 | ||
590 | dprintf("Checking nfsquota...\n"); | |
591 | sq1 = sq_create(); | |
592 | sq2 = sq_create(); | |
593 | sq3 = sq_create(); | |
594 | ## retrieve (id1 = nfsquota.users_id, id2 = nfsquota.filsys_id, | |
595 | ## id3 = nfsquota.phys_id, id4 = nfsquota.quota) { | |
596 | if (!hash_lookup(users, id1)) | |
597 | sq_save_data(sq1, id1); | |
598 | else if (!(f = (struct filesys *) hash_lookup(filesys, id2))) | |
599 | sq_save_data(sq2, id2); | |
600 | else if (id3 != f->phys_id || | |
601 | ((n = (struct nfsphys*) hash_lookup(nfsphys, id3)) == | |
602 | (struct nfsphys *)NULL)) | |
603 | sq_save_data(sq3, id2); | |
604 | else | |
605 | n->count += id4; | |
606 | ## } | |
607 | generic_fix(sq1, show_quota_nouser, "Delete", fix_quota_nouser, 1); | |
608 | generic_fix(sq2, show_quota_nofs, "Delete", fix_quota_nofs, 0); | |
609 | generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1); | |
610 | ||
611 | dprintf("Not checking zephyr.\n"); | |
612 | ||
613 | dprintf("Checking hostaccess...\n"); | |
614 | ## range of h is hostaccess | |
615 | ## retrieve (id1 = h.mach_id, type = h.acl_type, id2 = h.acl_id) { | |
616 | strtrim(type); | |
38e6880d | 617 | if (!hash_lookup(machines, id1)) { |
618 | printf("Hostaccess for non-existant host %d\n", id1); | |
619 | printf("Not fixing this error\n"); | |
620 | } | |
621 | if (!strcmp(type, "USER") && !hash_lookup(users, id2)) { | |
622 | printf("Hostaccess for %d is non-existant user %d\n", id1, id2); | |
623 | printf("Not fixing this error\n"); | |
624 | } else if (!strcmp(type, "LIST") && !hash_lookup(lists, id2)) { | |
625 | printf("Hostaccess for %d is non-existant list %d\n", id1, id2); | |
626 | printf("Not fixing this error\n"); | |
627 | } | |
d2543f8c | 628 | ## } |
629 | ||
630 | dprintf("Checking capacls...\n"); | |
631 | ## retrieve (id1 = capacls.list_id, name = capacls.tag) { | |
38e6880d | 632 | if (!hash_lookup(lists, id1)) { |
633 | printf("Capacl for %s is non-existant list %d\n", name, id1); | |
634 | printf("Not fixing this error\n"); | |
635 | } | |
d2543f8c | 636 | ## } |
637 | ||
638 | ##} | |
639 |