X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/d2543f8c583922066a9e589db4662f8147d04a45..67805159a972397342c342ee735c8acd640e1399:/dbck/phase4.qc diff --git a/dbck/phase4.qc b/dbck/phase4.qc index f360ac5f..535a22a3 100644 --- a/dbck/phase4.qc +++ b/dbck/phase4.qc @@ -6,8 +6,11 @@ */ #include +#include #include "dbck.h" +static char phase4_qc_rcsid[] = "$Header$"; + count_boxes(id, u, boxes) int id; @@ -19,9 +22,11 @@ struct hash *boxes; if (u->potype == 'P') { if (i = (int) hash_lookup(boxes, u->pobox_id)) hash_store(boxes, u->pobox_id, i+1); - else + else { printf("User %s(%s) has pobox on non-POP server %d\n", u->fullname, u->login, u->pobox_id); + printf("Not fixing this error\n"); + } } } @@ -30,24 +35,24 @@ struct hash *boxes; ##int id, cnt; struct hash *counts; ##{ -## int newval, rowcount, error; +## int oldval, rowcount; - newval = (int) hash_lookup(counts, id); - if (newval != cnt - 1) { + oldval = (int) hash_lookup(counts, id); + cnt--; + if (oldval != cnt) { printf("Count wrong on POBox machine %s; is %d in db, counted %d\n", ((struct machine *) hash_lookup(machines, id))->name, - newval, cnt - 1); + oldval, cnt); if (single_fix("Update", 1)) { ## range of s is serverhosts -## replace s (value1 = newval) where +## replace s (value1 = cnt) where ## s.service = "POP" and s.mach_id = id -## inquire_equel(rowcount = "rowcount", error = "errorno") - if (error != 0) - printf("Error = %d\n", error); +## inquire_equel(rowcount = "rowcount") if (rowcount > 0) printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies"); else printf("Not fixed\n"); + modified("serverhosts"); } } ##} @@ -71,6 +76,7 @@ struct nfsphys *n; printf("%d entr%s fixed\n", rowcount, rowcount==1?"y":"ies"); else printf("Not fixed\n"); + modified("nfsphys"); } } ##} @@ -114,8 +120,10 @@ count_only_setup() ## retrieve (id = u.users_id, name = u.login, last = u.#last, ## first = u.#first, status = u.#status, buf = u.potype, ## id2 = u.pop_id, id3 = u.box_id) -## where u.potype != "NONE" { +## where u.potype = "POP" { u = (struct user *) malloc(sizeof(struct user)); + if (u == NULL) + out_of_mem("storing users"); strcpy(u->login, strtrim(name)); u->potype = buf[0]; sprintf(buf, "%s, %s", strtrim(last), strtrim(first)); @@ -140,6 +148,8 @@ count_only_setup() ## range of m is machine ## retrieve (id = m.mach_id, name = m.#name) { m = (struct machine *) malloc(sizeof(struct machine)); + if (m == NULL) + out_of_mem("storing machines"); strcpy(m->name, strtrim(name)); m->mach_id = id; hash_store(machines, id, m); @@ -150,6 +160,8 @@ count_only_setup() ## retrieve (id = nfsphys.nfsphys_id, name = nfsphys.dir, ## id2 = nfsphys.mach_id, id3 = nfsphys.allocated) { n = (struct nfsphys *) malloc(sizeof(struct nfsphys)); + if (n == NULL) + out_of_mem("storing nfsphys"); strcpy(n->dir, strtrim(name)); n->mach_id = id2; n->nfsphys_id = id; @@ -159,7 +171,7 @@ count_only_setup() ## } dprintf("Counting quotas...\n"); -## retrieve (id = nfsquota.phys_id, id2 = nfsquota.quota) { +## retrieve (id = quota.phys_id, id2 = quota.quota) { if (n = (struct nfsphys *) hash_lookup(nfsphys, id)) { n->count += id2; }