Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Fixed cleaning of old object files
[xestiaab/.git] / source / carddav / carddav-sslverify.cpp
index 57b11c0..c082a90 100644 (file)
@@ -41,7 +41,7 @@ CURLcode CardDAV::SSLVerifyTest(){
 
        CURL *conn;
        CURL *connssldata;
-       CURLcode conncode;
+       CURLcode conncode = CURLE_OK;
        wxString ServerAddressURL;
        wxString ServerAuth;
        wxString ServerAddressSSL;
@@ -77,9 +77,25 @@ CURLcode CardDAV::SSLVerifyTest(){
 #if defined(__APPLE__) || defined(__WIN32__)
                
                SetConnectionObject(conn);
+       
+#else
+               
+               if (ServerAccount != ""){
+               
+                       wxString ServerCertFilename = GetAccountDir(ServerAccount, TRUE);
+
+                       if (wxFile::Exists(ServerCertFilename) == TRUE){
+               
+                               curl_easy_setopt(conn, CURLOPT_SSL_VERIFYPEER, 1);
+                               curl_easy_setopt(conn, CURLOPT_SSL_VERIFYHOST, 2);
+                               curl_easy_setopt(conn, CURLOPT_CAINFO, (const char*)ServerCertFilename.mb_str(wxConvUTF8));
+               
+                       }
+               
+               }
 
 #endif
-                
+               
                conncode = (curl_easy_perform(conn));
 
                // Check if the SSL certificate is valid or self-signed or some other
@@ -90,8 +106,16 @@ CURLcode CardDAV::SSLVerifyTest(){
                        // Connection is OK. Do nothing.
 
                        *ServerResult = TRUE;
+                       
+#if !defined(__APPLE__) && !defined(__WIN32__)
+                       
+                       VerifyCertCollection = BuildSSLCollection(conn);
 
-               } else if (conncode == CURLE_SSL_CACERT || conncode == CURLE_SSL_CONNECT_ERROR){
+#endif
+                       
+               } else if (conncode == CURLE_SSL_CACERT || 
+                               conncode == CURLE_SSL_CONNECT_ERROR ||
+                               conncode == CURLE_PEER_FAILED_VERIFICATION){
 
                        connssldata = curl_easy_init();
 
@@ -110,7 +134,7 @@ CURLcode CardDAV::SSLVerifyTest(){
 #if defined(__APPLE__) || defined(__WIN32__)
                        
                         SetConnectionObject(connssldata);
-
+                       
 #endif
                        
                        CURLcode certfetchcode;
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