X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fauth_sasl.c;h=fa1714fa26542442315bd7dba1aabc48e19d3da5;hb=618ceafdc9564dbb8f3bf45c3869297a1d5a3320;hp=21af375d06adae7df25d546d60170cee7b68d81f;hpb=96d53ff49c308769efbf708e1e65819077cb7af6;p=apps%2Fmadmutt.git diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index 21af375..fa1714f 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -14,6 +14,7 @@ #endif #include "mutt.h" +#include "ascii.h" #include "mutt_sasl.h" #include "imap_private.h" #include "auth.h" @@ -129,10 +130,10 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) if (irc == IMAP_CMD_RESPOND) { #ifdef USE_SASL2 if (sasl_decode64 - (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf, + (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf, LONG_STRING - 1, #else - if (sasl_decode64 (idata->cmd.buf + 2, mutt_strlen (idata->cmd.buf + 2), buf, + if (sasl_decode64 (idata->cmd.buf + 2, str_len (idata->cmd.buf + 2), buf, #endif &len) != SASL_OK) { debug_print (1, ("error base64-decoding server response.\n")); @@ -140,7 +141,10 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) } } - if (!client_start) { + /* client-start is only available with the SASL-IR extension, but + * SASL 2.1 seems to want to use it regardless, at least for DIGEST + * fast reauth. Override if the server sent an initial continuation */ + if (!client_start || buf[0]) { do { rc = sasl_client_step (saslconn, buf, len, &interaction, &pc, &olen); if (rc == SASL_INTERACT) @@ -161,7 +165,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA * idata, const char *method) /* sasl_client_st(art|ep) allocate pc with malloc, expect me to * free it */ #ifndef USE_SASL2 - FREE (&pc); + mem_free (&pc); #endif }