From c2f321010a06e4ccf8d8ec61f8673850c7d175e2 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sun, 20 Mar 2016 10:24:18 +0000 Subject: add certificate authority bundle handling to windows The curl certificate handling on windows does not have a compiled in default location so it is necessary to attempt to find a default bundle. This provides a bundle in the install and code to set it as the default bundle location. --- windows/main.c | 27 +++++++++++++++++++++++++++ windows/res/ca-bundle.crt | 1 + windows/res/installer.nsi | 3 ++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 120000 windows/res/ca-bundle.crt (limited to 'windows') diff --git a/windows/main.c b/windows/main.c index f4eec12e3..7a23f711c 100644 --- a/windows/main.c +++ b/windows/main.c @@ -98,6 +98,33 @@ static nserror set_defaults(struct nsoption_s *defaults) { /* Set defaults for absent option strings */ + /* locate CA bundle and set as default, cannot rely on curl + * compiled in default on windows. + */ + DWORD res_len; + DWORD buf_tchar_size = PATH_MAX + 1; + DWORD buf_bytes_size = sizeof(TCHAR) * buf_tchar_size; + char *ptr = NULL; + + char *buf; + + buf = malloc(buf_bytes_size); + if (buf== NULL) { + return NSERROR_NOMEM; + } + buf[0] = '\0'; + + res_len = SearchPathA(NULL, + "ca-bundle.crt", + NULL, + buf_tchar_size, + buf, + &ptr); + if (res_len > 0) { + nsoption_setnull_charp(ca_bundle, strdup(buf)); + } + free(buf); + /* ensure homepage option has a default */ nsoption_setnull_charp(homepage_url, strdup(NETSURF_HOMEPAGE)); diff --git a/windows/res/ca-bundle.crt b/windows/res/ca-bundle.crt new file mode 120000 index 000000000..ad2dd6b55 --- /dev/null +++ b/windows/res/ca-bundle.crt @@ -0,0 +1 @@ +../../!NetSurf/Resources/ca-bundle \ No newline at end of file diff --git a/windows/res/installer.nsi b/windows/res/installer.nsi index a934533ee..a65478420 100644 --- a/windows/res/installer.nsi +++ b/windows/res/installer.nsi @@ -8,7 +8,7 @@ !define DESCRIPTION "Web Browser" # These three must be integers !define VERSIONMAJOR 3 -!define VERSIONMINOR 0 +!define VERSIONMINOR 4 !define VERSIONBUILD 1 # These will be displayed by the "Click here for support information" link in "Add/Remove Programs" # It is possible to use "mailto:" links in here to open the email client @@ -62,6 +62,7 @@ section "install" file /oname=welcome.html "windows\res\welcome.html" file /oname=netsurf.png "windows\res\netsurf.png" file /oname=messages "build-Linux-windows\messages" + file /oname=ca-bundle.crt "windows\res\ca-bundle.crt" # Add any other files for the install directory (license files, app data, etc) here # Uninstaller - See function un.onInit and section "uninstall" for configuration -- cgit v1.2.3