smtp: do not use STARTTLS when PLAIN connection is requested

Also do not allow downgrade if STARTTLS is not available
This commit is contained in:
Alexander Krotov
2020-11-15 22:39:54 +03:00
parent bd856d90db
commit 9df88745dc

View File

@@ -192,7 +192,8 @@ impl Smtp {
}; };
let security = match lp.security { let security = match lp.security {
Socket::STARTTLS | Socket::Plain => smtp::ClientSecurity::Opportunistic(tls_parameters), Socket::Plain => smtp::ClientSecurity::None,
Socket::STARTTLS => smtp::ClientSecurity::Required(tls_parameters),
_ => smtp::ClientSecurity::Wrapper(tls_parameters), _ => smtp::ClientSecurity::Wrapper(tls_parameters),
}; };