X-Git-Url: http://Server1/repobrowser/?p=xestiaab%2F.git;a=blobdiff_plain;f=source%2FfrmNewAccount-CardDAV2.cpp;h=d0b18ecb0c8cca97b38d467ff25083977cdc6a56;hp=07f223930c8f6773c23d83e4b2d0baa84823f2c3;hb=f69e09d827e06435ea94bb73aa71ab5f9d5c035b;hpb=a578ed436123242f807cb59eae02fcf6c22e2458 diff --git a/source/frmNewAccount-CardDAV2.cpp b/source/frmNewAccount-CardDAV2.cpp index 07f2239..d0b18ec 100644 --- a/source/frmNewAccount-CardDAV2.cpp +++ b/source/frmNewAccount-CardDAV2.cpp @@ -24,11 +24,11 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ NewAccountResult *ResultData = new NewAccountResult; lblServerConnResult->SetLabel(_("Testing...")); - lblCardDAVSupportResult->SetLabel(_("")); - lblServerResponse->SetLabel(_("")); - lblServerSSLResult->SetLabel(_("")); - lblServerSSLValid->SetLabel(_("")); - lblAbleToLoginResult->SetLabel(_("")); + lblCardDAVSupportResult->SetLabel(wxT("")); + lblServerResponse->SetLabel(wxT("")); + lblServerSSLResult->SetLabel(wxT("")); + lblServerSSLValid->SetLabel(wxT("")); + lblAbleToLoginResult->SetLabel(wxT("")); bool UsingSSLBypass = false; // Setup a CardDAV2 connection object for testing. @@ -37,7 +37,7 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ wxAtoi(txtServerPort->GetValue()), txtUsername->GetValue().ToStdString(), txtPassword->GetValue().ToStdString(), - chkUseSSL->GetValue()); + chkUseSSL->GetValue() ? true : false); // Test the connection. @@ -48,8 +48,59 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ if (TestConnection.SSLVerify() == COSSL_UNABLETOVERIFY){ #if defined(__APPLE__) + + TestConnection.BypassSSLVerification(true); + + COConnectResult TestConnectionResult = TestConnection.Connect(false); + + TestConnection.BypassSSLVerification(false); + + int SSLResult = DisplayTrustPanel(&TestConnection); + + if (SSLResult != NSOKButton){ + + lblServerConnResult->SetLabel(_("Failed")); + lblServerResponse->SetLabel(_("Not applicable")); + lblServerSSLResult->SetLabel(_("Used")); + lblServerSSLValid->SetLabel(_("No")); + lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage()); + btnPrevious->Enable(true); + return; + + } else { + + // Evalulate the trust object. + + SecTrustResultType EvalResult = ProcessResultType(&TestConnection); + + switch(EvalResult){ + case kSecTrustResultProceed: + lblServerSSLValid->SetLabel(_("Verified")); + break; + case kSecTrustResultConfirm: + lblServerSSLValid->SetLabel(_("Verified (user)")); + break; + default: + lblServerSSLValid->SetLabel(_("Unable to verify")); + } + + lblServerResponse->SetLabel(_("Not applicable")); + lblServerSSLResult->SetLabel(_("Used")); + + if (EvalResult != kSecTrustResultProceed){ + return; + } + + } + #elif defined(__WIN32__) + TestConnection.BypassSSLVerification(true); + + COConnectResult TestConnectionResult = TestConnection.Connect(false); + + TestConnection.BypassSSLVerification(false); + BOOL ModifiedCertificateData = false; CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateDialogData = BuildCertificateData(&TestConnection, (HWND)this->GetHandle()); @@ -58,13 +109,14 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ wxMessageBox(_("An error occured while trying to open the certificate dialog."), _("Error opening Certificate Information dialog")); } - if (ModifiedCertificateData = false){ + if (ModifiedCertificateData == false){ lblServerConnResult->SetLabel(_("Failed")); lblServerResponse->SetLabel(_("Not applicable")); lblServerSSLResult->SetLabel(_("Used")); lblServerSSLValid->SetLabel(_("No")); lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage()); + btnPrevious->Enable(true); return; } @@ -118,6 +170,8 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ #endif } + TestConnectionResult = TestConnection.Connect(true); + // Get the server prefix if the connection was successful. if (TestConnectionResult == COCONNECT_OK){ @@ -151,4 +205,4 @@ void frmNewAccount::RunCardDAV2Test( wxCommandEvent& event ){ ResultsEvent.SetClientData(ResultData); wxPostEvent(this, ResultsEvent); -} \ No newline at end of file +}