]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Split off auth_request_want_failure_delay()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 14 Feb 2025 11:41:26 +0000 (13:41 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Feb 2025 18:46:28 +0000 (18:46 +0000)
src/auth/auth-request-handler.c

index f71dcef6c907f5b6e9ca8ed95afcb01b6b2262f1..01e768702c41a39046864a86a1dc8249579d6640 100644 (file)
@@ -212,6 +212,19 @@ auth_str_append_extra_fields(struct auth_request *request, string_t *dest)
        }
 }
 
+static bool auth_request_want_failure_delay(struct auth_request *request)
+{
+       if (request->failure_nodelay) {
+               /* passdb specifically requested not to delay the reply. */
+               return FALSE;
+       }
+       if (shutting_down) {
+               /* process is shutting down - finish failures immediately. */
+               return FALSE;
+       }
+       return TRUE;
+}
+
 static void
 auth_request_handle_failure(struct auth_request *request, const char *reply)
 {
@@ -235,8 +248,7 @@ auth_request_handle_failure(struct auth_request *request, const char *reply)
 
        e_debug(request->event, "handling failure, nodelay=%d",
                (int) request->failure_nodelay);
-       if (request->failure_nodelay || shutting_down) {
-               /* passdb specifically requested not to delay the reply. */
+       if (!auth_request_want_failure_delay(request)) {
                handler->callback(reply, handler->conn);
                auth_request_unref(&request);
                return;