Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Check for certificate, build certificate and added verification check on Linux
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 27 May 2016 23:20:15 +0000 (00:20 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Fri, 27 May 2016 23:20:15 +0000 (00:20 +0100)
source/carddav/carddav-sslverify.cpp

index 5d81bb3..c082a90 100644 (file)
@@ -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
@@ -93,8 +109,13 @@ CURLcode CardDAV::SSLVerifyTest(){
                        
 #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();
 
@@ -113,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