Rocco Rutte:
[apps/madmutt.git] / imap / auth_sasl.c
index 905075a..fa1714f 100644 (file)
@@ -14,6 +14,7 @@
 #endif
 
 #include "mutt.h"
+#include "ascii.h"
 #include "mutt_sasl.h"
 #include "imap_private.h"
 #include "auth.h"
@@ -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
     }