summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_cert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/ssl_cert.c')
-rw-r--r--src/lib/libssl/ssl_cert.c30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/lib/libssl/ssl_cert.c b/src/lib/libssl/ssl_cert.c
index da90078a37..3d31bbf05f 100644
--- a/src/lib/libssl/ssl_cert.c
+++ b/src/lib/libssl/ssl_cert.c
@@ -781,7 +781,7 @@ err:
781#endif 781#endif
782#endif 782#endif
783 783
784#else /* OPENSSL_SYS_WIN32 */ 784#else
785 785
786int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 786int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
787 const char *dir) 787 const char *dir)
@@ -789,30 +789,10 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
789 WIN32_FIND_DATA FindFileData; 789 WIN32_FIND_DATA FindFileData;
790 HANDLE hFind; 790 HANDLE hFind;
791 int ret = 0; 791 int ret = 0;
792#ifdef OPENSSL_SYS_WINCE
793 WCHAR* wdir = NULL;
794#endif
795 792
796 CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 793 CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
797 794
798#ifdef OPENSSL_SYS_WINCE
799 /* convert strings to UNICODE */
800 {
801 BOOL result = FALSE;
802 int i;
803 wdir = malloc((strlen(dir)+1)*2);
804 if (wdir == NULL)
805 goto err_noclose;
806 for (i=0; i<(int)strlen(dir)+1; i++)
807 wdir[i] = (short)dir[i];
808 }
809#endif
810
811#ifdef OPENSSL_SYS_WINCE
812 hFind = FindFirstFile(wdir, &FindFileData);
813#else
814 hFind = FindFirstFile(dir, &FindFileData); 795 hFind = FindFirstFile(dir, &FindFileData);
815#endif
816 /* Note that a side effect is that the CAs will be sorted by name */ 796 /* Note that a side effect is that the CAs will be sorted by name */
817 if(hFind == INVALID_HANDLE_VALUE) 797 if(hFind == INVALID_HANDLE_VALUE)
818 { 798 {
@@ -827,11 +807,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
827 char buf[1024]; 807 char buf[1024];
828 int r; 808 int r;
829 809
830#ifdef OPENSSL_SYS_WINCE
831 if(strlen(dir)+_tcslen(FindFileData.cFileName)+2 > sizeof buf)
832#else
833 if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf) 810 if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf)
834#endif
835 { 811 {
836 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); 812 SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
837 goto err; 813 goto err;
@@ -849,10 +825,6 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
849err: 825err:
850 FindClose(hFind); 826 FindClose(hFind);
851err_noclose: 827err_noclose:
852#ifdef OPENSSL_SYS_WINCE
853 if (wdir != NULL)
854 free(wdir);
855#endif
856 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); 828 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
857 return ret; 829 return ret;
858 } 830 }