From: Aki Tuomi Date: Tue, 9 Nov 2021 12:37:07 +0000 (+0200) Subject: auth: passdb-cache - Preserve cached fields when verifying password with worker X-Git-Tag: 2.3.18~143 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f083562f9265ae461fd0e16df73a82923e3f668e;p=thirdparty%2Fdovecot%2Fcore.git auth: passdb-cache - Preserve cached fields when verifying password with worker --- diff --git a/src/auth/passdb-cache.c b/src/auth/passdb-cache.c index 9daa0f97b5..ecababde4e 100644 --- a/src/auth/passdb-cache.c +++ b/src/auth/passdb-cache.c @@ -59,6 +59,8 @@ static bool passdb_cache_verify_plain_callback(const char *reply, void *context) enum passdb_result result; result = passdb_blocking_auth_worker_reply_parse(request, reply); + if (result != PASSDB_RESULT_OK) + auth_fields_rollback(request->fields.extra_fields); auth_request_verify_plain_callback_finish(result, request); auth_request_unref(&request); return TRUE; @@ -110,6 +112,10 @@ bool passdb_cache_verify_plain(struct auth_request *request, const char *key, e_debug(authdb_event(request), "cache: " "validating password on worker"); auth_request_ref(request); + /* Save the extra fields already here, and take a snapshot. + If verification fails, roll back fields. */ + auth_request_set_fields(request, list + 1, NULL); + auth_fields_snapshot(request->fields.extra_fields); auth_worker_call(request->pool, request->fields.user, str_c(str), passdb_cache_verify_plain_callback, request); return TRUE;