require IMAP4rev1 capability

technically, we should have been doing that since the beginning, but as
there is IMAP4rev2 now, it might actually matter (in about a decade,
when servers start dropping backwards compat ...).
This commit is contained in:
Oswald Buddenhagen 2021-11-24 23:05:29 +01:00
parent 4a5c79993c
commit 5243c69863

View File

@ -225,7 +225,8 @@ typedef union {
#define CAP(cap) (ctx->caps & (1 << (cap))) #define CAP(cap) (ctx->caps & (1 << (cap)))
enum CAPABILITY { enum CAPABILITY {
NOLOGIN = 0, IMAP4REV1,
NOLOGIN,
#ifdef HAVE_LIBSASL #ifdef HAVE_LIBSASL
SASLIR, SASLIR,
#endif #endif
@ -244,6 +245,7 @@ static const struct {
const char *str; const char *str;
uint len; uint len;
} cap_list[] = { } cap_list[] = {
{ "IMAP4REV1", 9 },
{ "LOGINDISABLED", 13 }, { "LOGINDISABLED", 13 },
#ifdef HAVE_LIBSASL #ifdef HAVE_LIBSASL
{ "SASL-IR", 7 }, { "SASL-IR", 7 },
@ -2088,6 +2090,12 @@ imap_open_store_authenticate( imap_store_t *ctx )
imap_server_conf_t *srvc = ctx->conf->server; imap_server_conf_t *srvc = ctx->conf->server;
#endif #endif
if (!CAP(IMAP4REV1)) {
error( "IMAP error: Server does not support IMAP4rev1\n" );
imap_open_store_bail( ctx, FAIL_FINAL );
return;
}
if (ctx->greeting != GreetingPreauth) { if (ctx->greeting != GreetingPreauth) {
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
if (srvc->ssl_type == SSL_STARTTLS) { if (srvc->ssl_type == SSL_STARTTLS) {