From: Stephan Bosch Date: Mon, 16 Oct 2023 21:11:03 +0000 (+0200) Subject: lib-imap-urlauth: imap-urlauth - Produce better user permission error message in... X-Git-Tag: 2.4.0~2505 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8736242f8c4960195636f70388c0fee46e11d6f4;p=thirdparty%2Fdovecot%2Fcore.git lib-imap-urlauth: imap-urlauth - Produce better user permission error message in imap_urlauth_fetch*(). --- diff --git a/src/lib-imap-urlauth/imap-urlauth.c b/src/lib-imap-urlauth/imap-urlauth.c index c6c0e97be8..bb808d867e 100644 --- a/src/lib-imap-urlauth/imap-urlauth.c +++ b/src/lib-imap-urlauth/imap-urlauth.c @@ -424,9 +424,15 @@ int imap_urlauth_fetch_parsed(struct imap_urlauth_context *uctx, } /* Validate target user */ - if (user->anonymous || strcmp(url->userid, user->username) != 0) { + if (user->anonymous) { + *client_error_r = + "Anonymous logins not permitted to fetch URLAUTH"; + *error_code_r = MAIL_ERROR_PARAMS; + return 0; + } + if (strcmp(url->userid, user->username) != 0) { *client_error_r = t_strdup_printf( - "Not permitted to fetch URLAUTH for user %s", + "Not permitted to fetch URLAUTH for other user %s", url->userid); *error_code_r = MAIL_ERROR_PARAMS; return 0;