diff --git a/src/Mod/Cloud/App/AppCloud.cpp b/src/Mod/Cloud/App/AppCloud.cpp index d1ae135e13..e669c67cf9 100644 --- a/src/Mod/Cloud/App/AppCloud.cpp +++ b/src/Mod/Cloud/App/AppCloud.cpp @@ -212,6 +212,11 @@ void Cloud::CloudWriter::createBucket() // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif + if ( curl ) { struct curl_slist *chunk = NULL; @@ -390,6 +395,10 @@ Cloud::CloudWriter::CloudWriter(const char* Url, const char* AccessKey, const ch // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { // Let's build our own header @@ -577,6 +586,10 @@ Cloud::CloudReader::CloudReader(const char* Url, const char* AccessKey, const ch std::string s; RequestData = Cloud::ComputeDigestAmzS3v2("GET", "application/xml", path, this->SecretKey, NULL, 0); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { // Let's build our own header @@ -661,6 +674,10 @@ void Cloud::CloudReader::DownloadFile(Cloud::CloudReader::FileEntry *entry) // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { struct curl_slist *chunk = NULL; @@ -771,6 +788,10 @@ void Cloud::CloudWriter::pushCloud(const char *FileName, const char *data, long // Let's build the Header and call to curl curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); +#ifdef ALLOW_SELF_SIGNED_CERTIFICATE + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0); +#endif if ( curl ) { struct curl_slist *chunk = NULL; diff --git a/src/Mod/Cloud/App/CMakeLists.txt b/src/Mod/Cloud/App/CMakeLists.txt index d51883b4f5..3c5a43edba 100644 --- a/src/Mod/Cloud/App/CMakeLists.txt +++ b/src/Mod/Cloud/App/CMakeLists.txt @@ -11,7 +11,7 @@ include_directories( set(Cloud_LIBS FreeCADApp - ${OPENSSL_LIBRARIES} + ${OPENSSL_LINK_LIBRARIES} ${CURL_LIBRARIES} ${XercesC_LIBRARIES} ${Boost_LIBRARIES} diff --git a/src/Mod/Cloud/CMakeLists.txt b/src/Mod/Cloud/CMakeLists.txt index e7293661e1..d359859b64 100644 --- a/src/Mod/Cloud/CMakeLists.txt +++ b/src/Mod/Cloud/CMakeLists.txt @@ -1,8 +1,10 @@ +#----------------------------- Control certificate validation ------------ +option(ALLOW_SELF_SIGNED_CERTIFICATE "Allow self signed certificate" OFF) +if (ALLOW_SELF_SIGNED_CERTIFICATE) +add_compile_options("-DALLOW_SELF_SIGNED_CERTIFICATE") +endif () #------------------------------ OpenSSL and CURL ------------------------- -if (APPLE) - set(OPENSSL_ROOT_DIR ${HOMEBREW_PREFIX}/Cellar/openssl/*) -endif(APPLE) -if (UNIX AND NOT APPLE) +if (UNIX AND APPLE) find_package(PkgConfig REQUIRED) pkg_search_module(OPENSSL REQUIRED openssl) elseif(WIN32 AND LIBPACK_FOUND)