From: Timo Sirainen Date: Sat, 10 Sep 2016 08:32:28 +0000 (+0300) Subject: doveadm-auth: Handle unexpected auth "continue" request without crashing. X-Git-Tag: 2.3.0.rc1~3028 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5bfda550bd63d34365db650232e7a618f3cbeae7;p=thirdparty%2Fdovecot%2Fcore.git doveadm-auth: Handle unexpected auth "continue" request without crashing. --- 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);