From: Fred Morcos Date: Thu, 30 Apr 2026 15:34:55 +0000 (+0200) Subject: auth: Extract auth_request_verify_plain_passdb() helper X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=595eb3f06ead0493b984aa1a7aee261603dec6ee;p=thirdparty%2Fdovecot%2Fcore.git auth: Extract auth_request_verify_plain_passdb() helper Move the post-cache-check passdb dispatch (state transition, wanted_credentials_scheme reset, blocking/direct iface call) out of auth_request_default_verify_plain_continue() into a static helper. Pure refactoring with no behavior change. --- diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index a302a50be4..b4ab77e4a9 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -1239,6 +1239,31 @@ void auth_request_verify_plain(struct auth_request *request, } } +static void +auth_request_verify_plain_passdb(struct auth_request *request) +{ + struct auth_passdb *passdb = request->passdb; + + auth_request_set_state(request, AUTH_REQUEST_STATE_PASSDB); + /* In case this request had already done a credentials lookup (is it + even possible?), make sure wanted_credentials_scheme is cleared + so passdbs don't think we're doing a credentials lookup. */ + request->wanted_credentials_scheme = NULL; + + if (passdb->passdb->iface.verify_plain == NULL) { + /* we're deinitializing and just want to get rid of this + request */ + auth_request_verify_plain_passdb_callback( + PASSDB_RESULT_INTERNAL_FAILURE, request); + } else if (passdb->passdb->blocking) { + passdb_blocking_verify_plain(request); + } else { + passdb->passdb->iface.verify_plain( + request, request->mech_password, + auth_request_verify_plain_passdb_callback); + } +} + void auth_request_default_verify_plain_continue( struct auth_request *request, verify_plain_callback_t *callback) { @@ -1283,23 +1308,7 @@ void auth_request_default_verify_plain_continue( return; } - auth_request_set_state(request, AUTH_REQUEST_STATE_PASSDB); - /* In case this request had already done a credentials lookup (is it - even possible?), make sure wanted_credentials_scheme is cleared - so passdbs don't think we're doing a credentials lookup. */ - request->wanted_credentials_scheme = NULL; - - if (passdb->passdb->iface.verify_plain == NULL) { - /* we're deinitializing and just want to get rid of this - request */ - auth_request_verify_plain_passdb_callback( - PASSDB_RESULT_INTERNAL_FAILURE, request); - } else if (passdb->passdb->blocking) { - passdb_blocking_verify_plain(request); - } else { - passdb->passdb->iface.verify_plain( - request, password, auth_request_verify_plain_passdb_callback); - } + auth_request_verify_plain_passdb(request); } static void