Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Bring up Invalid SSL Certificate Dialog when creating an account (incomplete)
authorKiri <sbrokenshire@xestia.co.uk>
Sun, 6 Sep 2015 18:44:46 +0000 (19:44 +0100)
committerKiri <sbrokenshire@xestia.co.uk>
Sun, 6 Sep 2015 18:44:46 +0000 (19:44 +0100)
source/frmInvalidSSLCertificate.cpp
source/frmInvalidSSLCertificate.h
source/frmNewAccount.cpp
source/frmNewAccount.h

index a7e75ca..ce1f8f4 100644 (file)
@@ -47,6 +47,22 @@ void frmInvalidSSLCertificate::LoadData(SSLCertCollection CertDataInc,
 
 }
 
+void frmInvalidSSLCertificate::LoadDataNew(SSLCertCollection CertDataInc, 
+                                       wxString DomainNameInc)
+{
+
+       AccountName = DomainNameInc;
+       CertData = CertDataInc;
+
+       lblSSLText->SetLabel(wxT("An invalid SSL certificate was received from the server ") + AccountName + (" account.\n\n") +
+               wxT("Click on one of the following buttons:\n\n") +
+               wxT("- Accept to accept the SSL certificate for this session and future sessions until the certificate changes.\n") +
+               wxT("- Reject to not use this certificate and disconnect.\n") +
+               wxT("- View Certificates to review the certificates that were received.")
+               );
+
+}
+
 int frmInvalidSSLCertificate::GetResult()
 {
 
index b7ead06..038895e 100644 (file)
@@ -34,6 +34,7 @@ class frmInvalidSSLCertificate : public frmInvalidSSLCertificateADT
                /** Constructor */
                frmInvalidSSLCertificate( wxWindow* parent );
                void LoadData(SSLCertCollection CertDataInc, wxString AccountNameInc);
+               void LoadDataNew(SSLCertCollection CertDataInc, wxString DomainNameInc);
                int GetResult();
        //// end generated class members
        
index 1681134..4eb1259 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "carddav/carddav.h"
 #include "common/dirs.h"
+#include "frmInvalidSSLCertificate.h"
 
 frmNewAccount::frmNewAccount( wxWindow* parent )
 :
@@ -128,7 +129,6 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
         lblServerConnResult->SetLabel(_("Testing..."));
         
         UseSSL = chkUseSSL->GetValue();
-        
         CardDAVConn.SetupConnection(txtServerAddress->GetValue(),
                                     wxAtoi(txtServerPort->GetValue()),
                                     txtUsername->GetValue(),
@@ -136,6 +136,40 @@ void frmNewAccount::ProcessNext( wxCommandEvent& event )
                                     UseSSL);
         CardDAVConn.SetupResultBools(&ServerResult, &ServerAction);
         
+               // Verify SSL trust first before doing anything.
+
+               if (UseSSL == TRUE){
+
+                       CURLcode sslcode = CardDAVConn.SSLVerifyTest();
+
+                       if (sslcode == CURLE_OK){
+                               
+
+
+                       } else if (sslcode == CURLE_SSL_CACERT || sslcode == CURLE_SSL_CONNECT_ERROR){
+
+                               // Certificate is more than likely a self-signed or
+                               // expired certificate so display the invalid
+                               // SSL certificate message.
+
+                               frmInvalidSSLCertificate *frmICPtr = new frmInvalidSSLCertificate(this);
+
+                               frmICPtr->LoadDataNew(CardDAVConn.GetSSLVerifyResults(), txtServerAddress->GetValue());
+                               frmICPtr->ShowModal();
+
+                       } else {
+
+                               // Something else happened. Stop the process and
+                               // display an error message instead.
+
+                               lblServerConnResult->SetLabel(_("Failed"));
+                               lblConnectionResultText->SetLabel(_("An error occured whilst connnecting: ") + CardDAVConn.GetErrorMessage() + wxString::Format(wxT(" (%i)\n%s"), sslcode, CardDAVConn.GetErrorBuffer().mb_str()));
+                               return;
+
+                       }
+
+               }
+
         std::thread ConnTest(&CardDAV::Connect, &CardDAVConn);
         
         ConnTest.join();
index 18f7412..480ef8f 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "AppXestiaAddrBk.h"
+#include <wx/fileconf.h>
 
 //// end generated include
 
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy