After a failed login, the connection is left open but capstr is freed.
If a second login attempt is made, imap_auth_sasl was trying to strstr
using the NULL capstr.
Add a NONULL around the capstr parameter to strstr. Change
imap_conn_find() to keep the capstr around until a successful
authentication occurs.
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
} else if (!ascii_strcasecmp ("login", method) &&
- !strstr (idata->capstr, "AUTH=LOGIN"))
+ !strstr (NONULL (idata->capstr), "AUTH=LOGIN"))
/* do not use SASL login for regular IMAP login (#3556) */
return IMAP_AUTH_UNAVAIL;
if (!imap_authenticate (idata))
{
idata->state = IMAP_AUTHENTICATED;
+ FREE (&idata->capstr);
new = 1;
if (idata->conn->ssf)
dprint (2, (debugfile, "Communication encrypted at %d bits\n",
}
else
mutt_account_unsetpass (&idata->conn->account);
-
- FREE (&idata->capstr);
}
if (new && idata->state == IMAP_AUTHENTICATED)
{