re-issue IMAP CAPABILITY after authentication

... if the server didn't include a corresponding response code by
itself. required for the sorry excuse of an imap server that ms
exchange is.
This commit is contained in:
Oswald Buddenhagen 2021-12-09 11:42:40 +01:00
parent b6c36624f0
commit d6b9a139e4

View File

@ -1906,6 +1906,7 @@ static void imap_open_store_authenticate_p3( imap_store_t *, imap_cmd_t *, int )
#endif #endif
static void imap_open_store_authenticate2( imap_store_t * ); static void imap_open_store_authenticate2( imap_store_t * );
static void imap_open_store_authenticate2_p2( imap_store_t *, imap_cmd_t *, int ); static void imap_open_store_authenticate2_p2( imap_store_t *, imap_cmd_t *, int );
static void imap_open_store_authenticate2_p3( imap_store_t *, imap_cmd_t *, int );
static void imap_open_store_compress( imap_store_t * ); static void imap_open_store_compress( imap_store_t * );
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
static void imap_open_store_compress_p2( imap_store_t *, imap_cmd_t *, int ); static void imap_open_store_compress_p2( imap_store_t *, imap_cmd_t *, int );
@ -2472,6 +2473,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
cmd = new_imap_cmd( sizeof(*cmd) ); cmd = new_imap_cmd( sizeof(*cmd) );
cmd->param.cont = do_sasl_auth; cmd->param.cont = do_sasl_auth;
ctx->caps = 0;
imap_exec( ctx, cmd, done_sasl_auth, enc ? "AUTHENTICATE %s %s" : "AUTHENTICATE %s", gotmech, enc ); imap_exec( ctx, cmd, done_sasl_auth, enc ? "AUTHENTICATE %s %s" : "AUTHENTICATE %s", gotmech, enc );
free( enc ); free( enc );
return; return;
@ -2494,6 +2496,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
if (!ctx->conn.ssl) if (!ctx->conn.ssl)
#endif #endif
warn( "*** IMAP Warning *** Password is being sent in the clear\n" ); warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
ctx->caps = 0;
imap_exec( ctx, NULL, imap_open_store_authenticate2_p2, imap_exec( ctx, NULL, imap_open_store_authenticate2_p2,
"LOGIN \"%\\s\" \"%\\s\"", srvc->user, srvc->pass ); "LOGIN \"%\\s\" \"%\\s\"", srvc->user, srvc->pass );
return; return;
@ -2512,6 +2515,19 @@ imap_open_store_authenticate2( imap_store_t *ctx )
static void static void
imap_open_store_authenticate2_p2( imap_store_t *ctx, imap_cmd_t *cmd ATTR_UNUSED, int response ) imap_open_store_authenticate2_p2( imap_store_t *ctx, imap_cmd_t *cmd ATTR_UNUSED, int response )
{
if (response == RESP_NO) {
imap_open_store_bail( ctx, FAIL_FINAL );
} else if (response == RESP_OK) {
if (!ctx->caps)
imap_exec( ctx, NULL, imap_open_store_authenticate2_p3, "CAPABILITY" );
else
imap_open_store_compress( ctx );
}
}
static void
imap_open_store_authenticate2_p3( imap_store_t *ctx, imap_cmd_t *cmd ATTR_UNUSED, int response )
{ {
if (response == RESP_NO) if (response == RESP_NO)
imap_open_store_bail( ctx, FAIL_FINAL ); imap_open_store_bail( ctx, FAIL_FINAL );