From: danw Date: Tue, 11 Jan 2000 18:04:28 +0000 (+0000) Subject: check that imap poboxes exist, and are of type IMAP. Do nfsphys checks X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/fc6165db82d89d5d82e054fdb97c6e6657b076d0 check that imap poboxes exist, and are of type IMAP. Do nfsphys checks on IMAP filesystems. --- diff --git a/dbck/phase1.pc b/dbck/phase1.pc index 026020ef..38a16a5f 100644 --- a/dbck/phase1.pc +++ b/dbck/phase1.pc @@ -348,7 +348,7 @@ void phase1(void) EXEC SQL DECLARE csr102 CURSOR FOR SELECT users_id, login, last, first, status, potype, pop_id, box_id, - modby, fmodby, pmodby, comments, sigwho FROM users + imap_id, modby, fmodby, pmodby, comments, sigwho FROM users ORDER BY users_id; EXEC SQL OPEN csr102; while (1) @@ -357,13 +357,13 @@ void phase1(void) char login[USERS_LOGIN_SIZE], nbuf[USERS_FIRST_SIZE + USERS_LAST_SIZE]; char last[USERS_LAST_SIZE], first[USERS_FIRST_SIZE]; char potype[USERS_POTYPE_SIZE]; - int users_id, status, pop_id, box_id, modby, fmodby, pmodby; + int users_id, status, pop_id, box_id, imap_id, modby, fmodby, pmodby; int comments, sigwho; EXEC SQL END DECLARE SECTION; EXEC SQL FETCH csr102 INTO :users_id, :login, :last, :first, - :status, :potype, :pop_id, :box_id, :modby, :fmodby, :pmodby, - :comments, :sigwho; + :status, :potype, :pop_id, :box_id, :imap_id, :modby, :fmodby, + :pmodby, :comments, :sigwho; if (sqlca.sqlcode) break; @@ -390,6 +390,9 @@ void phase1(void) /* If potype is SMTP, box_id is a string_id for the strings tbl */ u->pobox_id = box_id; break; + case 'I': + u->pobox_id = imap_id; + break; default: u->pobox_id = 0; } diff --git a/dbck/phase2.pc b/dbck/phase2.pc index da78b03c..89982100 100644 --- a/dbck/phase2.pc +++ b/dbck/phase2.pc @@ -530,6 +530,8 @@ int maybe_fixup_modby2(char *table, char *field, char *rowid, int id) void pobox_check(int id, struct user *u) { + struct filesys *fs; + switch (u->potype) { case 'P': @@ -544,6 +546,7 @@ void pobox_check(int id, struct user *u) } } break; + case 'S': if (hash_lookup(string_dups, u->pobox_id)) { @@ -570,6 +573,31 @@ void pobox_check(int id, struct user *u) } } break; + + case 'I': + fs = hash_lookup(filesys, u->pobox_id); + if (!fs) + { + printf("User %s(%s) has P.O.Box on non-existant filesystem %d\n", + u->login, u->fullname, u->pobox_id); + if (single_fix("Delete", 0)) + { + remove_pobox(u->users_id); + u->potype = 'N'; + } + } + else if (fs->type != 'I') + { + printf("User %s(%s) has IMAP P.O.Box on non-IMAP filesystem %s\n", + u->login, u->fullname, fs->name); + if (single_fix("Delete", 0)) + { + remove_pobox(u->users_id); + u->potype = 'N'; + } + } + break; + default: ; } @@ -1162,7 +1190,7 @@ void check_fs(int id, void *filesys, void *hint) } } - if (f->type == 'N') + if (f->type == 'N' || f->type == 'I') { if (!hash_lookup(nfsphys, f->phys_id)) {