melib/imap: fix LOGINDISABLED support

LOGINDISABLED disables the LOGIN command, not authenticating in general;
doh! 🤦🤦🤦🤦

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
pull/425/head
Manos Pitsidianakis 2 months ago
parent 084a222a51
commit e3c1656e05
No known key found for this signature in database
GPG Key ID: 7729C7707F7E09D0

@ -380,15 +380,6 @@ impl ImapStream {
&server_conf.server_hostname
))
.set_kind(ErrorKind::ProtocolNotSupported));
} else if capabilities
.iter()
.any(|cap| cap.eq_ignore_ascii_case(b"LOGINDISABLED"))
{
return Err(Error::new(format!(
"Could not connect to {}: server does not accept logins [LOGINDISABLED]",
&server_conf.server_hostname
))
.set_kind(ErrorKind::Authentication));
}
(uid_store.event_consumer)(
@ -452,6 +443,17 @@ impl ImapStream {
ret.send_literal(b"c2lyaGM=").await?;
}
_ => {
if capabilities
.iter()
.any(|cap| cap.eq_ignore_ascii_case(b"LOGINDISABLED"))
{
return Err(Error::new(format!(
"Could not connect to {}: server does not accept the LOGIN command \
[LOGINDISABLED]",
&server_conf.server_hostname
))
.set_kind(ErrorKind::Authentication));
}
let username = AString::try_from(server_conf.server_username.as_str())
.chain_err_kind(ErrorKind::Bug)?;
let password = AString::try_from(server_conf.server_password.as_str())

@ -309,6 +309,23 @@ impl MailBackend for ImapType {
};
}
}
"LOGINDISABLED" => {
if !(oauth2 || auth_anonymous) {
*status = MailBackendExtensionStatus::Enabled {
comment: Some(
"Use of LOGIN command is the default for given user \
configuration, but server rejects its use",
),
};
} else {
*status = MailBackendExtensionStatus::Supported {
comment: Some(
"Current user authentication is not performed with the LOGIN \
command",
),
};
}
}
_ => {
if SUPPORTED_CAPABILITIES
.iter()

Loading…
Cancel
Save