inform user if LOGIN was skipped because of missing SSL

'AuthMechs *' technically includes LOGIN, so it is a bit unintuitive
when it's still not used.
This commit is contained in:
Oswald Buddenhagen 2016-12-03 19:18:12 +01:00
parent 1b235d3d46
commit 1a707ab156

View File

@ -1943,6 +1943,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
imap_server_conf_t *srvc = cfg->server; imap_server_conf_t *srvc = cfg->server;
string_list_t *mech, *cmech; string_list_t *mech, *cmech;
int auth_login = 0; int auth_login = 0;
int skipped_login = 0;
#ifdef HAVE_LIBSASL #ifdef HAVE_LIBSASL
const char *saslavail; const char *saslavail;
char saslmechs[1024], *saslend = saslmechs; char saslmechs[1024], *saslend = saslmechs;
@ -1960,6 +1961,8 @@ imap_open_store_authenticate2( imap_store_t *ctx )
if (!any) if (!any)
#endif #endif
auth_login = 1; auth_login = 1;
else
skipped_login = 1;
#ifdef HAVE_LIBSASL #ifdef HAVE_LIBSASL
} else { } else {
int len = strlen( cmech->string ); int len = strlen( cmech->string );
@ -2030,7 +2033,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
if (!auth_login) { if (!auth_login) {
error( "IMAP error: selected SASL mechanism(s) not available;\n" error( "IMAP error: selected SASL mechanism(s) not available;\n"
" selected:%s\n available: %s\n", saslmechs, saslavail ); " selected:%s\n available: %s\n", saslmechs, saslavail );
goto bail; goto skipnote;
} }
info( "NOT using available SASL mechanism(s): %s\n", saslavail ); info( "NOT using available SASL mechanism(s): %s\n", saslavail );
sasl_dispose( &ctx->sasl ); sasl_dispose( &ctx->sasl );
@ -2048,6 +2051,12 @@ imap_open_store_authenticate2( imap_store_t *ctx )
return; return;
} }
error( "IMAP error: server supports no acceptable authentication mechanism\n" ); error( "IMAP error: server supports no acceptable authentication mechanism\n" );
#ifdef HAVE_LIBSASL
skipnote:
#endif
if (skipped_login)
error( "Note: not using LOGIN because connection is not encrypted;\n"
" use 'AuthMechs LOGIN' explicitly to force it.\n" );
bail: bail:
imap_open_store_bail( ctx, FAIL_FINAL ); imap_open_store_bail( ctx, FAIL_FINAL );