SSL_add_dir_cert_subjects_to_stack for Win32 finally implemented.
Submitted by Massimo Santin <msantin@santineassociati.com>.
This commit is contained in:
parent
f8000b9345
commit
285046ec51
3
CHANGES
3
CHANGES
@ -12,6 +12,9 @@
|
|||||||
*) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
|
*) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
|
||||||
+) applies to 0.9.7 only
|
+) applies to 0.9.7 only
|
||||||
|
|
||||||
|
+) Add an implementation of SSL_add_dir_cert_subjects_to_stack for Win32.
|
||||||
|
[Massimo Santin via Richard Levitte]
|
||||||
|
|
||||||
+) Major restructuring to the underlying ENGINE code. This includes
|
+) Major restructuring to the underlying ENGINE code. This includes
|
||||||
reduction of linker bloat, separation of pure "ENGINE" manipulation
|
reduction of linker bloat, separation of pure "ENGINE" manipulation
|
||||||
(initialisation, etc) from functionality dealing with implementations
|
(initialisation, etc) from functionality dealing with implementations
|
||||||
|
@ -115,6 +115,10 @@
|
|||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(WIN32)
|
||||||
|
#include <windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef NeXT
|
#ifdef NeXT
|
||||||
#include <sys/dir.h>
|
#include <sys/dir.h>
|
||||||
#define dirent direct
|
#define dirent direct
|
||||||
@ -771,4 +775,52 @@ err:
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
|
||||||
|
const char *dir)
|
||||||
|
{
|
||||||
|
WIN32_FIND_DATA FindFileData;
|
||||||
|
HANDLE hFind;
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
|
CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
|
||||||
|
|
||||||
|
hFind = FindFirstFile(dir, &FindFileData);
|
||||||
|
/* Note that a side effect is that the CAs will be sorted by name */
|
||||||
|
if(hFind == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
SYSerr(SYS_F_OPENDIR, get_last_sys_error());
|
||||||
|
ERR_add_error_data(3, "opendir('", dir, "')");
|
||||||
|
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf)
|
||||||
|
{
|
||||||
|
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,FindFileData.cFileName);
|
||||||
|
if (r <= 0 || r >= sizeof buf)
|
||||||
|
goto err;
|
||||||
|
if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
while (FindNextFile(hFind, &FindFileData) != FALSE);
|
||||||
|
FindClose(hFind);
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
|
err:
|
||||||
|
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user