From 60b3185f716c5247e5aa6cde6f013913db6f746a Mon Sep 17 00:00:00 2001 From: mar Date: Fri, 21 Apr 1989 19:11:46 +0000 Subject: [PATCH] allow someone to delete a list which is it's own ACL and they're on the ACL. The problem is that you have to change the ACL before you delete the members... --- clients/moira/delete.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/clients/moira/delete.c b/clients/moira/delete.c index 4122cfc1..5c45e618 100644 --- a/clients/moira/delete.c +++ b/clients/moira/delete.c @@ -515,10 +515,29 @@ Bool ask_first; * what to do we will query and then do it. */ - if ( (CheckIfAce(name, "list", ask_first) == SUB_NORMAL) && - (RemoveMembersOfList(name, ask_first) == SUB_NORMAL) && + if ((CheckIfAce(name, "list", ask_first) != SUB_NORMAL) || (RemoveItemFromLists(name, "list", - &member_of, ask_first) == SUB_NORMAL) && + &member_of, ask_first) != SUB_NORMAL)) + break; + /* + * If the list is it's own ACL, then make the person performing + * the delete the owner before removing this person from the list + */ + if (!strcmp(list_info[L_ACE_TYPE], "LIST") && + !strcmp(list_info[L_ACE_NAME], list_info[L_NAME])) { + free(list_info[L_ACE_TYPE]); + free(list_info[L_ACE_NAME]); + list_info[L_ACE_TYPE] = Strsave("USER"); + list_info[L_ACE_NAME] = Strsave(user); + SlipInNewName(list_info, Strsave(list_info[L_NAME])); + if ((status = do_sms_query("update_list", CountArgs(list_info)-3, + list_info, Scream, (char *) NULL)) + != SMS_SUCCESS) { + com_err(program_name, status, " while updating list owner"); + Put_message("List may be only partly deleted."); + } + } + if ((RemoveMembersOfList(name, ask_first) == SUB_NORMAL) && (RealDeleteList(name) == SUB_NORMAL) ) { /* if... */ CheckAce(list_info[L_ACE_TYPE], list_info[L_ACE_NAME], ask_first); -- 2.45.2