]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap-urlauth: imap-urlauth - Produce better user permission error message in...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Mon, 16 Oct 2023 21:11:03 +0000 (23:11 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Fri, 20 Oct 2023 18:21:41 +0000 (18:21 +0000)
src/lib-imap-urlauth/imap-urlauth.c

index c6c0e97be89804f1b3a779a5bd681f762e0edc55..bb808d867e9b0574f1932a4d9d95242334ebe70b 100644 (file)
@@ -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;