Updated patches.
This commit is contained in:
parent
4e4a8be21e
commit
34d8e2fc39
6
build.sh
6
build.sh
@ -163,9 +163,9 @@ pkg_curl="$(find "${LIBS_DIR}" -maxdepth 1 -name 'curl-*.tar.gz' | sort -rn | he
|
||||
rm -rf "${CURL_DIR}" && mkdir "${CURL_DIR}"
|
||||
tar -xvf ${pkg_curl} --strip-components=1 -C "${CURL_DIR}"
|
||||
pushd "${CURL_DIR}"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_findw32cacert.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_mutex_init.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_parseconfig.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_threads.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_doswin.diff"
|
||||
patch -p1 -b < "${BASE_DIR}/patch/curl_tool_parsecfg.diff"
|
||||
cp -vf "${LIBS_DIR}/cacert.pem" curl-ca-bundle.crt
|
||||
sed -i -E 's/\bmain[[:space:]]*\(([^\(\)]*)\)/wmain(\1)/g' configure
|
||||
CFLAGS="-municode -mconsole -march=${MY_MARCH} -mtune=${MY_MTUNE} -I\"${LIBS_DIR}/include\"" CPPFLAGS="-DNGHTTP2_STATICLIB" LDFLAGS="-static -no-pthread -L\"${LIBS_DIR}/lib\"" LIBS="-latomic -liconv -lcrypt32" PKG_CONFIG_PATH="${LIBS_DIR}/pkgconfig" ./configure --enable-static --disable-shared --disable-pthreads --disable-libcurl-option --disable-openssl-auto-load-config --with-zlib="${LIBS_DIR}" --with-zstd="${LIBS_DIR}" --with-brotli="${LIBS_DIR}" --with-openssl="${LIBS_DIR}" --with-libssh2="${LIBS_DIR}" --with-nghttp2="${LIBS_DIR}" --with-libidn2="${LIBS_DIR}" --with-ca-bundle="curl-ca-bundle.crt"
|
||||
|
@ -1,49 +0,0 @@
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c"
|
||||
index 98e13bc..34d6496 100644
|
||||
--- "a/src/tool_doswin.c"
|
||||
+++ "b/src/tool_doswin.c"
|
||||
@@ -627,22 +627,32 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
|
||||
if((curlinfo->features & CURL_VERSION_SSL) &&
|
||||
backend != CURLSSLBACKEND_SCHANNEL) {
|
||||
|
||||
- DWORD res_len;
|
||||
- TCHAR buf[PATH_MAX];
|
||||
- TCHAR *ptr = NULL;
|
||||
-
|
||||
- buf[0] = TEXT('\0');
|
||||
-
|
||||
- res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
|
||||
- if(res_len > 0) {
|
||||
- Curl_safefree(config->cacert);
|
||||
+ static const size_t BUFFSIZE = 512;
|
||||
+ TCHAR filebuffer[BUFFSIZE];
|
||||
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
|
||||
+ if(len > 0 && len < BUFFSIZE) {
|
||||
#ifdef UNICODE
|
||||
- config->cacert = curlx_convert_wchar_to_UTF8(buf);
|
||||
+ char *bundle_name = curlx_convert_wchar_to_UTF8(bundle_file);
|
||||
+ char *module_path = curlx_convert_wchar_to_UTF8(filebuffer);
|
||||
#else
|
||||
- config->cacert = strdup(buf);
|
||||
+ char *bundle_name = strdup(bundle_file);
|
||||
+ char *module_path = strdup(filebuffer);
|
||||
#endif
|
||||
- if(!config->cacert)
|
||||
+ if (module_path && bundle_name) {
|
||||
+ char *lastdirchar = strrchr(module_path, '\\');
|
||||
+ if(lastdirchar) {
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ Curl_safefree(config->cacert);
|
||||
+ config->cacert = curl_maprintf("%s%s%s", module_path, DIR_CHAR, bundle_name);
|
||||
+ if(!config->cacert)
|
||||
+ result = CURLE_OUT_OF_MEMORY;
|
||||
+ }
|
||||
+ else
|
||||
result = CURLE_OUT_OF_MEMORY;
|
||||
+
|
||||
+ free(bundle_name);
|
||||
+ free(module_path);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h" "b/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h"
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h.orig" "b/D:\\_Sandbox\\curl\\curl-src\\lib\\curl_threads.h"
|
||||
index e10b7a1..22fdb49 100644
|
||||
--- "a/lib/curl_threads.h"
|
||||
+++ "b/lib/curl_threads.h"
|
91
patch/curl_tool_doswin.diff
Normal file
91
patch/curl_tool_doswin.diff
Normal file
@ -0,0 +1,91 @@
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c.orig" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_doswin.c"
|
||||
index 98e13bc..2fcd28f 100644
|
||||
--- "a/src/tool_doswin.c"
|
||||
+++ "b/src/tool_doswin.c"
|
||||
@@ -612,6 +612,52 @@ char **__crt0_glob_function(char *arg)
|
||||
* HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SafeProcessSearchMode
|
||||
*/
|
||||
|
||||
+static BOOL file_exists(const char *filename)
|
||||
+{
|
||||
+ DWORD attribs = INVALID_FILE_ATTRIBUTES;
|
||||
+#ifdef UNICODE
|
||||
+ wchar_t *filename_w = curlx_convert_UTF8_to_wchar(filename);
|
||||
+ if (filename_w) {
|
||||
+ attribs = GetFileAttributes(filename_w);
|
||||
+ free(filename_w);
|
||||
+ }
|
||||
+#else
|
||||
+ attribs = GetFileAttributes(filename)
|
||||
+#endif
|
||||
+ return (attribs != INVALID_FILE_ATTRIBUTES) && (!(attribs & FILE_ATTRIBUTE_DIRECTORY));
|
||||
+}
|
||||
+
|
||||
+static char *execpath(const TCHAR *filename)
|
||||
+{
|
||||
+ static const size_t BUFFSIZE = 512;
|
||||
+ char *cacert = NULL;
|
||||
+ TCHAR filebuffer[BUFFSIZE];
|
||||
+
|
||||
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
|
||||
+ if(len > 0 && len < BUFFSIZE) {
|
||||
+#ifdef UNICODE
|
||||
+ char *filename_utf8 = curlx_convert_wchar_to_UTF8(filename);
|
||||
+ char *execpath_utf8 = curlx_convert_wchar_to_UTF8(filebuffer);
|
||||
+ if (filename_utf8 && execpath_utf8) {
|
||||
+ char *lastdirchar = strrchr(execpath_utf8, '\\');
|
||||
+ if(lastdirchar) {
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ cacert = curl_maprintf("%s%s%s", execpath_utf8, DIR_CHAR, filename_utf8);
|
||||
+ }
|
||||
+ free(filename_utf8);
|
||||
+ free(execpath_utf8);
|
||||
+#else
|
||||
+ char *lastdirchar = strrchr(filebuffer, '\\');
|
||||
+ if(lastdirchar) {
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ cacert = curl_maprintf("%s%s%s", filebuffer, DIR_CHAR, filename);
|
||||
+#endif
|
||||
+ }
|
||||
+ return cacert;
|
||||
+}
|
||||
+
|
||||
CURLcode FindWin32CACert(struct OperationConfig *config,
|
||||
curl_sslbackend backend,
|
||||
const TCHAR *bundle_file)
|
||||
@@ -627,23 +673,17 @@ CURLcode FindWin32CACert(struct OperationConfig *config,
|
||||
if((curlinfo->features & CURL_VERSION_SSL) &&
|
||||
backend != CURLSSLBACKEND_SCHANNEL) {
|
||||
|
||||
- DWORD res_len;
|
||||
- TCHAR buf[PATH_MAX];
|
||||
- TCHAR *ptr = NULL;
|
||||
-
|
||||
- buf[0] = TEXT('\0');
|
||||
-
|
||||
- res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr);
|
||||
- if(res_len > 0) {
|
||||
- Curl_safefree(config->cacert);
|
||||
-#ifdef UNICODE
|
||||
- config->cacert = curlx_convert_wchar_to_UTF8(buf);
|
||||
-#else
|
||||
- config->cacert = strdup(buf);
|
||||
-#endif
|
||||
- if(!config->cacert)
|
||||
- result = CURLE_OUT_OF_MEMORY;
|
||||
+ char *cacert = execpath(bundle_file, &result);
|
||||
+ if (cacert) {
|
||||
+ if (file_exists(cacert)) {
|
||||
+ Curl_safefree(config->cacert);
|
||||
+ config->cacert = cacert;
|
||||
+ }
|
||||
+ else
|
||||
+ free(cacert);
|
||||
}
|
||||
+ else
|
||||
+ result = CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return result;
|
@ -1,25 +1,42 @@
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c"
|
||||
index d26774f..e0b97c1 100644
|
||||
diff --git "a/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c.orig" "b/D:\\_Sandbox\\curl\\curl-src\\src\\tool_parsecfg.c"
|
||||
index d26774f..ab1d28f 100644
|
||||
--- "a/src/tool_parsecfg.c"
|
||||
+++ "b/src/tool_parsecfg.c"
|
||||
@@ -47,28 +47,34 @@ static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error);
|
||||
@@ -47,28 +47,39 @@ static bool my_get_line(FILE *fp, struct curlx_dynbuf *, bool *error);
|
||||
#ifdef WIN32
|
||||
static FILE *execpath(const char *filename)
|
||||
{
|
||||
- char filebuffer[512];
|
||||
+ static const size_t BUFFSIZE = 512;
|
||||
+ FILE *file = NULL;
|
||||
+ TCHAR filebuffer[BUFFSIZE];
|
||||
/* Get the filename of our executable. GetModuleFileName is already declared
|
||||
- /* Get the filename of our executable. GetModuleFileName is already declared
|
||||
- * via inclusions done in setup header file. We assume that we are using
|
||||
- * the ASCII version here.
|
||||
+ * via inclusions done in setup header file.
|
||||
*/
|
||||
- */
|
||||
- unsigned long len = GetModuleFileNameA(0, filebuffer, sizeof(filebuffer));
|
||||
- if(len > 0 && len < sizeof(filebuffer)) {
|
||||
- /* We got a valid filename - get the directory part */
|
||||
- char *lastdirchar = strrchr(filebuffer, '\\');
|
||||
- if(lastdirchar) {
|
||||
+ static const size_t BUFFSIZE = 512;
|
||||
+ FILE *file = NULL;
|
||||
+ TCHAR filebuffer[BUFFSIZE];
|
||||
+
|
||||
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
|
||||
+ if(len > 0 && len < BUFFSIZE) {
|
||||
+#ifdef UNICODE
|
||||
+ char *execpath_utf8 = curlx_convert_wchar_to_UTF8(filebuffer);
|
||||
+ if (execpath_utf8) {
|
||||
+ char *lastdirchar = strrchr(execpath_utf8, '\\');
|
||||
+ if(lastdirchar) {
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ char *full_path = curl_maprintf("%s%s%s", execpath_utf8, DIR_CHAR, filename);
|
||||
+ if (full_path) {
|
||||
+ file = fopen(full_path, FOPEN_READTEXT);
|
||||
+ free(full_path);
|
||||
+ }
|
||||
+ free(execpath_utf8);
|
||||
+ }
|
||||
+#else
|
||||
char *lastdirchar = strrchr(filebuffer, '\\');
|
||||
if(lastdirchar) {
|
||||
- size_t remaining;
|
||||
- *lastdirchar = 0;
|
||||
- /* If we have enough space, build the RC filename */
|
||||
@ -27,33 +44,23 @@ index d26774f..e0b97c1 100644
|
||||
- if(strlen(filename) < remaining - 1) {
|
||||
- msnprintf(lastdirchar, remaining, "%s%s", DIR_CHAR, filename);
|
||||
- return fopen(filebuffer, FOPEN_READTEXT);
|
||||
+ unsigned long len = GetModuleFileName(0, filebuffer, BUFFSIZE);
|
||||
+ if(len > 0 && len < BUFFSIZE) {
|
||||
+#ifdef UNICODE
|
||||
+ char *module_path = curlx_convert_wchar_to_UTF8(filebuffer);
|
||||
+#else
|
||||
+ char *module_path = strdup(filebuffer);
|
||||
+#endif
|
||||
+ if (module_path) {
|
||||
+ char *lastdirchar = strrchr(module_path, '\\');
|
||||
+ if(lastdirchar) {
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ char *file_path = curl_maprintf("%s%s%s", module_path, DIR_CHAR, filename);
|
||||
+ if (file_path) {
|
||||
+ file = fopen(file_path, FOPEN_READTEXT);
|
||||
+ free(file_path);
|
||||
}
|
||||
+ free(module_path);
|
||||
- }
|
||||
+ *lastdirchar = '\0';
|
||||
+ }
|
||||
+ char *full_path = curl_maprintf("%s%s%s", filebuffer, DIR_CHAR, filename);
|
||||
+ if (full_path) {
|
||||
+ file = fopen(full_path, FOPEN_READTEXT);
|
||||
+ free(full_path);
|
||||
}
|
||||
+#endif
|
||||
}
|
||||
|
||||
-
|
||||
- return NULL;
|
||||
+ return file;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -85,7 +91,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
||||
@@ -85,7 +96,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
||||
if(!filename || !*filename) {
|
||||
/* NULL or no file name attempts to load .curlrc from the homedir! */
|
||||
|
Loading…
Reference in New Issue
Block a user