From: Timo Sirainen Date: Mon, 7 Sep 2015 18:24:01 +0000 (+0300) Subject: auth: If userdb lookup was found from auth cache, don't clear the earlier userdb... X-Git-Tag: 2.2.19.rc1~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1d04674fb0906d0895ae0f958f4cdbe487aa8ab;p=thirdparty%2Fdovecot%2Fcore.git auth: If userdb lookup was found from auth cache, don't clear the earlier userdb fields. --- diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index 6aa1c56c45..bf6edaf125 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -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;