diff options
-rw-r--r-- | src/tools/http_download.c | 7 | ||||
-rw-r--r-- | src/tools/http_upload.c | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/tools/http_download.c b/src/tools/http_download.c index cd2a7553..57e36e61 100644 --- a/src/tools/http_download.c +++ b/src/tools/http_download.c @@ -127,6 +127,9 @@ http_file_get(void* userdata) char* cert_path = prefs_get_string(PREF_TLS_CERTPATH); gchar* cafile = cafile_get_name(); + ProfAccount* account = accounts_get_account(session_get_account_name()); + gboolean insecure = strcmp(account->tls_policy, "trust") == 0; + account_free(account); pthread_mutex_unlock(&lock); curl_global_init(CURL_GLOBAL_ALL); @@ -153,6 +156,10 @@ http_file_get(void* userdata) if (cert_path) { curl_easy_setopt(curl, CURLOPT_CAPATH, cert_path); } + if (insecure) { + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + } if ((res = curl_easy_perform(curl)) != CURLE_OK) { err = strdup(curl_easy_strerror(res)); diff --git a/src/tools/http_upload.c b/src/tools/http_upload.c index ca336c9b..5b783441 100644 --- a/src/tools/http_upload.c +++ b/src/tools/http_upload.c @@ -186,6 +186,9 @@ http_file_put(void* userdata) char* cert_path = prefs_get_string(PREF_TLS_CERTPATH); gchar* cafile = cafile_get_name(); + ProfAccount* account = accounts_get_account(session_get_account_name()); + gboolean insecure = strcmp(account->tls_policy, "trust") == 0; + account_free(account); pthread_mutex_unlock(&lock); curl_global_init(CURL_GLOBAL_ALL); @@ -252,6 +255,10 @@ http_file_put(void* userdata) if (cert_path) { curl_easy_setopt(curl, CURLOPT_CAPATH, cert_path); } + if (insecure) { + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + } curl_easy_setopt(curl, CURLOPT_READDATA, fh); curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)(upload->filesize)); |