mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix linking ext/curl against OpenSSL (#13262)
This is backport for 8.3 ofb222c020bf
that originally targeted only 8.4+. This is however a bug fix. Following68f6ab7113
, the ext/curl doesn't need to be linked against OpenSSL anymore, if curl_version_info_data ssl_version is OpenSSL/1.1 or later. With OpenSSL 3 and later the check for old SSL crypto locking callbacks was detected here. This also uses a common PHP_SETUP_OPENSSL macro for checking OpenSSL and syncs the minimum OpenSSL version (currently 1.0.2 or later) across the PHP build system.
This commit is contained in:
parent
4162c20787
commit
ae92b85572
2 changed files with 15 additions and 8 deletions
1
NEWS
1
NEWS
|
@ -8,6 +8,7 @@ PHP NEWS
|
|||
|
||||
- Curl:
|
||||
. Fix memory leak when setting a list via curl_setopt fails. (nielsdos)
|
||||
. Fix incorrect OpenSSL version detection. (Peter Kokot)
|
||||
|
||||
- Date:
|
||||
. Fix leaks with multiple calls to DatePeriod iterator current(). (nielsdos)
|
||||
|
|
|
@ -28,6 +28,7 @@ if test "$PHP_CURL" != "no"; then
|
|||
|
||||
AC_MSG_CHECKING([for libcurl linked against old openssl])
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
#include <strings.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
|
@ -39,10 +40,19 @@ int main(int argc, char *argv[])
|
|||
const char *ptr = data->ssl_version;
|
||||
|
||||
while(*ptr == ' ') ++ptr;
|
||||
if (strncasecmp(ptr, "OpenSSL/1.1", sizeof("OpenSSL/1.1")-1) == 0) {
|
||||
/* New OpenSSL version */
|
||||
int major, minor;
|
||||
if (sscanf(ptr, "OpenSSL/%d", &major) == 1) {
|
||||
if (major >= 3) {
|
||||
/* OpenSSL version 3 or later */
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
if (sscanf(ptr, "OpenSSL/%d.%d", &major, &minor) == 2) {
|
||||
if (major > 1 || (major == 1 && minor >= 1)) {
|
||||
/* OpenSSL version 1.1 or later */
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
if (strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1) == 0) {
|
||||
/* Old OpenSSL version */
|
||||
return 0;
|
||||
|
@ -56,11 +66,7 @@ int main(int argc, char *argv[])
|
|||
]])],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL])
|
||||
PKG_CHECK_MODULES([OPENSSL], [openssl], [
|
||||
PHP_EVAL_LIBLINE($OPENSSL_LIBS, CURL_SHARED_LIBADD)
|
||||
PHP_EVAL_INCLINE($OPENSSL_CFLAGS)
|
||||
AC_CHECK_HEADERS([openssl/crypto.h])
|
||||
], [])
|
||||
PHP_SETUP_OPENSSL(CURL_SHARED_LIBADD,[AC_CHECK_HEADERS([openssl/crypto.h])],[])
|
||||
], [
|
||||
AC_MSG_RESULT([no])
|
||||
], [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue