-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-Set ca path and directory automatically
- Loading branch information
Showing
22 changed files
with
532 additions
and
174 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
cpp/third_party/vcpkg_overlays/azure-core-cpp/capath.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp b/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp | ||
index a8e28364..4beebde6 100644 | ||
--- a/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp | ||
+++ b/sdk/core/azure-core/inc/azure/core/http/curl_transport.hpp | ||
@@ -120,6 +120,18 @@ namespace Azure { namespace Core { namespace Http { | ||
*/ | ||
std::string CAInfo; | ||
|
||
+ /** | ||
+ * @brief Path to a directory which holds PEM encoded file, containing the certificate authorities | ||
+ * sent to libcurl handle directly. | ||
+ * | ||
+ * @remark The Azure SDK will not check if the path is valid or not. | ||
+ * | ||
+ * @remark The default is the built-in system specific path. More about this option: | ||
+ * https://curl.se/libcurl/c/CURLOPT_CAPATH.html | ||
+ * | ||
+ */ | ||
+ std::string CAPath; | ||
+ | ||
/** | ||
* @brief All HTTP requests will keep the connection channel open to the service. | ||
* | ||
diff --git a/sdk/core/azure-core/src/http/curl/curl.cpp b/sdk/core/azure-core/src/http/curl/curl.cpp | ||
index 89c0ade9..c307aa68 100644 | ||
--- a/sdk/core/azure-core/src/http/curl/curl.cpp | ||
+++ b/sdk/core/azure-core/src/http/curl/curl.cpp | ||
@@ -1281,6 +1281,8 @@ inline std::string GetConnectionKey(std::string const& host, CurlTransportOption | ||
key.append(","); | ||
key.append(!options.CAInfo.empty() ? options.CAInfo : "0"); | ||
key.append(","); | ||
+ key.append(!options.CAPath.empty() ? options.CAPath : "0"); | ||
+ key.append(","); | ||
key.append( | ||
options.Proxy.HasValue() ? (options.Proxy.Value().empty() ? "NoProxy" : options.Proxy.Value()) | ||
: "0"); | ||
@@ -2308,6 +2310,17 @@ CurlConnection::CurlConnection( | ||
} | ||
} | ||
|
||
+ if (!options.CAPath.empty()) | ||
+ { | ||
+ if (!SetLibcurlOption(m_handle, CURLOPT_CAPATH, options.CAPath.c_str(), &result)) | ||
+ { | ||
+ throw Azure::Core::Http::TransportException( | ||
+ _detail::DefaultFailedToGetNewConnectionTemplate + hostDisplayName | ||
+ + ". Failed to set CA path to:" + options.CAPath + ". " | ||
+ + std::string(curl_easy_strerror(result))); | ||
+ } | ||
+ } | ||
+ | ||
if (!options.SslOptions.PemEncodedExpectedRootCertificates.empty()) | ||
{ | ||
curl_blob rootCertBlob |
28 changes: 28 additions & 0 deletions
28
cpp/third_party/vcpkg_overlays/azure-core-cpp/portfile.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
vcpkg_from_github( | ||
OUT_SOURCE_PATH SOURCE_PATH | ||
REPO Azure/azure-sdk-for-cpp | ||
REF azure-core_1.10.0 | ||
SHA512 8917d5a3934a743bd8b44dacc12c3cd410cd59f1fa596c36a50f78562a1c7fe7a189c762e4099f3b24d23fcf5dcb0243ac3f139f1d345e6283ff4b5db418ecda | ||
PATCHES | ||
capath.patch | ||
) | ||
|
||
vcpkg_check_features( | ||
OUT_FEATURE_OPTIONS FEATURE_OPTIONS | ||
FEATURES | ||
curl BUILD_TRANSPORT_CURL | ||
winhttp BUILD_TRANSPORT_WINHTTP | ||
) | ||
|
||
vcpkg_cmake_configure( | ||
SOURCE_PATH "${SOURCE_PATH}/sdk/core/azure-core/" | ||
OPTIONS | ||
${FEATURE_OPTIONS} | ||
-DWARNINGS_AS_ERRORS=OFF | ||
) | ||
|
||
vcpkg_cmake_install() | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
vcpkg_cmake_config_fixup() | ||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") | ||
vcpkg_copy_pdbs() |
Oops, something went wrong.