X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=imap%2Fauth_sasl.c;h=a76677ff750125d7a71c1c3642e95f5f9c5b7fac;hp=574043577c17397440b1aee874e96681d27bcc18;hb=1c068b6a0b9c781e97d565f1d5ed9ef8913566da;hpb=6833ce8bdca2d64e14485118f2a4417b7e1cb1b1 diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 5740435..a76677f 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -18,6 +18,10 @@ /* SASL login/authentication code */ +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include "mutt.h" #include "mutt_sasl.h" #include "imap_private.h" @@ -116,12 +120,19 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) irc = IMAP_CMD_CONTINUE; /* looping protocol */ - while (rc == SASL_CONTINUE) + while (rc == SASL_CONTINUE || olen > 0) { do irc = imap_cmd_step (idata); while (irc == IMAP_CMD_CONTINUE); + if (method && irc == IMAP_CMD_NO) + { + dprint (2, (debugfile, "imap_auth_sasl: %s failed\n", method)); + sasl_dispose (&saslconn); + return IMAP_AUTH_UNAVAIL; + } + if (irc == IMAP_CMD_BAD || irc == IMAP_CMD_NO) goto bail; @@ -180,6 +191,8 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) mutt_socket_write (idata->conn, "*\r\n"); dprint (1, (debugfile, "imap_auth_sasl: sasl_client_step error %d\n",rc)); } + + olen = 0; } while (irc != IMAP_CMD_OK)