X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/40a6abf9c556a02951e2c6205943f84f5d6c17a5..ad47bcbe5a2aaf291fb04f9e97396d91618037dd:/dbck/phase2.pc diff --git a/dbck/phase2.pc b/dbck/phase2.pc index 1ebcc4a5..39ae1524 100644 --- a/dbck/phase2.pc +++ b/dbck/phase2.pc @@ -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;