From db0cf7c2b35dbb66d464a9d4880b994d7e194b68 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 17 Oct 2014 19:49:54 +0200 Subject: [PATCH] Use "Check certificate" dialog also for SMTP sessions Signed-off-by: Sven Strickroth --- src/Utils/HwSMTP.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Utils/HwSMTP.cpp b/src/Utils/HwSMTP.cpp index cbe7df768..8dd44fc0a 100644 --- a/src/Utils/HwSMTP.cpp +++ b/src/Utils/HwSMTP.cpp @@ -12,7 +12,7 @@ #include #include "FormatMessageWrapper.h" #include -#include "CertificateValidationHelper.h" +#include "AppUtils.h" #define IO_BUFFER_SIZE 0x10000 @@ -851,10 +851,14 @@ BOOL CHwSMTP::SendEmail ( goto cleanup; } - Status = VerifyServerCertificate( pRemoteCertContext, m_csSmtpSrvHost.GetBuffer(), 0 ); - if (Status) + git_cert_x509 cert; + cert.cert_type = GIT_CERT_X509; + cert.data = pRemoteCertContext->pbCertEncoded; + cert.len = pRemoteCertContext->cbCertEncoded; + if (CAppUtils::Git2CertificateCheck((git_cert*)&cert, 0, CUnicodeUtils::GetUTF8(m_csSmtpSrvHost), nullptr)) { - m_csLastError = CFormatMessageWrapper(Status); + CertFreeCertificateContext(pRemoteCertContext); + m_csLastError = _T("Invalid certificate."); goto cleanup; } -- 2.11.4.GIT