]> 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)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 29 Mar 2017 13:25:57 +0000 (16:25 +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 5c950db222bb7aef7778a0ad486b77c3d9ed2e64..22fc9b4ccc55f9e49260b2637dcdfca89b9540cb 100644 (file)
@@ -1276,7 +1276,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');