From c66808d49103ef7d06d34ffa4243f5893526c529 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 14 Feb 2025 13:41:26 +0200 Subject: [PATCH] auth: Split off auth_request_want_failure_delay() --- src/auth/auth-request-handler.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/auth/auth-request-handler.c b/src/auth/auth-request-handler.c index f71dcef6c9..01e768702c 100644 --- a/src/auth/auth-request-handler.c +++ b/src/auth/auth-request-handler.c @@ -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; -- 2.47.3