]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Extract auth_request_verify_plain_passdb() helper
authorFred Morcos <fred.morcos@open-xchange.com>
Thu, 30 Apr 2026 15:34:55 +0000 (17:34 +0200)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 5 May 2026 14:44:22 +0000 (17:44 +0300)
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.

src/auth/auth-request.c

index a302a50be46ee96be79cf346905b708cad5e633e..b4ab77e4a9e7dddc8687cb03183dcbb54546ed8d 100644 (file)
@@ -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