]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Do not cache username unless it was changed by lookup
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 29 Mar 2017 13:15:36 +0000 (16:15 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Mar 2017 17:54:04 +0000 (20:54 +0300)
This could've caused usernames to be unexpectedly changed
because they were cached by a lookup that did not include
username in the cache key.

src/auth/auth-request.c

index 6062f4965582077c2e515daeb8996a6eced97d2d..66729de68a3612f6766c946406215c1a52e560c3 100644 (file)
@@ -1243,7 +1243,7 @@ static void auth_request_userdb_save_cache(struct auth_request *request,
                auth_fields_append(request->userdb_reply, str,
                                   AUTH_FIELD_FLAG_CHANGED,
                                   AUTH_FIELD_FLAG_CHANGED);
-               if (strcmp(request->user, request->translated_username) != 0) {
+               if (request->user_changed_by_lookup) {
                        /* username was changed by passdb or userdb */
                        if (str_len(str) > 0)
                                str_append_c(str, '\t');