From 8736242f8c4960195636f70388c0fee46e11d6f4 Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Mon, 16 Oct 2023 23:11:03 +0200 Subject: [PATCH] lib-imap-urlauth: imap-urlauth - Produce better user permission error message in imap_urlauth_fetch*(). --- src/lib-imap-urlauth/imap-urlauth.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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; -- 2.47.3