* 2. attempt sasl_client_start with only "AUTH=ANONYMOUS" capability
* 3. if sasl_client_start fails, fall through... */
- if (mutt_account_getuser (&idata->conn->account))
+ if (mutt_account_getuser (&idata->conn->account)) {
+ sasl_dispose (&saslconn);
return IMAP_AUTH_FAILURE;
+ }
if (mutt_bit_isset (idata->capabilities, AUTH_ANON) &&
(!idata->conn->account.user[0] ||
rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen,
&mech);
} else if (!ascii_strcasecmp ("login", method) &&
- !strstr (NONULL (idata->capstr), "AUTH=LOGIN"))
+ !strstr (NONULL (idata->capstr), "AUTH=LOGIN")) {
/* do not use SASL login for regular IMAP login (#3556) */
+ sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
+ }
if (rc != SASL_OK && rc != SASL_CONTINUE)
do
dprint (1, (debugfile, "imap_auth_sasl: Failure starting authentication exchange. No shared mechanisms?\n"));
/* SASL doesn't support LOGIN, so fall back */
+ sasl_dispose (&saslconn);
return IMAP_AUTH_UNAVAIL;
}
if (sasl_setprop (*saslconn, SASL_SEC_PROPS, &secprops) != SASL_OK)
{
mutt_error (_("Error setting SASL security properties"));
+ sasl_dispose (saslconn);
return -1;
}
if (sasl_setprop (*saslconn, SASL_SSF_EXTERNAL, &(conn->ssf)) != SASL_OK)
{
mutt_error (_("Error setting SASL external security strength"));
+ sasl_dispose (saslconn);
return -1;
}
}
if (sasl_setprop (*saslconn, SASL_AUTH_EXTERNAL, conn->account.user) != SASL_OK)
{
mutt_error (_("Error setting SASL external user name"));
+ sasl_dispose (saslconn);
return -1;
}
}
dprint (1, (debugfile, "pop_auth_sasl: Failure starting authentication exchange. No shared mechanisms?\n"));
/* SASL doesn't support suggested mechanisms, so fall back */
+ sasl_dispose (&saslconn);
return POP_A_UNAVAIL;
}