melib/smtp: don't do plain EHLO before starting Tls connection
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Failing after 6m7s Details

pull/262/head
Manos Pitsidianakis 2023-07-24 10:57:35 +03:00
parent 1e084c1d85
commit ae25ffba43
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 23 additions and 9 deletions

View File

@ -272,14 +272,16 @@ impl SmtpConnection {
AsyncWrapper::new(conn)?
};
let pre_ehlo_extensions_reply = read_lines(
&mut socket,
&mut res,
Some((ReplyCode::_220, &[])),
&mut String::new(),
)
.await?;
drop(pre_ehlo_extensions_reply);
if !matches!(server_conf.security, SmtpSecurity::Tls { .. }) {
let pre_ehlo_extensions_reply = read_lines(
&mut socket,
&mut res,
Some((ReplyCode::_220, &[])),
&mut String::new(),
)
.await?;
drop(pre_ehlo_extensions_reply);
}
if matches!(server_conf.security, SmtpSecurity::Auto { .. }) {
if server_conf.port == 465 {
@ -297,7 +299,9 @@ impl SmtpConnection {
));
}
}
socket.write_all(b"EHLO meli.delivery\r\n").await?;
if !matches!(server_conf.security, SmtpSecurity::Tls { .. }) {
socket.write_all(b"EHLO meli.delivery\r\n").await?;
}
if matches!(server_conf.security, SmtpSecurity::StartTLS { .. }) {
let pre_tls_extensions_reply = read_lines(
&mut socket,
@ -355,6 +359,16 @@ impl SmtpConnection {
conn
})?
};
if matches!(server_conf.security, SmtpSecurity::Tls { .. }) {
let pre_ehlo_extensions_reply = read_lines(
&mut ret,
&mut res,
Some((ReplyCode::_220, &[])),
&mut String::new(),
)
.await?;
drop(pre_ehlo_extensions_reply);
}
ret.write_all(b"EHLO meli.delivery\r\n").await?;
ret
}