]> andersk Git - moira.git/commitdiff
add zephyr table support
authorzacheiss <zacheiss>
Thu, 23 Mar 2000 07:50:15 +0000 (07:50 +0000)
committerzacheiss <zacheiss>
Thu, 23 Mar 2000 07:50:15 +0000 (07:50 +0000)
dbck/phase1.pc
dbck/phase2.pc

index eb896e2664668538c35342cc5373bae868923798..c15eb815c0ec35365815381b46e2c24baf65a3c8 100644 (file)
@@ -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;
+    }
 }
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.71725 seconds and 5 git commands to generate.