[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 157/254: cmake: auto detection of CURL_CA_BUNDLE/CU
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 157/254: cmake: auto detection of CURL_CA_BUNDLE/CURL_CA_PATH |
Date: |
Sat, 17 Jun 2017 16:53:09 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to annotated tag gnurl-7.54.1
in repository gnurl.
commit 6a9489dc4512bf92e121d7bc08924e2922ababc0
Author: Simon Warta <address@hidden>
AuthorDate: Tue May 2 00:12:55 2017 +0200
cmake: auto detection of CURL_CA_BUNDLE/CURL_CA_PATH
Closes #1461
---
CMakeLists.txt | 63 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 53 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7c2f7400..25abe354a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -633,22 +633,65 @@ set(CURL_CA_FALLBACK OFF CACHE BOOL
set(CURL_CA_PATH "auto" CACHE STRING
"Location of default CA path. Set 'none' to disable or 'auto' for
auto-detection. Defaults to 'auto'.")
-if("${CURL_CA_BUNDLE}" STREQUAL "none")
+if("${CURL_CA_BUNDLE}" STREQUAL "")
+ message(FATAL_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto'
or file path.")
+elseif("${CURL_CA_BUNDLE}" STREQUAL "none")
unset(CURL_CA_BUNDLE CACHE)
elseif("${CURL_CA_BUNDLE}" STREQUAL "auto")
- # TODO: implement
- message(SEND_ERROR "Auto mode not implemented for CURL_CA_BUNDLE")
-elseif("${CURL_CA_BUNDLE}" STREQUAL "")
- message(SEND_ERROR "Invalid value of CURL_CA_BUNDLE. Use 'none', 'auto' or
path.")
+ unset(CURL_CA_BUNDLE CACHE)
+ set(CURL_CA_BUNDLE_AUTODETECT TRUE)
+else()
+ set(CURL_CA_BUNDLE_SET TRUE)
endif()
-if("${CURL_CA_PATH}" STREQUAL "none")
+if("${CURL_CA_PATH}" STREQUAL "")
+ message(FATAL_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or
directory path.")
+elseif("${CURL_CA_PATH}" STREQUAL "none")
unset(CURL_CA_PATH CACHE)
elseif("${CURL_CA_PATH}" STREQUAL "auto")
- # TODO: implement
- message(SEND_ERROR "Auto mode not implemented for CURL_CA_PATH")
-elseif("${CURL_CA_PATH}" STREQUAL "")
- message(SEND_ERROR "Invalid value of CURL_CA_PATH. Use 'none', 'auto' or
path.")
+ unset(CURL_CA_PATH CACHE)
+ set(CURL_CA_PATH_AUTODETECT TRUE)
+else()
+ set(CURL_CA_PATH_SET TRUE)
+endif()
+
+if(CURL_CA_BUNDLE_SET AND CURL_CA_PATH_AUTODETECT)
+ # Skip autodetection of unset CA path because CA bundle is set explicitly
+elseif(CURL_CA_PATH_SET AND CURL_CA_BUNDLE_AUTODETECT)
+ # Skip autodetection of unset CA bundle because CA path is set explicitly
+elseif(CURL_CA_PATH_AUTODETECT OR CURL_CA_BUNDLE_AUTODETECT)
+ # first try autodetecting a CA bundle, then a CA path
+
+ if(CURL_CA_BUNDLE_AUTODETECT)
+ set(SEARCH_CA_BUNDLE_PATHS
+ /etc/ssl/certs/ca-certificates.crt
+ /etc/pki/tls/certs/ca-bundle.crt
+ /usr/share/ssl/certs/ca-bundle.crt
+ /usr/local/share/certs/ca-root-nss.crt
+ /etc/ssl/cert.pem)
+
+ foreach(SEARCH_CA_BUNDLE_PATH ${SEARCH_CA_BUNDLE_PATHS})
+ if(EXISTS "${SEARCH_CA_BUNDLE_PATH}")
+ message(STATUS "Found CA bundle: ${SEARCH_CA_BUNDLE_PATH}")
+ set(CURL_CA_BUNDLE "${SEARCH_CA_BUNDLE_PATH}")
+ set(CURL_CA_BUNDLE_SET TRUE CACHE)
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(CURL_CA_PATH_AUTODETECT AND (NOT CURL_CA_PATH_SET))
+ if(EXISTS "/etc/ssl/certs")
+ set(CURL_CA_PATH "/etc/ssl/certs")
+ set(CURL_CA_PATH_SET TRUE CACHE)
+ endif()
+ endif()
+endif()
+
+if(CURL_CA_PATH_SET AND NOT (USE_OPENSSL OR GNUTLS_ENABLED))
+ message(FATAL_ERROR
+ "CA path only supported by OpenSSL, GnuTLS or PolarSSL. "
+ "Set CURL_CA_PATH=none or enable one of those TLS backends.")
endif()
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnurl] 74/254: testpart: remove _MPRINTF_REPLACE, (continued)
- [GNUnet-SVN] [gnurl] 74/254: testpart: remove _MPRINTF_REPLACE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 193/254: CURLOPT_FNMATCH_FUNCTION.3: also modified example to avoid fcpp issues, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 222/254: curl_ntlm_core: pass unsigned char to toupper, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 163/254: cmake: fix build on Ubuntu 14.04, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 185/254: build-wolfssl: Sync config with wolfSSL 3.11, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 208/254: test1538: fix typo, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 111/254: curl.1: depend the build on the Makefile.inc too, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 198/254: curl-compilers.m4: fix compiler_num for clang, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 100/254: curl: remove tool_writeenv.[ch], gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 129/254: mbedtls: Support server renegotiation request, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 157/254: cmake: auto detection of CURL_CA_BUNDLE/CURL_CA_PATH,
gnunet <=
- [GNUnet-SVN] [gnurl] 180/254: test557: fix ubsan runtime error due to int left shift, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 213/254: cyassl: define build macros before including ssl.h, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 46/254: examples: fixed too long line and too long string warnings, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 203/254: build: provide easy code coverage measuring, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 248/254: configure: update the copyright year in the output, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 139/254: CURLOPT_HTTPPROXYTUNNEL: clarify, add example, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 67/254: buffer: use data->set.buffer_size instead of BUFSIZE, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 195/254: CURLOPT_SSH_KEY*.3: typos, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 192/254: CURLOPT_FNMATCH_DATA.3: modified example to avoid fcpp issues, gnunet, 2017/06/17
- [GNUnet-SVN] [gnurl] 140/254: docs/libcurl/opts: added more examples in man pages, gnunet, 2017/06/17