com php-src: group the change for bug #74720: ext/openssl/openssl.c
| From: | Anatol Belski | Date: | Fri, 09 Jun 2017 21:47:15 +0000 |
| Subject: | com php-src: group the change for bug #74720: ext/openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98047@lists.php.net to get a copy of this message | ||
Commit: 0fa40b054618317bfe5e076da614da27b4304fa4
Author: Anatol Belski <ab@php.net> Fri, 9 Jun 2017 23:47:15 +0200
Parents: 6d46528d54dc5ffc9242d23aaa2d15332b5ebd17
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0fa40b054618317bfe5e076da614da27b4304fa4
Log:
group the change for bug #74720
Bugs:
https://bugs.php.net/74720
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 4adf9cb..8418e40 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -87,6 +87,14 @@
#define HAVE_EVP_PKEY_EC 1
#endif
+#ifdef PHP_WIN32
+#define PHP_OPENSSL_BIO_MODE_R(flags) (((flags) & PKCS7_BINARY) ? "rb" :
"r")
+#define PHP_OPENSSL_BIO_MODE_W(flags) (((flags) & PKCS7_BINARY) ? "wb" :
"w")
+#else
+#define PHP_OPENSSL_BIO_MODE_R(flags) "r"
+#define PHP_OPENSSL_BIO_MODE_W(flags) "w"
+#endif
+
ZEND_DECLARE_MODULE_GLOBALS(openssl)
/* FIXME: Use the openssl constants instead of
@@ -5008,7 +5016,7 @@ PHP_FUNCTION(openssl_pkcs7_verify)
goto clean_exit;
}
- in = BIO_new_file(filename, (flags & PKCS7_BINARY) ? "rb" : "r");
+ in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(flags));
if (in == NULL) {
php_openssl_store_errors();
goto clean_exit;
@@ -5120,7 +5128,7 @@ PHP_FUNCTION(openssl_pkcs7_encrypt)
return;
}
- infile = BIO_new_file(infilename, (flags & PKCS7_BINARY) ? "rb" : "r");
+ infile = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(flags));
if (infile == NULL) {
php_openssl_store_errors();
goto clean_exit;
@@ -5278,7 +5286,7 @@ PHP_FUNCTION(openssl_pkcs7_sign)
goto clean_exit;
}
- infile = BIO_new_file(infilename, (flags & PKCS7_BINARY) ? "rb" : "r");
+ infile = BIO_new_file(infilename, PHP_OPENSSL_BIO_MODE_R(flags));
if (infile == NULL) {
php_openssl_store_errors();
php_error_docref(NULL, E_WARNING, "error opening input file %s!", infilename);