Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mnhauke:mingw:win64:sdr
mingw64-curl
curl-8.7.1-fix-finding-cacert.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File curl-8.7.1-fix-finding-cacert.patch of Package mingw64-curl
diff -ur curl-8.7.1.orig/src/tool_doswin.c curl-8.7.1/src/tool_doswin.c --- curl-8.7.1.orig/src/tool_doswin.c 2024-03-25 09:48:59.000000000 +0100 +++ curl-8.7.1/src/tool_doswin.c 2024-05-02 11:23:50.440109537 +0200 @@ -599,6 +599,25 @@ #ifdef _WIN32 +static char * +get_root_path(const char *root_path, int size) +{ + if (GetModuleFileName(NULL, root_path, size) == 0) + return NULL; + char *p = strstr(root_path, "\\bin\\"); + if (p) + *p = '\0'; + return root_path; +} + +BOOL file_exists(LPCTSTR szPath) +{ + DWORD dwAttrib = GetFileAttributes(szPath); + + return (dwAttrib != INVALID_FILE_ATTRIBUTES && + !(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)); +} + /* * Function to find CACert bundle on a Win32 platform using SearchPath. * (SearchPath is already declared via inclusions done in setup header file) @@ -632,8 +651,23 @@ TCHAR buf[PATH_MAX]; TCHAR *ptr = NULL; - buf[0] = TEXT('\0'); + if (get_root_path(buf, sizeof(buf))) { + if (strcat_s(buf, sizeof(buf), "/etc/pki/tls/certs/") || + strcat_s(buf, sizeof(buf), bundle_file)) + return CURLE_OUT_OF_MEMORY; + if (file_exists(buf)) { + char *mstr = curlx_convert_tchar_to_UTF8(buf); + Curl_safefree(config->cacert); + if(mstr) + config->cacert = strdup(mstr); + curlx_unicodefree(mstr); + if(!config->cacert) + result = CURLE_OUT_OF_MEMORY; + return result; + } + } + buf[0] = TEXT('\0'); res_len = SearchPath(NULL, bundle_file, NULL, PATH_MAX, buf, &ptr); if(res_len > 0) { char *mstr = curlx_convert_tchar_to_UTF8(buf);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor