diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-03-20 10:24:18 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-03-20 10:24:18 +0000 |
commit | c2f321010a06e4ccf8d8ec61f8673850c7d175e2 (patch) | |
tree | e91282e5311d6cfe771346ca6e1c261baa3eace0 /windows/main.c | |
parent | d15ab96a51287469082e8d9068e2608a386f9e5f (diff) | |
download | netsurf-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/main.c')
-rw-r--r-- | windows/main.c | 27 |
1 files changed, 27 insertions, 0 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)); |