]> andersk Git - moira.git/blobdiff - dbck/phase2.pc
add zephyr table support
[moira.git] / dbck / phase2.pc
index 35658f9ead5dfc9312ce95312e852e5a84cae548..1ebcc4a50248db5f3d74358298bc165244f5a80c 100644 (file)
@@ -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
This page took 0.035216 seconds and 4 git commands to generate.