]> andersk Git - moira.git/commitdiff
Check list memacls.
authorzacheiss <zacheiss>
Tue, 15 Aug 2000 00:07:20 +0000 (00:07 +0000)
committerzacheiss <zacheiss>
Tue, 15 Aug 2000 00:07:20 +0000 (00:07 +0000)
dbck/dbck.h
dbck/phase1.pc
dbck/phase2.pc

index 07c4414bdbfc197a7d6c39dbb3dbaffd4be7a18b..51eb68aced4e0d4807cc2023ede2680b0d43fa4a 100644 (file)
@@ -69,8 +69,10 @@ struct cluster {
 struct list {
   char name[LIST_NAME_SIZE];
   char acl_type;
+  char memacl_type;
   int list_id;
   int acl_id;
+  int memacl_id;
   int modby;
   int members;
 };
index c15eb815c0ec35365815381b46e2c24baf65a3c8..6eb3881cc009184f3228257c38edb0e1441041ea 100644 (file)
@@ -703,17 +703,20 @@ void phase1(void)
     out_of_mem("loading lists");
 
   EXEC SQL DECLARE csr108 CURSOR FOR
-    SELECT list_id, name, acl_id, acl_type, modby  FROM list
+    SELECT list_id, name, acl_id, acl_type, memacl_id, memacl_type, modby
+    FROM list
     ORDER BY list_id;
   EXEC SQL OPEN csr108;
   while (1)
     {
       EXEC SQL BEGIN DECLARE SECTION;
-      int list_id, acl_id, modby;
+      int list_id, acl_id, memacl_id, modby;
       char name[LIST_NAME_SIZE], acl_type[LIST_ACL_TYPE_SIZE];
+      char memacl_type[LIST_ACL_TYPE_SIZE];
       EXEC SQL END DECLARE SECTION;
 
-      EXEC SQL FETCH csr108 INTO :list_id, :name, :acl_id, :acl_type, :modby;
+      EXEC SQL FETCH csr108 INTO :list_id, :name, :acl_id, :acl_type, 
+       :memacl_id, :memacl_type, :modby;
       if (sqlca.sqlcode)
        break;
       l = malloc(sizeof(struct list));
@@ -722,6 +725,8 @@ void phase1(void)
       strcpy(l->name, strtrim(name));
       l->acl_type = acl_type[0];
       l->acl_id = acl_id;
+      l->memacl_type = memacl_type[0];
+      l->memacl_id = memacl_id;
       l->list_id = list_id;
       l->modby = modby;
       l->members = 0;
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.102205 seconds and 5 git commands to generate.