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.
This commit is contained in:
Vincent Sanders 2016-03-20 10:24:18 +00:00
parent d15ab96a51
commit c2f321010a
3 changed files with 30 additions and 1 deletions

View File

@ -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));

1
windows/res/ca-bundle.crt Symbolic link
View File

@ -0,0 +1 @@
../../!NetSurf/Resources/ca-bundle

View File

@ -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