From 37ed4e848982a964c33ebf73337cb707fe4a99af Mon Sep 17 00:00:00 2001 From: zacheiss Date: Thu, 23 Mar 2000 07:50:15 +0000 Subject: [PATCH] add zephyr table support --- dbck/phase1.pc | 26 +++++++++++++++- dbck/phase2.pc | 81 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/dbck/phase1.pc b/dbck/phase1.pc index eb896e26..c15eb815 100644 --- a/dbck/phase1.pc +++ b/dbck/phase1.pc @@ -935,5 +935,29 @@ void phase1(void) cant_fix(0); } } - EXEC SQL CLOSE csr111; + EXEC SQL CLOSE csr_ps; + + if (!fast) + { + dprintf("Checking zephyr...\n"); + + EXEC SQL DECLARE csr120 CURSOR FOR + SELECT z1.class FROM zephyr z1, zephyr z2 + WHERE (z1.class = z2.class AND z1.rowid < z1.rowid); + EXEC SQL OPEN csr120; + while (1) + { + EXEC SQL BEGIN DECLARE SECTION; + char class[ZEPHYR_CLASS_SIZE]; + EXEC SQL END DECLARE SECTION; + + EXEC SQL FETCH csr120 INTO :class; + if (sqlca.sqlcode) + break; + + printf("Zephyr class %s has duplicate name\n", class); + cant_fix(0); + } + EXEC SQL CLOSE csr120; + } } diff --git a/dbck/phase2.pc b/dbck/phase2.pc index 35658f9e..1ebcc4a5 100644 --- a/dbck/phase2.pc +++ b/dbck/phase2.pc @@ -2058,7 +2058,86 @@ void phase2(void) generic_fix(sq3, show_quota_wrongpid, "Fix", fix_quota_physid, 1); generic_fix(sq4, show_quota_nolist, "Delete", fix_quota_nolist, 1); - dprintf("Not checking zephyr.\n"); + dprintf("Checking zephyr...\n"); + EXEC SQL DECLARE csr_zc CURSOR FOR + SELECT class, xmt_type, xmt_id, sub_type, sub_id, iws_type, iws_id, + iui_type, iui_id, modby FROM zephyr; + EXEC SQL OPEN csr_zc; + while(1) + { + EXEC SQL BEGIN DECLARE SECTION; + int xmt_id, sub_id, iws_id, iui_id, modby; + char class[ZEPHYR_CLASS_SIZE]; + char xmt_type[ZEPHYR_XMT_TYPE_SIZE]; + char sub_type[ZEPHYR_SUB_TYPE_SIZE]; + char iws_type[ZEPHYR_IWS_TYPE_SIZE]; + char iui_type[ZEPHYR_IUI_TYPE_SIZE]; + EXEC SQL END DECLARE SECTION; + + EXEC SQL FETCH csr_zc INTO :class, :xmt_type, :xmt_id, :sub_type, + :sub_id, :iws_type, :iws_id, :iui_type, :iui_id, :modby; + + if (sqlca.sqlcode) + break; + + maybe_fixup_modby2("zephyr", "modby", strtrim(rowid), modby); + + strtrim(xmt_type); + if (!strcmp(xmt_type, "USER") && !hash_lookup(users, xmt_id)) + { + printf("xmt acl for %s is non-existant user %d\n", class, xmt_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(xmt_type, "LIST") && !hash_lookup(lists, xmt_id)) + { + printf("xmt acl for %s is non-existant list %d\n", class, xmt_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(xmt_type, "STRING") || !strcmp(xmt_type, "KERBEROS")) + maybe_fixup_unref_string2("zephyr", "xmt_id", strtrim(rowid), xmt_id); + + strtrim(sub_type); + if (!strcmp(sub_type, "USER") && !hash_lookup(users, sub_id)) + { + printf("sub acl for %s is non-existant user %d\n", class, sub_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(sub_type, "LIST") && !hash_lookup(lists, sub_id)) + { + printf("sub acl for %s is non-existant list %d\n", class, sub_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(sub_type, "STRING") || !strcmp(sub_type, "KERBEROS")) + maybe_fixup_unref_string2("zephyr", "sub_id", strtrim(rowid), sub_id); + + strtrim(iws_type); + if (!strcmp(iws_type, "USER") && !hash_lookup(users, iws_id)) + { + printf("iws acl for %s is non-existant user %d\n", class, iws_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(iws_type, "LIST") && !hash_lookup(lists, iws_id)) + { + printf("iws acl for %s is non-existant list %d\n", class, iws_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(iws_type, "STRING") || !strcmp(iws_type, "KERBEROS")) + maybe_fixup_unref_string2("zephyr", "iws_id", strtrim(rowid), iws_id); + + strtrim(iui_type); + if (!strcmp(iui_type, "USER") && !hash_lookup(users, iui_id)) + { + printf("iui acl for %s is non-existant user %d\n", class, iui_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(iui_type, "LIST") && !hash_lookup(lists, iui_id)) + { + printf("iui acl for %s is non-existant list %d\n", class, iui_id); + printf("Not fixing this error\n"); + } + else if (!strcmp(iui_type, "STRING") || !strcmp(iui_type, "KERBEROS")) + maybe_fixup_unref_string2("zephyr", "iui_id", strtrim(rowid), iui_id); + } dprintf("Checking hostaccess...\n"); EXEC SQL DECLARE csr228 CURSOR FOR -- 2.45.2