summaryrefslogtreecommitdiff
path: root/windows
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-03-20 10:24:18 +0000
committerVincent Sanders <vince@kyllikki.org>2016-03-20 10:24:18 +0000
commitc2f321010a06e4ccf8d8ec61f8673850c7d175e2 (patch)
treee91282e5311d6cfe771346ca6e1c261baa3eace0 /windows
parentd15ab96a51287469082e8d9068e2608a386f9e5f (diff)
downloadnetsurf-c2f321010a06e4ccf8d8ec61f8673850c7d175e2.tar.gz
netsurf-c2f321010a06e4ccf8d8ec61f8673850c7d175e2.tar.bz2
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.
Diffstat (limited to 'windows')
-rw-r--r--windows/main.c27
l---------windows/res/ca-bundle.crt1
-rw-r--r--windows/res/installer.nsi3
3 files changed, 30 insertions, 1 deletions
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