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>
12 count_boxes(id, u, boxes)
19 if (u->potype == 'P') {
20 if (i = (int) hash_lookup(boxes, u->pobox_id))
21 hash_store(boxes, u->pobox_id, i+1);
23 printf("User %s(%s) has pobox on non-POP server %d\n",
24 u->fullname, u->login, u->pobox_id);
29 ##check_box_counts(id, cnt, counts)
33 ## int newval, rowcount, error;
35 newval = (int) hash_lookup(counts, id);
36 if (newval != cnt - 1) {
37 printf("Count wrong on POBox machine %s; is %d in db, counted %d\n",
38 ((struct machine *) hash_lookup(machines, id))->name,
40 if (single_fix("Update", 1)) {
41 ## range of s is serverhosts
42 ## replace s (value1 = newval) where
43 ## s.service = "POP" and s.mach_id = id
44 ## inquire_equel(rowcount = "rowcount", error = "errorno")
46 printf("Error = %d\n", error);
48 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
50 printf("Not fixed\n");
56 ##check_nfs_counts(id, n, hint)
63 if (n->allocated != val) {
64 printf("Count wrong on NFSphys %s:%s; is %d in db, counted %d\n",
65 ((struct machine *) hash_lookup(machines, n->mach_id))->name,
66 n->dir, n->allocated, val);
67 if (single_fix("Update", 1)) {
68 ## replace nfsphys (allocated = val) where nfsphys.nfsphys_id = id
69 ## inquire_equel(rowcount = "rowcount")
71 printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies");
73 printf("Not fixed\n");
81 struct hash *boxes, *counts;
84 printf("Phase 4 - Checking counts\n");
86 dprintf("Doing POBoxes...\n");
87 boxes = create_hash(10);
88 counts = create_hash(10);
89 ## retrieve (id = serverhosts.mach_id, cnt = serverhosts.value1)
90 ## where serverhosts.service = "POP" {
91 hash_store(boxes, id, 1);
92 hash_store(counts, id, cnt);
94 hash_step(users, count_boxes, boxes);
95 hash_step(boxes, check_box_counts, counts);
97 dprintf("Doing NFSphys...\n");
98 hash_step(nfsphys, check_nfs_counts, 0);
104 ## int id, status, id2, id3;
105 ## char name[33], last[17], first[17], buf[257];
106 struct save_queue *sq;
111 dprintf("Loading users...\n");
112 users = create_hash(10000);
113 ## range of u is users
114 ## retrieve (id = u.users_id, name = u.login, last = u.#last,
115 ## first = u.#first, status = u.#status, buf = u.potype,
116 ## id2 = u.pop_id, id3 = u.box_id)
117 ## where u.potype != "NONE" {
118 u = (struct user *) malloc(sizeof(struct user));
119 strcpy(u->login, strtrim(name));
121 sprintf(buf, "%s, %s", strtrim(last), strtrim(first));
122 u->fullname = strsave(buf);
135 hash_store(users, id, u);
138 dprintf("Loading machines...\n");
139 machines = create_hash(1000);
140 ## range of m is machine
141 ## retrieve (id = m.mach_id, name = m.#name) {
142 m = (struct machine *) malloc(sizeof(struct machine));
143 strcpy(m->name, strtrim(name));
145 hash_store(machines, id, m);
148 dprintf("Loading nfsphys...\n");
149 nfsphys = create_hash(500);
150 ## retrieve (id = nfsphys.nfsphys_id, name = nfsphys.dir,
151 ## id2 = nfsphys.mach_id, id3 = nfsphys.allocated) {
152 n = (struct nfsphys *) malloc(sizeof(struct nfsphys));
153 strcpy(n->dir, strtrim(name));
158 hash_store(nfsphys, id, n);
161 dprintf("Counting quotas...\n");
162 ## retrieve (id = nfsquota.phys_id, id2 = nfsquota.quota) {
163 if (n = (struct nfsphys *) hash_lookup(nfsphys, id)) {