3 * (c) Copyright 1988 by the Massachusetts Institute of Technology.
4 * For copying and distribution information, please see the file
8 #include <mit-copyright.h>
11 static char phase4_qc_rcsid[] = "$Header$";
14 count_boxes(id, u, boxes)
21 if (u->potype == 'P') {
22 if (i = (int) hash_lookup(boxes, u->pobox_id))
23 hash_store(boxes, u->pobox_id, i+1);
25 printf("User %s(%s) has pobox on non-POP server %d\n",
26 u->fullname, u->login, u->pobox_id);
31 ##check_box_counts(id, cnt, counts)
35 ## int oldval, rowcount;
37 oldval = (int) hash_lookup(counts, id);
40 printf("Count wrong on POBox machine %s; is %d in db, counted %d\n",
41 ((struct machine *) hash_lookup(machines, id))->name,
43 if (single_fix("Update", 1)) {
44 ## range of s is serverhosts
45 ## replace s (value1 = cnt) where
46 ## s.service = "POP" and s.mach_id = id
47 ## inquire_equel(rowcount = "rowcount")
49 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
51 printf("Not fixed\n");
52 modified("serverhosts");
58 ##check_nfs_counts(id, n, hint)
65 if (n->allocated != val) {
66 printf("Count wrong on NFSphys %s:%s; is %d in db, counted %d\n",
67 ((struct machine *) hash_lookup(machines, n->mach_id))->name,
68 n->dir, n->allocated, val);
69 if (single_fix("Update", 1)) {
70 ## replace nfsphys (allocated = val) where nfsphys.nfsphys_id = id
71 ## inquire_equel(rowcount = "rowcount")
73 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
75 printf("Not fixed\n");
84 struct hash *boxes, *counts;
87 printf("Phase 4 - Checking counts\n");
89 dprintf("Doing POBoxes...\n");
90 boxes = create_hash(10);
91 counts = create_hash(10);
92 ## retrieve (id = serverhosts.mach_id, cnt = serverhosts.value1)
93 ## where serverhosts.service = "POP" {
94 hash_store(boxes, id, 1);
95 hash_store(counts, id, cnt);
97 hash_step(users, count_boxes, boxes);
98 hash_step(boxes, check_box_counts, counts);
100 dprintf("Doing NFSphys...\n");
101 hash_step(nfsphys, check_nfs_counts, 0);
107 ## int id, status, id2, id3;
108 ## char name[33], last[17], first[17], buf[257];
109 struct save_queue *sq;
114 dprintf("Loading users...\n");
115 users = create_hash(10000);
116 ## range of u is users
117 ## retrieve (id = u.users_id, name = u.login, last = u.#last,
118 ## first = u.#first, status = u.#status, buf = u.potype,
119 ## id2 = u.pop_id, id3 = u.box_id)
120 ## where u.potype = "POP" {
121 u = (struct user *) malloc(sizeof(struct user));
122 strcpy(u->login, strtrim(name));
124 sprintf(buf, "%s, %s", strtrim(last), strtrim(first));
125 u->fullname = strsave(buf);
138 hash_store(users, id, u);
141 dprintf("Loading machines...\n");
142 machines = create_hash(1000);
143 ## range of m is machine
144 ## retrieve (id = m.mach_id, name = m.#name) {
145 m = (struct machine *) malloc(sizeof(struct machine));
146 strcpy(m->name, strtrim(name));
148 hash_store(machines, id, m);
151 dprintf("Loading nfsphys...\n");
152 nfsphys = create_hash(500);
153 ## retrieve (id = nfsphys.nfsphys_id, name = nfsphys.dir,
154 ## id2 = nfsphys.mach_id, id3 = nfsphys.allocated) {
155 n = (struct nfsphys *) malloc(sizeof(struct nfsphys));
156 strcpy(n->dir, strtrim(name));
161 hash_store(nfsphys, id, n);
164 dprintf("Counting quotas...\n");
165 ## retrieve (id = nfsquota.phys_id, id2 = nfsquota.quota) {
166 if (n = (struct nfsphys *) hash_lookup(nfsphys, id)) {