mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 19:35:39 +01:00
- Fixed WIN32 version of x509parse_crtpath()
This commit is contained in:
parent
d6f17b492f
commit
3338b792da
@ -1874,14 +1874,25 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
int t_ret;
|
int w_ret;
|
||||||
TCHAR szDir[MAX_PATH];
|
WCHAR szDir[MAX_PATH];
|
||||||
WIN32_FIND_DATA file_data;
|
char filename[MAX_PATH];
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
WIN32_FIND_DATA file_data;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
DWORD dwError = 0;
|
DWORD dwError = 0;
|
||||||
|
|
||||||
StringCchCopy(szDir, MAX_PATH, path);
|
memset( szDir, 0, sizeof(szDir) );
|
||||||
StringCchCat(szDir, MAX_PATH, TEXT("\\*"));
|
memset( filename, 0, MAX_PATH );
|
||||||
|
memcpy( filename, path, strlen( path ) );
|
||||||
|
filename[strlen( path )] = '\\';
|
||||||
|
p = filename + strlen( path ) + 1;
|
||||||
|
|
||||||
|
w_ret = MultiByteToWideChar( CP_ACP, 0, path, strlen(path), szDir, MAX_PATH - 3 );
|
||||||
|
|
||||||
|
StringCchCopyW(szDir, MAX_PATH, szDir);
|
||||||
|
StringCchCatW(szDir, MAX_PATH, TEXT("\\*"));
|
||||||
|
|
||||||
hFind = FindFirstFile( szDir, &file_data );
|
hFind = FindFirstFile( szDir, &file_data );
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
@ -1889,14 +1900,21 @@ int x509parse_crtpath( x509_cert *chain, const char *path )
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
memset( p, 0, filename + MAX_PATH - p - 1 );
|
||||||
|
|
||||||
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
if( file_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
t_ret = x509parse_crtfile( chain, entry_name );
|
w_ret = WideCharToMultiByte( CP_ACP, 0, file_data.cFileName,
|
||||||
if( t_ret < 0 )
|
lstrlenW(file_data.cFileName),
|
||||||
return( t_ret );
|
p,
|
||||||
|
filename + MAX_PATH - p - 2, NULL, NULL );
|
||||||
|
|
||||||
ret += t_ret;
|
w_ret = x509parse_crtfile( chain, filename );
|
||||||
|
if( w_ret < 0 )
|
||||||
|
return( w_ret );
|
||||||
|
|
||||||
|
ret += w_ret;
|
||||||
}
|
}
|
||||||
while( FindNextFile( hFind, &file_data ) != 0 );
|
while( FindNextFile( hFind, &file_data ) != 0 );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user