mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +03:00
fix(tls): disable hostname checks in all cases
This commit is contained in:
@@ -363,7 +363,11 @@ impl Imap {
|
|||||||
if (server_flags & (DC_LP_IMAP_SOCKET_STARTTLS | DC_LP_IMAP_SOCKET_PLAIN)) != 0 {
|
if (server_flags & (DC_LP_IMAP_SOCKET_STARTTLS | DC_LP_IMAP_SOCKET_PLAIN)) != 0 {
|
||||||
imap::connect_insecure((imap_server, imap_port)).and_then(|client| {
|
imap::connect_insecure((imap_server, imap_port)).and_then(|client| {
|
||||||
if (server_flags & DC_LP_IMAP_SOCKET_STARTTLS) != 0 {
|
if (server_flags & DC_LP_IMAP_SOCKET_STARTTLS) != 0 {
|
||||||
let tls = native_tls::TlsConnector::builder().build().unwrap();
|
let tls = native_tls::TlsConnector::builder()
|
||||||
|
// FIXME: unfortunately this is needed to make things work on macos + testrun.org
|
||||||
|
.danger_accept_invalid_hostnames(true)
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
client.secure(imap_server, &tls).map(Into::into)
|
client.secure(imap_server, &tls).map(Into::into)
|
||||||
} else {
|
} else {
|
||||||
Ok(client.into())
|
Ok(client.into())
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ use std::ffi::{CStr, CString};
|
|||||||
|
|
||||||
use lettre::smtp::client::net::*;
|
use lettre::smtp::client::net::*;
|
||||||
use lettre::*;
|
use lettre::*;
|
||||||
use native_tls::TlsConnector;
|
|
||||||
|
|
||||||
use crate::constants::Event;
|
use crate::constants::Event;
|
||||||
use crate::constants::*;
|
use crate::constants::*;
|
||||||
@@ -96,11 +95,14 @@ impl Smtp {
|
|||||||
};
|
};
|
||||||
let port = lp.send_port as u16;
|
let port = lp.send_port as u16;
|
||||||
|
|
||||||
let mut tls_builder = TlsConnector::builder();
|
let tls = native_tls::TlsConnector::builder()
|
||||||
tls_builder.min_protocol_version(Some(DEFAULT_TLS_PROTOCOLS[0]));
|
// FIXME: unfortunately this is needed to make things work on macos + testrun.org
|
||||||
|
.danger_accept_invalid_hostnames(true)
|
||||||
|
.min_protocol_version(Some(DEFAULT_TLS_PROTOCOLS[0]))
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
let tls_parameters =
|
let tls_parameters = ClientTlsParameters::new(domain.to_string(), tls);
|
||||||
ClientTlsParameters::new(domain.to_string(), tls_builder.build().unwrap());
|
|
||||||
|
|
||||||
let creds = if 0 != lp.server_flags & (DC_LP_AUTH_OAUTH2 as i32) {
|
let creds = if 0 != lp.server_flags & (DC_LP_AUTH_OAUTH2 as i32) {
|
||||||
// oauth2
|
// oauth2
|
||||||
|
|||||||
Reference in New Issue
Block a user