From: Steve Brokenshire Date: Sun, 15 May 2016 10:16:42 +0000 (+0100) Subject: Merge branch 'master' of ssh://gelforn.xestia.co.uk/scmrepos/xestiaab X-Git-Tag: release-0.13~26 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=d91452d39ea9212c1b2185713576ebfa4f709310;hp=47e8ef3bb6cfc9366b070511f01d0e9d5c51e9f7;p=xestiaab%2F.git Merge branch 'master' of ssh://gelforn.xestia.co.uk/scmrepos/xestiaab --- diff --git a/source/actmgr/frmActivityMgr.cpp b/source/actmgr/frmActivityMgr.cpp index 6cf9ad7..27960b7 100644 --- a/source/actmgr/frmActivityMgr.cpp +++ b/source/actmgr/frmActivityMgr.cpp @@ -38,9 +38,6 @@ #include "../vcard/vcard34conv.h" #include "../vcard/vcard.h" -#ifndef FRMACTIVITYMGR_H -#define FRMACTIVITYMGR_H - DEFINE_EVENT_TYPE(ACTMGR_RESUMEPROC); DEFINE_EVENT_TYPE(ACTMGR_TOGGLECONN); DEFINE_EVENT_TYPE(ACTMGR_STARTTIMER); @@ -1016,21 +1013,16 @@ void frmActivityMgr::ProcessTasksThread() std::map *SCListData = NULL; while (ExitLoop == FALSE){ - - ServerContactList = ConnHandle.GetContactList(SyncTokenLoad.ToUTF8()); - SSLCertCollection certcol = ConnHandle.GetCertificateData(); - - // Create a pointer for the std::map. - - SCListData = &ServerContactList.ListData; // Check if any errors have occured whilst getting the data. - int ErrorCode = ConnHandle.GetResultCode(); + int ErrorCode = ConnHandle.SSLVerifyTest(); - if (ErrorCode != 0){ + if (ErrorCode != CURLE_OK){ - if (ErrorCode == 60 || ErrorCode == 51){ + if (ErrorCode == CURLE_SSL_CACERT || + ErrorCode == CURLE_PEER_FAILED_VERIFICATION || + ErrorCode == CURLE_SSL_CONNECT_ERROR){ // Invalid SSL certificate so bring up a dialog to the user // explaining what has happened and the options available. @@ -1060,6 +1052,16 @@ void frmActivityMgr::ProcessTasksThread() frmMainPtrGet->UpdateSSLAccountStatus(AccountID, 0, ConnHandle.GetTrustObject()); } + +#elif defined(__WIN32__) + + BOOL ModifiedCertificateData; + CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&ConnHandle, (HWND)frmMainPtrGet->GetHandle()); + + if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){ + wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog")); + } + #else // Setup the data to be sent in the wxPostEvent command. @@ -1162,6 +1164,13 @@ void frmActivityMgr::ProcessTasksThread() bool ContinueProcess = AccDir.GetFirst(&AccDirFilename, wxEmptyString, wxDIR_DEFAULT); + ServerContactList = ConnHandle.GetContactList(SyncTokenLoad.ToUTF8()); + SSLCertCollection certcol = ConnHandle.GetCertificateData(); + + // Create a pointer for the std::map. + + SCListData = &ServerContactList.ListData; + // Process the server data. if (SCListData != NULL){ @@ -2080,6 +2089,4 @@ void frmActivityMgr::UpdateStatusLabel(wxCommandEvent& event){ } -} - -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/source/actmgr/frmActivityMgr.h b/source/actmgr/frmActivityMgr.h index cae74e7..2fe3807 100644 --- a/source/actmgr/frmActivityMgr.h +++ b/source/actmgr/frmActivityMgr.h @@ -39,6 +39,10 @@ Subclass of frmActivityMgrADT, which is generated by wxFormBuilder. #include "../common/dirs.h" #include "../common/preferences.h" +#if defined(__WIN32__) +#include "../common/win32ssl.h" +#endif + //// end generated include DECLARE_EVENT_TYPE(ACTMGR_RESUMEPROC, wxID_ANY) diff --git a/source/frmEditAccount.cpp b/source/frmEditAccount.cpp index e6bff81..d850bf8 100644 --- a/source/frmEditAccount.cpp +++ b/source/frmEditAccount.cpp @@ -17,9 +17,6 @@ // with Xestia Address Book. If not, see #include "frmEditAccount.h" -#include "frmInvalidSSLCertificate.h" -#include "carddav/carddav.h" -#include "common/svrblist.h" frmEditAccount::frmEditAccount( wxWindow* parent ) : @@ -108,7 +105,22 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event ) #if defined(__APPLE__) SSLResult = DisplayTrustPanel(&CDavObj); - + +#elif defined(__WIN32__) + + BOOL ModifiedCertificateData; + CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&CDavObj, (HWND)this->GetHandle()); + + if (!CryptUIDlgViewCertificate(&CertificateData, &ModifiedCertificateData)){ + wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog")); + return; + } + + if (ModifiedCertificateData == FALSE){ + wxMessageBox(_("Unable to get server prefix without a valid SSL certificate."), _("Error getting server prefix")); + return; + } + #else frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this); diff --git a/source/frmEditAccount.h b/source/frmEditAccount.h index ba24bca..754e2c7 100644 --- a/source/frmEditAccount.h +++ b/source/frmEditAccount.h @@ -26,8 +26,14 @@ Subclass of frmEditAccountADT, which is generated by wxFormBuilder. #include "AppXestiaAddrBk.h" #include +#include "frmInvalidSSLCertificate.h" +#include "common/svrblist.h" #include "carddav/carddav.h" +#if defined(__WIN32__) +#include "common/win32ssl.h" +#endif + //// end generated include /** Implementing frmEditAccountADT */