mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
priorize CertificateChecks setting from user over the one from provider-db (#2749)
* priorize CertificateChecks setting from user over the one from provider-db * avoid some duplicate code * remove questionable comment
This commit is contained in:
@@ -290,12 +290,7 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
port: param.imap.port,
|
port: param.imap.port,
|
||||||
socket: param.imap.security,
|
socket: param.imap.security,
|
||||||
username: param.imap.user.clone(),
|
username: param.imap.user.clone(),
|
||||||
strict_tls: match param.imap.certificate_checks {
|
strict_tls: None,
|
||||||
CertificateChecks::Automatic => None,
|
|
||||||
CertificateChecks::Strict => Some(true),
|
|
||||||
CertificateChecks::AcceptInvalidCertificates2
|
|
||||||
| CertificateChecks::AcceptInvalidCertificates => Some(false),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if !servers
|
if !servers
|
||||||
@@ -308,14 +303,24 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
port: param.smtp.port,
|
port: param.smtp.port,
|
||||||
socket: param.smtp.security,
|
socket: param.smtp.security,
|
||||||
username: param.smtp.user.clone(),
|
username: param.smtp.user.clone(),
|
||||||
strict_tls: match param.smtp.certificate_checks {
|
strict_tls: None,
|
||||||
CertificateChecks::Automatic => None,
|
|
||||||
CertificateChecks::Strict => Some(true),
|
|
||||||
CertificateChecks::AcceptInvalidCertificates2
|
|
||||||
| CertificateChecks::AcceptInvalidCertificates => Some(false),
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// respect certificate setting from function parameters
|
||||||
|
for mut server in &mut servers {
|
||||||
|
let certificate_checks = match server.protocol {
|
||||||
|
Protocol::Imap => param.imap.certificate_checks,
|
||||||
|
Protocol::Smtp => param.smtp.certificate_checks,
|
||||||
|
};
|
||||||
|
server.strict_tls = match certificate_checks {
|
||||||
|
CertificateChecks::AcceptInvalidCertificates
|
||||||
|
| CertificateChecks::AcceptInvalidCertificates2 => Some(false),
|
||||||
|
CertificateChecks::Strict => Some(true),
|
||||||
|
CertificateChecks::Automatic => server.strict_tls,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
let servers = expand_param_vector(servers, ¶m.addr, ¶m_domain);
|
let servers = expand_param_vector(servers, ¶m.addr, ¶m_domain);
|
||||||
|
|
||||||
progress!(ctx, 550);
|
progress!(ctx, 550);
|
||||||
|
|||||||
Reference in New Issue
Block a user