From: danw Date: Thu, 3 Jul 1997 08:58:29 +0000 (+0000) Subject: Check for uniqueness of subnet, filesys, and printer names. (These X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/235fd664da3457a03081ebdeb60919e6f4695140 Check for uniqueness of subnet, filesys, and printer names. (These were listed in the FIXES file, but not implemented.) Document the phase 2 printcap checks in the FIXES file. --- diff --git a/dbck/FIXES b/dbck/FIXES index a470147d..09886abb 100644 --- a/dbck/FIXES +++ b/dbck/FIXES @@ -20,7 +20,7 @@ F* Each hostalias name must be unique F* Each hostalias name must not be the same as any machine name Each snet_id must be unique Alloc new ID -F**Each subnet name must be unique +F* Each subnet name must be unique Each clu_id must be unique Alloc new ID F* Each cluster must have a unique name @@ -29,14 +29,14 @@ F* Each cluster must have a unique name F* Each list must have a unique name Each filsys_id must be unique Alloc new ID -F**Each filesys name must be unique +F* Each filesys name must be unique Each nfsphys_id must be unique Alloc new ID Each string must be unique Delete second copy and remember this for phase 2 Each string_id must be unique Delete all copies -F**Each printer name must be unique +F* Each printer name must be unique *Each palladium id must be unique Alloc new ID F**Each palladium name must be unique @@ -108,6 +108,10 @@ P Every quota's phys_id must match the filesys' phys_id * Every hostaccess must be for a real machine * Every hostaccess USER must exist * Every hostaccess LIST must exist + Every printer must have a real spool machine + Delete the printer + Every printer must have a real quota server + Delete the printer P Every palladium server must be on a real machine Delete the palladium entry P Every user in the krbmap must exist diff --git a/dbck/phase1.pc b/dbck/phase1.pc index c69488bb..f50e3984 100644 --- a/dbck/phase1.pc +++ b/dbck/phase1.pc @@ -101,6 +101,13 @@ struct machine *m; m->mach_id, m->name); } +show_snet_name(s) +struct subnet *s; +{ + printf("Subnet %s (%d) has duplicate name\n", s->name, s->snet_id); + return(0); +} + show_clu_id(c) struct cluster *c; { @@ -155,6 +162,13 @@ struct filesys *f; f->filsys_id, f->name); } +show_fs_name(fs) +struct filesys *fs; +{ + printf("Filesys %s (%d) has duplicate name\n", fs->name, fs->filsys_id); + return(0); +} + show_np_id(n) struct nfsphys *n; @@ -502,6 +516,24 @@ phase1() } EXEC SQL CLOSE csr115; + if (!fast) { + sq = sq_create(); + if(!sq) out_of_mem("looking for duplicate subnet names"); + + EXEC SQL DECLARE csr117 CURSOR FOR + SELECT s1.snet_id FROM subnet s1, subnet s2 + WHERE s1.name = s2.name AND s1.rowid != s2.rowid; + EXEC SQL OPEN csr117; + while(1) { + EXEC SQL FETCH csr117 INTO :id; + if (sqlca.sqlcode != 0) break; + + sq_save_data(sq, hash_lookup(subnets, id)); + } + EXEC SQL CLOSE csr117; + generic_fix(sq, show_snet_name, "Change name", cant_fix, 0); + } + dprintf("Loading clusters...\n"); sq = sq_create(); clusters = create_hash(100); @@ -635,6 +667,24 @@ phase1() generic_fix(sq, show_fs_id, "Change ID", fix_fs_id, 0); + if (!fast) { + sq = sq_create(); + if(!sq) out_of_mem("looking for duplicate filesys names"); + + EXEC SQL DECLARE csr118 CURSOR FOR + SELECT fs1.filsys_id FROM filesys fs1, filesys fs2 + WHERE fs1.label=fs2.label AND fs1.rowid != fs2.rowid; + EXEC SQL OPEN csr118; + while(1) { + EXEC SQL FETCH csr118 INTO :id; + if (sqlca.sqlcode != 0) break; + + sq_save_data(sq, hash_lookup(filesys, id)); + } + EXEC SQL CLOSE csr118; + generic_fix(sq, show_fs_name, "Change name", cant_fix, 0); + } + dprintf("Loading nfsphys...\n"); sq = sq_create(); nfsphys = create_hash(500); @@ -646,7 +696,7 @@ phase1() while(1) { EXEC SQL FETCH csr111 INTO :id, :name, :id2, :id3, :sid; if (sqlca.sqlcode != 0) break; - + n = (struct nfsphys *) malloc(sizeof(struct nfsphys)); if (n == NULL) out_of_mem("storing nfsphys"); @@ -667,6 +717,18 @@ phase1() generic_fix(sq, show_np_id, "Change ID", fix_np_id, 0); - /* csr112 */ - + dprintf("Checking printcap...\n"); + + EXEC SQL DECLARE csr119 CURSOR FOR + SELECT p1.name FROM printcap p1, printcap p2 + WHERE p1.name=p2.name AND p1.rowid