php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #65154
Patch php-openssl-setup-verify revision 2014-03-13 14:37 UTC by bholbrook at bomgar dot com

Patch php-openssl-setup-verify for OpenSSL related Bug #65154

Patch version 2014-03-13 14:37 UTC

Return to Bug #65154 | Download this patch
Patch Revisions:

Developer: bholbrook@bomgar.com

diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 91d3d9b..d909187 100755
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -2239,7 +2239,7 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC)
 	X509_STORE *store;
 	X509_LOOKUP * dir_lookup, * file_lookup;
 	HashPosition pos;
-	int ndirs = 0, nfiles = 0;
+	int ntargets = 0;
 
 	store = X509_STORE_new();
 
@@ -2268,7 +2268,7 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC)
 				if (file_lookup == NULL || !X509_LOOKUP_load_file(file_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) {
 					php_error_docref(NULL TSRMLS_CC, E_WARNING, "error loading file %s", Z_STRVAL_PP(item));
 				} else {
-					nfiles++;
+					ntargets++;
 				}
 				file_lookup = NULL;
 			} else {
@@ -2276,19 +2276,17 @@ static X509_STORE * setup_verify(zval * calist TSRMLS_DC)
 				if (dir_lookup == NULL || !X509_LOOKUP_add_dir(dir_lookup, Z_STRVAL_PP(item), X509_FILETYPE_PEM)) {
 					php_error_docref(NULL TSRMLS_CC, E_WARNING, "error loading directory %s", Z_STRVAL_PP(item));
 				} else { 
-					ndirs++;
+					ntargets++;
 				}
 				dir_lookup = NULL;
 			}
 		}
 	}
-	if (nfiles == 0) {
+	if (ntargets == 0) {
 		file_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
 		if (file_lookup) {
 			X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT);
 		}
-	}
-	if (ndirs == 0) {
 		dir_lookup = X509_STORE_add_lookup(store, X509_LOOKUP_hash_dir());
 		if (dir_lookup) {
 			X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT);
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 19 02:01:34 2019 UTC