Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 90 additions & 60 deletions mingw-w64-curl/0001-Make-cURL-relocatable.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 9bc4150738ef5d92b0050f8539758c8f03335442 Mon Sep 17 00:00:00 2001
From 80b680d4796d1ce913185dbaf4c36c6a64669e86 Mon Sep 17 00:00:00 2001
From: Ray Donnelly <[email protected]>
Date: Wed, 22 Feb 2017 11:03:04 +0100
Subject: [PATCH 1/2] Make cURL relocatable
Expand All @@ -25,14 +25,14 @@ Signed-off-by: Johannes Schindelin <[email protected]>
configure.ac | 1 +
lib/Makefile.inc | 2 ++
lib/curl_config.h.in | 3 +++
lib/url.c | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 44 insertions(+)
lib/vtls/vtls.c | 49 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 55 insertions(+)

diff --git a/configure.ac b/configure.ac
index aba3d82af..2d30abb2c 100644
index cc16f4120..827d04948 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4027,6 +4027,7 @@ dnl default includes
@@ -4069,6 +4069,7 @@ dnl default includes
]
)

Expand All @@ -41,18 +41,18 @@ index aba3d82af..2d30abb2c 100644
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
index b384e0962..216fec947 100644
index 8b506febc..841e8a7ea 100644
--- a/lib/Makefile.inc
+++ b/lib/Makefile.inc
@@ -225,6 +225,7 @@ LIB_CFILES = \
@@ -229,6 +229,7 @@ LIB_CFILES = \
noproxy.c \
openldap.c \
parsedate.c \
+ pathtools.c \
pingpong.c \
pop3.c \
progress.c \
@@ -357,6 +358,7 @@ LIB_HFILES = \
@@ -361,6 +362,7 @@ LIB_HFILES = \
netrc.h \
noproxy.h \
parsedate.h \
Expand All @@ -61,7 +61,7 @@ index b384e0962..216fec947 100644
pop3.h \
progress.h \
diff --git a/lib/curl_config.h.in b/lib/curl_config.h.in
index 87d60a274..990895776 100644
index 668be5ea1..9c3139764 100644
--- a/lib/curl_config.h.in
+++ b/lib/curl_config.h.in
@@ -14,6 +14,9 @@
Expand All @@ -74,75 +74,105 @@ index 87d60a274..990895776 100644
/* Default SSL backend */
#undef CURL_DEFAULT_SSL_BACKEND

diff --git a/lib/url.c b/lib/url.c
index dac24b35e..6fe831e1e 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -121,6 +121,9 @@
#include "curlx/dynbuf.h"
#include "headers.h"
#include "curlx/strparse.h"
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
index df0449cbe..bb45551b0 100644
--- a/lib/vtls/vtls.c
+++ b/lib/vtls/vtls.c
@@ -81,6 +81,10 @@
#include <Security/Security.h>
#endif

+#if defined(__MINGW32__)
+#include "pathtools.h"
+#include "../pathtools.h"
+#endif
/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
@@ -430,22 +433,57 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
if(Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL &&
Curl_ssl_backend() != CURLSSLBACKEND_SECURETRANSPORT) {
#ifdef CURL_CA_BUNDLE
+
/* The last #include files should be: */
#include "../curl_memory.h"
#include "../memdebug.h"
@@ -297,6 +301,15 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
#if defined(CURL_CA_PATH) || defined(CURL_CA_BUNDLE)
struct UserDefined *set = &data->set;
CURLcode result;
+#ifdef __MINGW32__
+ const size_t path_max = PATH_MAX;
+#ifdef CURL_CA_PATH
+ char relocated_ca_path[path_max];
+#endif
+#ifdef CURL_CA_BUNDLE
+ char relocated_bundle[path_max];
+ get_dll_path(relocated_bundle, path_max);
+ strip_n_suffix_folders(relocated_bundle, 1);
+ strncat(relocated_bundle, "/", path_max - 1);
+ char *relative = get_relative_path(CURL_BINDIR, CURL_CA_BUNDLE);
+ strncat(relocated_bundle, relative, path_max - 1);
+ free((void*)relative);
+ simplify_path(relocated_bundle);
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], relocated_bundle);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE);
+#endif /* defined(__MINGW32__) */
if(result)
return result;
#ifndef CURL_DISABLE_PROXY
+#if defined(__MINGW32__)
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
+ relocated_bundle);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
CURL_CA_BUNDLE);
+#endif
if(result)
return result;
+#endif /* defined(__MINGW32__) */
#endif

if(Curl_ssl_backend() != CURLSSLBACKEND_SCHANNEL) {
@@ -305,16 +318,42 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
sslc->native_ca_store = TRUE;
#endif
#ifdef CURL_CA_PATH
+#ifdef __MINGW32__
+ const size_t path_max = PATH_MAX;
+ char relocated_ca_path[path_max];
+ get_dll_path(relocated_ca_path, path_max);
+ strip_n_suffix_folders(relocated_ca_path, 1);
+ strncat(relocated_ca_path, "/", path_max - 1);
+ char *relative = get_relative_path(CURL_BINDIR, CURL_CA_PATH);
+ strncat(relocated_ca_path, relative, path_max - 1);
+ free((void*)relative);
+ simplify_path(relocated_ca_path);
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], relocated_ca_path);
+#endif /* defined(__MINGW32__) */
if(!sslc->custom_capath && !set->str[STRING_SSL_CAPATH]) {
+#ifdef __MINGW32__
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], relocated_ca_path);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], CURL_CA_PATH);
result = Curl_setstropt(&set->str[STRING_SSL_CAPATH], CURL_CA_PATH);
+#endif /* defined(__MINGW32__) */
if(result)
return result;
#ifndef CURL_DISABLE_PROXY
+#if defined(__MINGW32__)
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], relocated_ca_path);
if(result)
return result;
}
sslc->primary.CApath = data->set.str[STRING_SSL_CAPATH];
#endif
#ifdef CURL_CA_BUNDLE
+#ifdef __MINGW32__
+ get_dll_path(relocated_bundle, path_max);
+ strip_n_suffix_folders(relocated_bundle, 1);
+ strncat(relocated_bundle, "/", path_max - 1);
+ char *relative = get_relative_path(CURL_BINDIR, CURL_CA_BUNDLE);
+ strncat(relocated_bundle, relative, path_max - 1);
+ free((void*)relative);
+ simplify_path(relocated_bundle);
+#endif /* defined(__MINGW32__) */
if(!sslc->custom_cafile && !set->str[STRING_SSL_CAFILE]) {
+#ifdef __MINGW32__
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], relocated_bundle);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY], CURL_CA_PATH);
+#endif
if(result)
return result;
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE);
+#endif /* defined(__MINGW32__) */
if(result)
return result;
}
@@ -353,8 +392,13 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
#endif
#ifdef CURL_CA_PATH
if(!sslc->custom_capath && !set->str[STRING_SSL_CAPATH_PROXY]) {
+#ifdef __MINGW32__
+ result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY],
+ relocated_ca_path);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAPATH_PROXY],
CURL_CA_PATH);
+#endif /* defined(__MINGW32__) */
if(result)
return result;
}
@@ -362,8 +406,13 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
#endif
#ifdef CURL_CA_BUNDLE
if(!sslc->custom_cafile && !set->str[STRING_SSL_CAFILE_PROXY]) {
+#ifdef __MINGW32__
+ result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
+ relocated_bundle);
+#else
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE_PROXY],
CURL_CA_BUNDLE);
+#endif /* defined(__MINGW32__) */
if(result)
return result;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From 538ef176222d618321769e714c1d4d81372736db Mon Sep 17 00:00:00 2001
From 5022c4e5a2bd1483c70f2e8177eb51edd36139eb Mon Sep 17 00:00:00 2001
From: Johannes Schindelin <[email protected]>
Date: Wed, 31 Oct 2018 10:52:59 +0100
Subject: [PATCH 2/2] Hack: make relocation work inside libexec/git-core/ and
Expand Down Expand Up @@ -26,14 +26,14 @@ extend the Git for Windows-specific hack with a hard-code `bin/` case.

Signed-off-by: Johannes Schindelin <[email protected]>
---
lib/url.c | 21 ++++++++++++++++++++-
lib/vtls/vtls.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/lib/url.c b/lib/url.c
index 6fe831e1e..5a99ede5b 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -439,10 +439,29 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data)
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
index bb45551b0..a864fb758 100644
--- a/lib/vtls/vtls.c
+++ b/lib/vtls/vtls.c
@@ -343,10 +343,29 @@ CURLcode Curl_ssl_easy_config_complete(struct Curl_easy *data)
get_dll_path(relocated_bundle, path_max);
strip_n_suffix_folders(relocated_bundle, 1);
strncat(relocated_bundle, "/", path_max - 1);
Expand All @@ -53,14 +53,14 @@ index 6fe831e1e..5a99ede5b 100644
free((void*)relative);
simplify_path(relocated_bundle);
+ if (access(relocated_bundle, R_OK) != 0 &&
+ (len = strlen(relocated_bundle)) >= 28 &&
+ !strcmp(relocated_bundle + len - 28, "/etc/ssl/certs/ca-bundle.crt")) {
+ (len = strlen(relocated_bundle)) >= 28 &&
+ !strcmp(relocated_bundle + len - 28, "/etc/ssl/certs/ca-bundle.crt")) {
+ /* Try without /etc/ */
+ memmove(relocated_bundle + len - 28, relocated_bundle + len - 24, 25);
+ if (access(relocated_bundle, R_OK) != 0)
+ /* fall back to using /etc/ */
+ strcat(relocated_bundle + len - 28, "/etc/ssl/certs/ca-bundle.crt");
+ }
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], relocated_bundle);
#else
result = Curl_setstropt(&set->str[STRING_SSL_CAFILE], CURL_CA_BUNDLE);
#endif /* defined(__MINGW32__) */
if(!sslc->custom_cafile && !set->str[STRING_SSL_CAFILE]) {
#ifdef __MINGW32__
104 changes: 0 additions & 104 deletions mingw-w64-curl/0003-ip-happy-do-not-set-unnecessary-timeout.patch

This file was deleted.

Loading