1 --- gnutls-3.5.16/lib/x509/verify-high2.c.orig 2016-12-19 15:10:59.000000000 +0100
2 +++ gnutls-3.5.16/lib/x509/verify-high2.c 2017-12-26 16:39:02.565137168 +0100
10 /* Convenience functions for verify-high functionality
17 +static inline char *FromWide (const wchar_t *wide)
19 + size_t len = WideCharToMultiByte (CP_UTF8, 0, wide, -1, NULL, 0, NULL, NULL);
23 + char *out = (char *)malloc (len);
26 + WideCharToMultiByte (CP_UTF8, 0, wide, -1, out, len, NULL, NULL);
30 +static inline wchar_t *ToWide (const char *utf8)
32 + int len = MultiByteToWideChar (CP_UTF8, 0, utf8, -1, NULL, 0);
36 + wchar_t *out = (wchar_t *)malloc (len * sizeof (wchar_t));
39 + MultiByteToWideChar (CP_UTF8, 0, utf8, -1, out, len);
44 int load_dir_certs(const char *dirname,
45 gnutls_x509_trust_list_t list,
46 unsigned int tl_flags, unsigned int tl_vflags,
47 unsigned type, unsigned crl)
55 char path[GNUTLS_PATH_MAX];
57 - dirp = opendir(dirname);
58 + TCHAR* dirnameW = ToWide(dirname);
59 + dirp = _topendir(dirnameW);
64 + d = _treaddir(dirp);
66 #ifdef _DIRENT_HAVE_D_TYPE
67 && (d->d_type == DT_REG || d->d_type == DT_LNK || d->d_type == DT_UNKNOWN)
70 + char* d_name = FromWide(d->d_name);
71 snprintf(path, sizeof(path), "%s/%s",
72 - dirname, d->d_name);