Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Label servers that can cause data loss as dangerous
[xestiaab/.git] / source / frmEditAccount.cpp
index faea105..920f526 100644 (file)
@@ -17,6 +17,7 @@
 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
 
 #include "frmEditAccount.h"
+#include "common/svrdlist.h"
 
 frmEditAccount::frmEditAccount( wxWindow* parent )
 :
@@ -93,7 +94,47 @@ void frmEditAccount::DetectAddressBook( 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){
+                       
+                       wxMessageBox(_("An error occured whilst connnecting: ") + TestConnection.GetErrorMessage(), _("Failed"), wxOK+wxICON_ERROR);
+                       return;
+                       
+               }
+               
 #elif defined(__WIN32__)
+
+               TestConnection.BypassSSLVerification(true);
+
+               COConnectResult TestConnectionResult = TestConnection.Connect(false);
+
+               TestConnection.BypassSSLVerification(false);
+
+               BOOL ModifiedCertificateData = false;
+               CRYPTUI_VIEWCERTIFICATE_STRUCTW CertificateData = BuildCertificateData(&TestConnection, (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(_("An invalid certificate was received from the server."), _("Invalid certificate"));
+                       return;
+               } else {
+                       TestConnection.BypassSSLVerification(true);
+                       COConnectResult TestConnectionResult = TestConnection.Connect(true);
+                       TestConnection.BypassSSLVerification(false);
+               }
+
 #else
        
                // Connect again and fetch SSL certificate information.
@@ -127,8 +168,6 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
                        TestConnection.BypassSSLVerification(true);
                
                        COConnectResult TestConnectionResult = TestConnection.Connect(true);
-               
-                       TestConnection.BypassSSLVerification(false);
                                                                
                } else if (SSLResult == 2){
                                                                
@@ -144,9 +183,11 @@ void frmEditAccount::DetectAddressBook( wxCommandEvent& event )
        }
        
        // Get the server prefix if the connection was successful.
-       
+
        if (TestConnectionResult == COCONNECT_OK){
 
+               COConnectResult TestConnectionResult = TestConnection.Connect(true);
+
                if (UsingSSLBypass == true){
                        TestConnection.BypassSSLVerification(true);                     
                }
@@ -234,10 +275,10 @@ void frmEditAccount::LoadSettings( wxString AccNameIn ){
 void frmEditAccount::UpdateSettings( wxCommandEvent& event )
 {
 
-       // Check if server address matches against the blacklist.
+       // Check if server address matches against the dangerous list.
        // Bring up warning message if it does.
        
-       if (CheckBlacklist(txtAddress->GetValue())){
+       if (CheckDangerousList(txtAddress->GetValue())){
                
                int MessageBoxResult = wxMessageBox(_("The server with the address given does not support the CardDAV protocol properly and shouldn't be used.\n\nData loss is very likely.\n\nDo you still want to continue using this server?"), _("Server warning"), wxYES_NO, this);
                
@@ -328,4 +369,4 @@ bool frmEditAccount::GetDialogResult(){
        
        return DialogResult;
        
-}
\ No newline at end of file
+}
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