From: Timo Sirainen Date: Tue, 19 Apr 2022 08:31:05 +0000 (+0300) Subject: auth: Fix assert-crash when handling user iteration in busy auth-workers X-Git-Tag: 2.4.0~4126 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1b8ffa19772a9f418fe45d088f4a475fc1e28d37;p=thirdparty%2Fdovecot%2Fcore.git auth: Fix assert-crash when handling user iteration in busy auth-workers The auth process crashed during user iteration if some auth requests were also queued. Broken by f591498845fd7b5e11f1085b6e1f5e34dcc84767 Fixes: Panic: file auth-worker-connection.c: line 128 (auth_worker_request_send): assertion failed: (worker->request == NULL) --- diff --git a/src/auth/auth-worker-connection.c b/src/auth/auth-worker-connection.c index 0794b7694d..d2c1610eaa 100644 --- a/src/auth/auth-worker-connection.c +++ b/src/auth/auth-worker-connection.c @@ -433,14 +433,18 @@ static int worker_input_args(struct connection *conn, const char *const *args) return -1; } - if (worker->restart) { + if (worker->request != NULL) { + /* there's still a pending request */ + } else if (worker->restart) { auth_worker_deinit(&worker, "Max requests limit", TRUE); ret = 0; } else if (worker->shutdown) { auth_worker_deinit(&worker, "Idle kill", FALSE); ret = 0; - } else if (worker->request != NULL) + } else { auth_worker_request_send_next(worker); + ret = 1; + } return ret; }