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 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'windows/main.c') 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)); -- cgit v1.2.3