1 parent
a238ff5e23
commit
93762fe9ef
65 files changed
+5420
-2792
No files matched your search
@@ -43,7 +43,9 @@ pub(crate) async fn connect(
|
||||
.map_err(|e| ImapError::ConnectionFailed(e.to_string()))?;
|
||||
|
||||
if creds.tls {
|
||||
let tls = async_native_tls::TlsConnector::new();
|
||||
let tls = async_native_tls::TlsConnector::new()
|
||||
.danger_accept_invalid_certs(!creds.tls_verify)
|
||||
.danger_accept_invalid_hostnames(!creds.tls_verify);
|
||||
let tls_stream = tls
|
||||
.connect(&creds.host, tcp)
|
||||
.await
|
||||
|
||||
@@ -452,6 +452,7 @@ mod tests {
|
||||
host: "imap.example.com".to_string(),
|
||||
port: 993,
|
||||
tls: true,
|
||||
tls_verify: true,
|
||||
email: "user@example.com".to_string(),
|
||||
password: "hunter2".to_string(),
|
||||
}
|
||||
@@ -785,6 +786,7 @@ mod tests {
|
||||
host,
|
||||
port,
|
||||
tls,
|
||||
tls_verify: true,
|
||||
email,
|
||||
password,
|
||||
})
|
||||
|
||||
@@ -54,6 +54,7 @@ pub(super) fn identity(creds: &ImapCredentials) -> [u8; 32] {
|
||||
creds.host.as_bytes(),
|
||||
&creds.port.to_be_bytes(),
|
||||
&[u8::from(creds.tls)],
|
||||
&[u8::from(creds.tls_verify)],
|
||||
creds.email.as_bytes(),
|
||||
creds.password.as_bytes(),
|
||||
] {
|
||||
@@ -264,6 +265,7 @@ mod tests {
|
||||
host: "127.0.0.1".into(),
|
||||
port: listener.local_addr().unwrap().port(),
|
||||
tls: false,
|
||||
tls_verify: false,
|
||||
email: "test@example.com".into(),
|
||||
password: "secret".into(),
|
||||
};
|
||||
@@ -450,6 +452,7 @@ mod tests {
|
||||
host: std::env::var("TEST_IMAP_HOST").expect("TEST_IMAP_HOST required"),
|
||||
port: 993,
|
||||
tls: true,
|
||||
tls_verify: true,
|
||||
email: std::env::var("TEST_IMAP_EMAIL").expect("TEST_IMAP_EMAIL required"),
|
||||
password: std::env::var("TEST_IMAP_PASSWORD").expect("TEST_IMAP_PASSWORD required"),
|
||||
};
|
||||
|
||||
@@ -88,6 +88,7 @@ pub struct ImapCredentials {
|
||||
pub host: String,
|
||||
pub port: u16,
|
||||
pub tls: bool,
|
||||
pub tls_verify: bool,
|
||||
pub email: String,
|
||||
pub password: String,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user