From 5bfda550bd63d34365db650232e7a618f3cbeae7 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 10 Sep 2016 11:32:28 +0300 Subject: [PATCH] doveadm-auth: Handle unexpected auth "continue" request without crashing. --- src/doveadm/doveadm-auth.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/doveadm/doveadm-auth.c b/src/doveadm/doveadm-auth.c index d61b7fcfd7..dfc93820f9 100644 --- a/src/doveadm/doveadm-auth.c +++ b/src/doveadm/doveadm-auth.c @@ -131,14 +131,24 @@ auth_callback(struct auth_client_request *request ATTR_UNUSED, if (status == 0) i_fatal("passdb expects SASL continuation"); - if (status < 0) + switch (status) { + case AUTH_REQUEST_STATUS_ABORT: + i_unreached(); + case AUTH_REQUEST_STATUS_INTERNAL_FAIL: + case AUTH_REQUEST_STATUS_FAIL: printf("passdb: %s auth failed\n", input->username); - else { + break; + case AUTH_REQUEST_STATUS_CONTINUE: + printf("passdb: %s auth unexpectedly requested continuation\n", + input->username); + break; + case AUTH_REQUEST_STATUS_OK: input->success = TRUE; printf("passdb: %s auth succeeded\n", input->username); + break; } - if (*args != NULL) { + if (args != NULL && *args != NULL) { printf("extra fields:\n"); for (; *args != NULL; args++) printf(" %s\n", *args); -- 2.47.3