]> andersk Git - moira.git/blobdiff - dbck/phase2.pc
Check list memacls.
[moira.git] / dbck / phase2.pc
index 1ebcc4a50248db5f3d74358298bc165244f5a80c..39ae152432adf692d65239b78223535ab9c575ba 100644 (file)
@@ -49,6 +49,7 @@ void cluster_check(int id, void *cluster, void *hint);
 int show_svc(void *id);
 void list_check(int id, void *list, void *hint);
 void fix_list_acl(int id);
+void fix_list_memacl(int id);
 int show_member_list(void *id);
 int show_mem_user(void *id);
 int show_mem_list(void *id);
@@ -870,6 +871,37 @@ void list_check(int id, void *list, void *hint)
        }
       break;
     }
+
+  switch (l->memacl_type)
+    {
+    case 'L':
+      if (!hash_lookup(lists, l->memacl_id))
+       {
+         printf("List %s has bad LIST memacl %d\n", l->name, l->memacl_id);
+         if (single_fix("Patch", 1))
+           fix_list_memacl(l->list_id);
+       }
+      break;
+    case 'U':
+      if (!hash_lookup(users, l->memacl_id))
+       {
+         printf("List %s has bad USER acl %d\n", l->name, l->memacl_id);
+         if (single_fix("Patch", 1))
+           fix_list_memacl(l->list_id);
+       }
+      break;
+    case 'K':
+      l->memacl_id = maybe_fixup_unref_string(l->memacl_id, id, l->name,
+                                             "list", "memacl_id", "list_id");
+         if (!l->memacl_id)
+           {
+             printf("List %s has bad KERBEROS acl %d\n", l->name, 
+                    l->memacl_id);
+             if (single_fix("Patch", 1))
+               fix_list_memacl(l->list_id);
+           }
+         break;
+    }
 }
 
 void fix_list_acl(int id)
@@ -888,6 +920,22 @@ void fix_list_acl(int id)
   modified("list");
 }
 
+void fix_list_memacl(int id)
+{
+  EXEC SQL BEGIN DECLARE SECTION;
+  int rowcount, iid = (int)id;
+  EXEC SQL END DECLARE SECTION;
+
+  EXEC SQL UPDATE list SET memacl_id = 0, memacl_type = 'NONE'
+    WHERE list_id = :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("list");
+}
+
 int show_member_list(void *id)
 {
   EXEC SQL BEGIN DECLARE SECTION;
This page took 0.032784 seconds and 4 git commands to generate.