int show_mcm_mach(void *id);
int show_mcm_clu(void *id);
int show_hostalias(void *id);
-int show_pcap_mach(void *id);
-int show_pcap_quota(void *id);
+int show_printer_mach(void *id);
+int show_printer_loghost(void *id);
+int show_printer_spool(void *id);
+int show_printer_quota(void *id);
+int show_printer_ac(void *id);
+int show_printer_lpc_acl(void *id);
+void fix_printer_ac(void *id);
+void fix_printer_lpc_acl(void *id);
void user_check(int id, void *user, void *hint);
int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
char *field, char *idfield);
return found;
}
-int show_pcap_mach(void *id)
+int show_printer_mach(void *id)
{
EXEC SQL BEGIN DECLARE SECTION;
int iid = (int)id, found = 1;
- char name[PRINTCAP_NAME_SIZE];
+ char name[PRINTERS_NAME_SIZE];
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE csr235 CURSOR FOR
- SELECT name FROM printcap WHERE mach_id = :iid;
+ SELECT name FROM printers WHERE mach_id = :iid;
EXEC SQL OPEN csr235;
while (1)
{
strtrim(name);
found = 0;
- printf("Printer %s, non-existant spool machine %d in printcap table\n",
+ printf("Printer %s, non-existant machine %d in printers table\n",
name, iid);
}
EXEC SQL CLOSE csr235;
return found;
}
-int show_pcap_quota(void *id)
+int show_printer_loghost(void *id)
{
EXEC SQL BEGIN DECLARE SECTION;
int iid = (int)id, found = 1;
- char name[PRINTCAP_NAME_SIZE];
+ char name[PRINTERS_NAME_SIZE];
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE csr236 CURSOR FOR
- SELECT name FROM printcap WHERE quotaserver = :iid;
+ SELECT name FROM printers WHERE loghost = :iid;
EXEC SQL OPEN csr236;
while (1)
{
strtrim(name);
found = 0;
- printf("Printer %s, non-existant quota server %d in printcap table\n",
+ printf("Printer %s, non-existant spool machine %d in printers table\n",
name, iid);
}
EXEC SQL CLOSE csr236;
return found;
}
+int show_printer_spool(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int iid = (int)id, found = 1;
+ char name[PRINTERS_NAME_SIZE];
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL DECLARE csr237 CURSOR FOR
+ SELECT name FROM printers WHERE rm = :iid;
+ EXEC SQL OPEN csr237;
+ while (1)
+ {
+ EXEC SQL FETCH csr237 INTO :name;
+ if (sqlca.sqlcode)
+ break;
+
+ strtrim(name);
+
+ found = 0;
+ printf("Printer %s, non-existant spool machine %d in printers table\n",
+ name, iid);
+ }
+ EXEC SQL CLOSE csr237;
+ return found;
+}
+
+int show_printer_quota(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int iid = (int)id, found = 1;
+ char name[PRINTERS_NAME_SIZE];
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL DECLARE csr238 CURSOR FOR
+ SELECT name FROM printers WHERE rq = :iid;
+ EXEC SQL OPEN csr238;
+ while (1)
+ {
+ EXEC SQL FETCH csr238 INTO :name;
+ if (sqlca.sqlcode)
+ break;
+
+ strtrim(name);
+
+ found = 0;
+ printf("Printer %s, non-existant quota server %d in printers table\n",
+ name, iid);
+ }
+ EXEC SQL CLOSE csr238;
+ return found;
+}
+
+int show_printer_ac(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int iid = (int)id, found = 1;
+ char name[PRINTERS_NAME_SIZE];
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL DECLARE csr239 CURSOR FOR
+ SELECT name FROM printers WHERE ac = :iid;
+ EXEC SQL OPEN csr239;
+ while (1)
+ {
+ EXEC SQL FETCH csr239 INTO :name;
+ if (sqlca.sqlcode)
+ break;
+
+ strtrim(name);
+
+ found = 0;
+ printf("Printer %s, non-existant restrict list %d in printers table\n",
+ name, iid);
+ }
+ EXEC SQL CLOSE csr239;
+ return found;
+}
+
+int show_printer_lpc_acl(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int iid = (int)id, found = 1;
+ char name[PRINTERS_NAME_SIZE];
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL DECLARE csr240 CURSOR FOR
+ SELECT name FROM printers WHERE lpc_acl = :iid;
+ EXEC SQL OPEN csr240;
+ while (1)
+ {
+ EXEC SQL FETCH csr240 INTO :name;
+ if (sqlca.sqlcode)
+ break;
+
+ strtrim(name);
+
+ found = 0;
+ printf("Printer %s, non-existant lpc ACL %d in printers table\n",
+ name, iid);
+ }
+ EXEC SQL CLOSE csr240;
+ return found;
+}
+
+void fix_printer_ac(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int rowcount, iid = (int)id;
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL UPDATE printers SET ac = 0 WHERE ac = :iid;
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+ else
+ printf("Not fixed\n");
+ modified("printers");
+}
+
+void fix_printer_lpc_acl(void *id)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int rowcount, iid = (int)id;
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL UPDATE printers SET lpc_acl = 0 WHERE lpc_acl = :iid;
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+ else
+ printf("Not fixed\n");
+ modified("printers");
+}
+
void user_check(int id, void *user, void *hint)
{
struct user *u = user;
{
EXEC SQL BEGIN DECLARE SECTION;
int mid, iid = (int)id, found = 1;
- char mtype[IMEMBERS_MEMBER_TYPE_SIZE], *name = "";
+ char mtype[IMEMBERS_MEMBER_TYPE_SIZE], *name = NULL;
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE csr204 CURSOR FOR
SELECT member_type, member_id FROM imembers
- WHERE list_id = :iid AND direct = 1;
+ WHERE list_id = :iid;
EXEC SQL OPEN csr204;
while (1)
{
strtrim(mtype);
found = 0;
if (mtype[0] == 'L')
- name = ((struct list *) hash_lookup(lists, mid))->name;
+ {
+ struct list *l = hash_lookup(lists, mid);
+ if (l)
+ name = l->name;
+ }
else if (mtype[0] == 'U')
- name = ((struct user *) hash_lookup(users, mid))->login;
+ {
+ struct user *u = hash_lookup(users, mid);
+ if (u)
+ name = u->login;
+ }
else if (mtype[0] == 'S' || mtype[0] == 'K')
- name = ((struct string *) hash_lookup(strings, mid))->name;
- printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
+ {
+ struct string *s = hash_lookup(strings, mid);
+ if (s)
+ name = s->name;
+ }
+ if (name)
+ printf("Non-existant list %d has member %s %s\n", iid, mtype, name);
+ else
+ {
+ printf("Non-existant list %d has non-existent member %s %d\n",
+ iid, mtype, mid);
+ }
}
EXEC SQL CLOSE csr204;
return found;
EXEC SQL BEGIN DECLARE SECTION;
int lid, iid = (int)id, found = 1;
EXEC SQL END DECLARE SECTION;
+ struct list *l;
EXEC SQL DECLARE csr205 CURSOR FOR
SELECT list_id FROM imembers
- WHERE member_id = :iid AND member_type = 'USER' AND direct = 1;
+ WHERE member_id = :iid AND member_type = 'USER';
EXEC SQL OPEN csr205;
while (1)
{
EXEC SQL FETCH csr205 INTO :lid;
if (sqlca.sqlcode)
break;
+ l = hash_lookup(lists, lid);
+ if (!l)
+ continue;
found = 0;
- printf("List %s has non-existant user member, id %d\n",
- ((struct list *)hash_lookup(lists, lid))->name, iid);
+ printf("List %s has non-existant user member, id %d\n", l->name, iid);
}
EXEC SQL CLOSE csr205;
return found;
EXEC SQL BEGIN DECLARE SECTION;
int lid, iid = (int)id, found = 1;
EXEC SQL END DECLARE SECTION;
+ struct list *l;
EXEC SQL DECLARE csr206 CURSOR FOR
SELECT list_id FROM imembers
- WHERE member_id = :iid AND member_type = 'LIST' AND direct = 1;
+ WHERE member_id = :iid AND member_type = 'LIST';
EXEC SQL OPEN csr206;
while (1)
{
EXEC SQL FETCH csr206 INTO :lid;
if (sqlca.sqlcode)
break;
+ l = hash_lookup(lists, lid);
+ if (!l)
+ continue;
found = 0;
- printf("List %s has non-existant list member, id %d\n",
- ((struct list *)hash_lookup(lists, lid))->name, iid);
+ printf("List %s has non-existant list member, id %d\n", l->name, iid);
}
EXEC SQL CLOSE csr206;
return found;
EXEC SQL BEGIN DECLARE SECTION;
int lid, iid = (int)id, found = 1;
EXEC SQL END DECLARE SECTION;
+ struct list *l;
EXEC SQL DECLARE csr207 CURSOR FOR
SELECT list_id FROM imembers
- WHERE member_id = :iid AND member_type = 'STRING' AND direct = 1;
+ WHERE member_id = :iid AND member_type = 'STRING';
EXEC SQL OPEN csr207;
while (1)
{
EXEC SQL FETCH csr207 INTO :lid;
if (sqlca.sqlcode)
break;
+ l = hash_lookup(lists, lid);
+ if (!l)
+ continue;
found = 0;
- printf("List %s has non-existant string member, id %d\n",
- ((struct list *)hash_lookup(lists, lid))->name, iid);
+ printf("List %s has non-existant string member, id %d\n", l->name, iid);
}
EXEC SQL CLOSE csr207;
return found;
EXEC SQL BEGIN DECLARE SECTION;
int lid, iid = (int)id, found = 1;
EXEC SQL END DECLARE SECTION;
+ struct list *l;
EXEC SQL DECLARE csr208 CURSOR FOR
SELECT list_id FROM imembers
- WHERE member_id = :iid AND member_type = 'KERBEROS' AND direct = 1;
+ WHERE member_id = :iid AND member_type = 'KERBEROS';
EXEC SQL OPEN csr208;
while (1)
{
EXEC SQL FETCH csr208 INTO :lid;
if (sqlca.sqlcode)
break;
+ l = hash_lookup(lists, lid);
+ if (!l)
+ continue;
found = 0;
printf("List %s has non-existant kerberos member, id %d\n",
- ((struct list *)hash_lookup(lists, lid))->name, iid);
+ l->name, iid);
}
EXEC SQL CLOSE csr208;
return found;
EXEC SQL END DECLARE SECTION;
EXEC SQL DELETE FROM imembers WHERE member_type = 'USER' AND
- member_id = :iid AND direct = 1;
+ member_id = :iid;
rowcount = sqlca.sqlerrd[2];
if (rowcount > 0)
printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
EXEC SQL END DECLARE SECTION;
EXEC SQL DELETE FROM imembers WHERE member_type = 'LIST' AND
- member_id = :iid AND direct = 1;
+ member_id = :iid;
rowcount = sqlca.sqlerrd[2];
if (rowcount > 0)
printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
EXEC SQL END DECLARE SECTION;
EXEC SQL DELETE FROM imembers WHERE member_type = 'STRING' AND
- member_id = :iid AND direct = 1;
+ member_id = :iid;
rowcount = sqlca.sqlerrd[2];
if (rowcount > 0)
printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
EXEC SQL END DECLARE SECTION;
EXEC SQL DELETE FROM imembers WHERE member_type = 'KERBEROS' AND
- member_id = :iid AND direct = 1;
+ member_id = :iid;
rowcount = sqlca.sqlerrd[2];
if (rowcount > 0)
printf("%d entr%s deleted\n", rowcount, rowcount == 1 ? "y" : "ies");
return found;
}
-int show_pdm_mach(void *id)
-{
- EXEC SQL BEGIN DECLARE SECTION;
- char name[PALLADIUM_NAME_SIZE];
- int iid = (int)id;
- EXEC SQL END DECLARE SECTION;
- int found = 1;
-
- EXEC SQL DECLARE csr220 CURSOR FOR
- SELECT name FROM palladium
- WHERE mach_id = :iid;
- EXEC SQL OPEN csr220;
- while (1)
- {
- EXEC SQL FETCH csr220 INTO :name;
- if (sqlca.sqlcode)
- break;
-
- strtrim(name);
- printf("Palladium server/supervisor %s is on non-existant machine %d\n",
- name, iid);
- found = 0;
- }
- EXEC SQL CLOSE csr220;
- return found;
-}
-
-
void phase2(void)
{
struct save_queue *sq, *sq1, *sq2, *sq3, *sq4, *sq5;
}
EXEC SQL CLOSE csr228;
- dprintf("Checking palladium...\n");
- sq1 = sq_create();
- EXEC SQL DECLARE csr229 CURSOR FOR
- SELECT mach_id, modby FROM palladium
- FOR UPDATE OF modby;
- EXEC SQL OPEN csr229;
- while (1)
- {
- EXEC SQL BEGIN DECLARE SECTION;
- int mach_id, modby;
- EXEC SQL END DECLARE SECTION;
-
- EXEC SQL FETCH csr229 INTO :mach_id, :modby;
- if (sqlca.sqlcode)
- break;
-
- maybe_fixup_modby2("palladium", "modby", "csr229", modby);
- if (!hash_lookup(machines, mach_id))
- sq_save_unique_data(sq1, (void *)mach_id);
- }
- EXEC SQL CLOSE csr229;
- generic_delete(sq1, show_pdm_mach, "palladium", "mach_id", 1);
-
dprintf("Checking krbmap...\n");
sq1 = sq_create();
sq2 = sq_create();
EXEC SQL CLOSE csr232;
generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
- dprintf("Checking printcaps\n");
+ dprintf("Checking printers\n");
sq1 = sq_create();
sq2 = sq_create();
+ sq3 = sq_create();
+ sq4 = sq_create();
+ sq5 = sq_create();
EXEC SQL DECLARE csr233 CURSOR FOR
- SELECT mach_id, quotaserver, modby FROM printcap;
+ SELECT mach_id, loghost, rm, rq, ac, lpc_acl, modby FROM printers;
EXEC SQL OPEN csr233;
while (1)
{
EXEC SQL BEGIN DECLARE SECTION;
- int mach_id, quotaserver, modby;
+ int mach_id, loghost, rm, rq, ac, lpc_acl, modby;
EXEC SQL END DECLARE SECTION;
- EXEC SQL FETCH csr233 INTO :mach_id, :quotaserver, :modby;
+ EXEC SQL FETCH csr233 INTO :mach_id, :loghost, :rm, :rq,
+ :lpc_acl, :modby;
if (sqlca.sqlcode)
break;
- maybe_fixup_modby2("printcap", "modby", "csr233", modby);
+ maybe_fixup_modby2("printers", "modby", "csr233", modby);
if (!hash_lookup(machines, mach_id))
sq_save_unique_data(sq1, (void *)mach_id);
- else if (!hash_lookup(machines, quotaserver))
- sq_save_unique_data(sq2, (void *)quotaserver);
+ else if (!hash_lookup(machines, rm))
+ sq_save_unique_data(sq2, (void *)rm);
+ else if (!hash_lookup(machines, rq))
+ sq_save_unique_data(sq3, (void *)rq);
+ else {
+ if (!hash_lookup(lists, ac))
+ sq_save_unique_data(sq4, (void *)ac);
+ if (!hash_lookup(lists, lpc_acl))
+ sq_save_unique_data(sq5, (void *)lpc_acl);
+ if (!hash_lookup(machines, loghost))
+ {
+ show_printer_loghost((void *)loghost);
+ cant_fix();
+ }
+ }
}
EXEC SQL CLOSE csr233;
- generic_delete(sq1, show_pcap_mach, "printcap", "mach_id", 1);
- generic_delete(sq2, show_pcap_quota, "printcap", "quotaserver", 1);
+ generic_delete(sq1, show_printer_mach, "printers", "mach_id", 1);
+ generic_delete(sq2, show_printer_spool, "printers", "rm", 1);
+ generic_delete(sq3, show_printer_quota, "printers", "rq", 1);
+ generic_fix(sq4, show_printer_ac, "Clear", fix_printer_ac, 1);
+ generic_fix(sq5, show_printer_lpc_acl, "Clear", fix_printer_lpc_acl, 1);
}
+