void fix_printer_ac(void *id);
void fix_printer_lpc_acl(void *id);
void user_check(int id, void *user, void *hint);
+void clear_user_sponsor(struct user *u);
int maybe_fixup_unref_string(int sid, int oid, char *oname, char *table,
char *field, char *idfield);
int maybe_fixup_modby(int sid, int oid, char *oname, char *table,
u->sigwho = maybe_fixup_unref_string(u->sigwho, id, u->login, "users",
"sigwho", "users_id");
+ switch (u->sponsor_type)
+ {
+ case 'U':
+ if (!hash_lookup(users, u->sponsor_id))
+ {
+ printf("User %s has non-existant USER sponsor %d\n",
+ u->login, u->sponsor_id);
+ if (single_fix("Set to no sponsor", 1))
+ clear_user_sponsor(u);
+ }
+ break;
+ case 'L':
+ if (!hash_lookup(lists, u->sponsor_id))
+ {
+ printf("User %s has non-existant LIST sponsor %d\n",
+ u->login, u->sponsor_id);
+ if (single_fix("Set to no sponsor", 1))
+ clear_user_sponsor(u);
+ }
+ break;
+ case 'S':
+ case 'K':
+ if (u->sponsor_id)
+ u->sponsor_id = maybe_fixup_unref_string(u->sponsor_id, id, u->login,
+ "users", "sponsor_id",
+ "users_id");
+ if (u->sponsor_id == 0)
+ clear_user_sponsor(u);
+ }
+
pobox_check(id, u);
}
}
break;
+ case 'E':
+ if (!hash_lookup(machines, u->pobox_id))
+ {
+ printf("User %s(%s) has P.O.Box on non-existant machine %d\n",
+ u->login, u->fullname, u->pobox_id);
+ if (single_fix("Delete", 0))
+ {
+ remove_pobox(u->users_id);
+ u->potype = 'N';
+ }
+ }
+ break;
+
case 'S':
if (hash_lookup(string_dups, u->pobox_id))
{
"modby", "snet_id");
}
+void clear_user_sponsor(struct user *u)
+{
+ EXEC SQL BEGIN DECLARE SECTION;
+ int rowcount, id = u->users_id;
+ EXEC SQL END DECLARE SECTION;
+
+ EXEC SQL UPDATE users SET sponsor_type = 'NONE', sponsor_id = 0
+ WHERE users_id = :id;
+ rowcount = sqlca.sqlerrd[2];
+ if (rowcount > 0)
+ printf("%d entr%s fixed\n", rowcount, rowcount == 1 ? "y" : "ies");
+ else
+ printf("Not fixed\n");
+ modified("users");
+}
+
void clear_subnet_owner(struct subnet *s)
{
EXEC SQL BEGIN DECLARE SECTION;
}
EXEC SQL CLOSE csr231;
- dprintf("Checking hostaliases\n");
+ dprintf("Checking hostaliases...\n");
sq1 = sq_create();
EXEC SQL DECLARE csr232 CURSOR FOR
SELECT mach_id FROM hostalias;
EXEC SQL CLOSE csr232;
generic_delete(sq1, show_hostalias, "hostalias", "mach_id", 1);
- dprintf("Checking printers\n");
+ dprintf("Checking printers...\n");
sq1 = sq_create();
sq2 = sq_create();
sq3 = sq_create();
generic_fix(sq4, show_printer_ac, "Clear", fix_printer_ac, 1);
generic_fix(sq5, show_printer_lpc_acl, "Clear", fix_printer_lpc_acl, 1);
- dprintf("Checking printservers\n");
+ dprintf("Checking printservers...\n");
hash_step(printservers, check_ps, NULL);
- dprintf("Checking containers\n");
+ dprintf("Checking containers...\n");
hash_step(containers, check_container, NULL);
- dprintf("Checking mcntmap\n");
+ dprintf("Checking mcntmap...\n");
sq1 = sq_create();
sq2 = sq_create();
EXEC SQL DECLARE csr_mcntmap CURSOR FOR