be more helpful when no SASL mechanisms are available

This commit is contained in:
Oswald Buddenhagen 2016-12-03 20:58:23 +01:00
parent 2f91e22371
commit fdb03b91f2

View File

@ -1944,6 +1944,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
string_list_t *mech, *cmech; string_list_t *mech, *cmech;
int auth_login = 0; int auth_login = 0;
#ifdef HAVE_LIBSASL #ifdef HAVE_LIBSASL
const char *saslavail;
char saslmechs[1024], *saslend = saslmechs; char saslmechs[1024], *saslend = saslmechs;
#endif #endif
@ -2022,6 +2023,14 @@ imap_open_store_authenticate2( imap_store_t *ctx )
free( enc ); free( enc );
return; return;
notsasl: notsasl:
if (!ctx->sasl || sasl_listmech( ctx->sasl, NULL, "", "", "", &saslavail, NULL, NULL ) != SASL_OK)
saslavail = "(none)"; /* EXTERNAL is always there anyway. */
if (!auth_login) {
error( "IMAP error: selected SASL mechanism(s) not available;\n"
" selected:%s\n available: %s\n", saslmechs, saslavail );
goto bail;
}
info( "NOT using available SASL mechanism(s): %s\n", saslavail );
sasl_dispose( &ctx->sasl ); sasl_dispose( &ctx->sasl );
} }
#endif #endif