]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: If userdb lookup was found from auth cache, don't clear the earlier userdb...
authorTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 18:24:01 +0000 (21:24 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 7 Sep 2015 18:24:01 +0000 (21:24 +0300)
src/auth/auth-request.c

index 6aa1c56c45d4c423527097e5b8f2e385ae2e2471..bf6edaf125d48deab3afcad03969da8b168a7d54 100644 (file)
@@ -1024,7 +1024,13 @@ static bool auth_request_lookup_user_cache(struct auth_request *request,
                return TRUE;
        }
 
-       request->userdb_reply = auth_fields_init(request->pool);
+       /* We want to preserve any userdb fields set by the earlier passdb
+          lookup, so initialize userdb_reply only if it doesn't exist.
+          Don't use auth_request_init_userdb_reply(), because the entire
+          userdb part of the result comes from the cache so we don't want to
+          initialize it with default_fields. */
+       if (request->userdb_reply == NULL)
+               request->userdb_reply = auth_fields_init(request->pool);
        auth_request_userdb_import(request, value);
        *result_r = USERDB_RESULT_OK;
        return TRUE;