From: Steve Brokenshire Date: Sun, 4 Oct 2015 15:15:34 +0000 (+0100) Subject: Improved invalid SSL/self-signed checking when creating a new account. X-Git-Tag: release-0.05~44 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=c5bc76b6a1301ce594a0949f02855a6bc2190094;hp=94da715b36188770f644b871bd59f59f140474be;p=xestiaab%2F.git Improved invalid SSL/self-signed checking when creating a new account. --- diff --git a/source/frmNewAccount.cpp b/source/frmNewAccount.cpp index 4eb1259..3df7781 100644 --- a/source/frmNewAccount.cpp +++ b/source/frmNewAccount.cpp @@ -152,10 +152,68 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) // expired certificate so display the invalid // SSL certificate message. - frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this); + // Setup the data to be sent in the wxPostEvent command. + + //SSLInvalidCertNotifObj SSLICNProcData; + + //bool *PauseMode = new bool; + int SSLResult; + //QRNotif qrn; + + //*PauseMode = TRUE; + //qrn.QResponse = &SSLResult; + //qrn.PausePtr = PauseMode; + + //SSLICNProcData.CertCollection = CardDAVConn.GetSSLVerifyResults(); + //SSLICNProcData.QRNotifData = &qrn; + //SSLICNProcData.AccountName = _("New account"); + + frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this); frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue()); frmICPtr->ShowModal(); + + //wxCommandEvent event(INVALIDSSLCERT); + //event.SetClientData(&SSLICNProcData); + //wxPostEvent(this->GetParent(), event); + + /*timespec n1, n2; + + // Fall asleep until we get an response. + + n1.tv_sec = 0; + n1.tv_nsec = 250000000L;*/ + + SSLResult = frmICPtr->GetResult(); + + // Clean up before processing response. + + delete frmICPtr; + frmICPtr = NULL; + + // Process the response from the user. + + if (SSLResult == 1){ + + // Accept the Certificate. + + CardDAVConn.AllowSelfSignTest(TRUE); + + } else if (SSLResult == 2){ + + // Reject the certificate, abort the task and mark as failed. + + lblServerConnResult->SetLabel(_("Failed")); + lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str())); + return; + + } + + //frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this); + + //frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue()); + //frmICPtr->ShowModal(); + } else { @@ -177,7 +235,6 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) if (ServerResult == FALSE){ lblServerConnResult->SetLabel(_("Failed")); - wxMessageBox(CardDAVConn.GetErrorMessage()); return; } else { @@ -186,19 +243,9 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) } - if (CardDAVConn.HasValidResponse() == TRUE){ - - lblServerResponse->SetLabel(_("Yes")); - - } else { - - lblServerResponse->SetLabel(_("No")); - - } - if (CardDAVConn.CanDoSSL() == TRUE){ - lblCardDAVSupportResult->SetLabel(_("Used")); + lblServerSSLResult->SetLabel(_("Used")); } else { @@ -209,13 +256,17 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) if (CardDAVConn.SSLVerify() == TRUE && CardDAVConn.CanDoSSL() == TRUE){ - lblCardDAVSupportResult->SetLabel(_("Verified")); + lblServerSSLValid->SetLabel(_("Verified")); - } else if (CardDAVConn.SSLVerify() == FALSE && CardDAVConn.CanDoSSL() == TRUE) { + } else if (CardDAVConn.SSLVerify() == FALSE && CardDAVConn.CanDoSSL() == TRUE && CardDAVConn.IsSelfSigned() == TRUE){ + + lblServerSSLValid->SetLabel(_("Verified (user)")); + + } else if (CardDAVConn.SSLVerify() == FALSE && CardDAVConn.CanDoSSL() == TRUE) { - lblServerSSLResult->SetLabel(_("Unable to verify")); + lblServerSSLValid->SetLabel(_("Unable to verify")); - } + } if (CardDAVConn.CanDoCardDAV() == TRUE){ @@ -241,7 +292,15 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event ) ServerPrefix = CardDAVConn.GetDefaultAddressBookURL(); - wxMessageBox(ServerPrefix); + if (CardDAVConn.HasValidResponse() == TRUE){ + + lblServerResponse->SetLabel(_("Yes")); + + } else { + + lblServerResponse->SetLabel(_("No")); + + } if (ServerResult == TRUE && CardDAVConn.HasValidResponse() == TRUE && //CardDAVConn.CanDoSSL() == TRUE && CardDAVConn.SSLVerify() == TRUE &&