From: danw Date: Thu, 3 Jul 1997 22:45:22 +0000 (+0000) Subject: Fix the logic and explanation for one of the guess-what-the-user-meant X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/commitdiff_plain/9fa2449385241e440cebe8745c03e512e6bdb194 Fix the logic and explanation for one of the guess-what-the-user-meant cases. (Fixes a bug where blanche would claim MR_NO_MATCH instead of MR_PERM when you tried to remove a list from a list that you weren't on the ACL for.) --- diff --git a/clients/blanche/blanche.c b/clients/blanche/blanche.c index e867faf0..36a98053 100644 --- a/clients/blanche/blanche.c +++ b/clients/blanche/blanche.c @@ -380,18 +380,19 @@ char **argv; break; else if ((status != MR_LIST && status != MR_NO_MATCH) || memberstruct->type != M_ANY) { - if (status == MR_PERM && memberstruct->type == M_ANY) { - /* M_ANY means we've fallen through from the user case - * The fact that we didn't get MR_PERM there indicates - * that we had permission to remove the specified member - * from the list if it is a user, but not a list. This is - * if we are the member in question. Since we exist as a user - * we must have gotten the MR_NO_MATCH error, so we will - * return that, since it will be less confusing. However, - * This will generate the wrongerror if the user was trying - * to remove the list with his/her username from a list they - * don't administrate, without explicitly specifying "list:". - */ + if (status == MR_PERM && memberstruct->type == M_ANY && + !strcmp(membervec[2], getenv("USER"))) { + /* M_ANY means we've fallen through from the user + * case. The user is trying to remove himself from + * a list, but we got MR_USER or MR_NO_MATCH above, + * meaning he's not really on it, and we got MR_PERM + * when trying to remove LIST:$USER because he's not + * on the acl. That error is useless, so return + * MR_NO_MATCH instead. However, this will generate the + * wrong error if the user was trying to remove the list + * with his username from a list he doesn't administrate + * without explicitly specifying "list:". + */ status = MR_NO_MATCH; } com_err(whoami, status, "while deleting member %s from %s",