]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Fix assert-crash when handling user iteration in busy auth-workers
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 19 Apr 2022 08:31:05 +0000 (11:31 +0300)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 20 Apr 2022 06:56:44 +0000 (06:56 +0000)
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)

src/auth/auth-worker-connection.c

index 0794b7694d023bcabe481eb8612d1985e9105d8c..d2c1610eaab71ef297fbe5d0adc0a8ecffec0025 100644 (file)
@@ -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;
 }