]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-auth: Handle unexpected auth "continue" request without crashing.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 10 Sep 2016 08:32:28 +0000 (11:32 +0300)
committerGitLab <gitlab@git.dovecot.net>
Tue, 13 Sep 2016 14:51:25 +0000 (17:51 +0300)
src/doveadm/doveadm-auth.c

index d61b7fcfd79e76b19f16a851607c986b8b54a927..dfc93820f9b05d78d3788dfabe327fcdb39030d6 100644 (file)
@@ -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);