diff options
author | Remi Collet <fedora@famillecollet.com> | 2016-11-10 10:31:02 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2016-11-10 10:31:02 +0100 |
commit | ccf268ab6a69becd43d73296c89e894ab019b859 (patch) | |
tree | 6af3bb3ac1075e6afc1abd4b059800b403f05f37 | |
parent | 0445e3625a370dc97296da31be7b332d97f7ab9e (diff) |
php-pecl-ssh2: add patch for PHP 5.6.28 (for test)
-rw-r--r-- | php-pecl-ssh2.spec | 16 | ||||
-rw-r--r-- | ssh2-php5628.patch | 49 |
2 files changed, 61 insertions, 4 deletions
diff --git a/php-pecl-ssh2.spec b/php-pecl-ssh2.spec index c459a85..e63d236 100644 --- a/php-pecl-ssh2.spec +++ b/php-pecl-ssh2.spec @@ -18,7 +18,7 @@ %scl_package php-pecl-ssh2 %endif -%global with_zts 0%{?__ztsphp:1} +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name ssh2 %if "%{php_version}" < "5.6" %global ini_name %{pecl_name}.ini @@ -28,7 +28,7 @@ Name: %{?sub_prefix}php-pecl-ssh2 Version: 0.13 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: Bindings for the libssh2 library %global buildver %(pkg-config --silence-errors --modversion libssh2 2>/dev/null || echo 65536) @@ -39,9 +39,11 @@ URL: http://pecl.php.net/package/ssh2 Source0: http://pecl.php.net/get/ssh2-%{version}.tgz Source2: php-pecl-ssh2-0.10-README +Patch0: %{pecl_name}-php5628.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: libssh2-devel >= 1.2 -BuildRequires: %{?scl_prefix}php-devel +BuildRequires: %{?scl_prefix}php-devel < 7 BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -100,13 +102,16 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml mv %{pecl_name}-%{version} NTS +cd NTS +%patch0 -p1 -b .php7013 -extver=$(sed -n '/#define PHP_SSH2_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_ssh2.h) +extver=$(sed -n '/#define PHP_SSH2_VERSION/{s/.* "//;s/".*$//;p}' php_ssh2.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream version is now ${extver}, expecting %{version}. : Update the pdover macro and rebuild. exit 1 fi +cd .. cp %{SOURCE2} README @@ -216,6 +221,9 @@ rm -rf %{buildroot} %changelog +* Thu Nov 10 2016 Remi Collet <remi@fedoraproject.org> - 0.13-2 +- add patch for parse_url change in PHP 5.6.28 + * Sun Jun 12 2016 Remi Collet <remi@fedoraproject.org> - 0.13-1 - update to 0.13 diff --git a/ssh2-php5628.patch b/ssh2-php5628.patch new file mode 100644 index 0000000..c9c052f --- /dev/null +++ b/ssh2-php5628.patch @@ -0,0 +1,49 @@ +From 093906ec1c065e86ad1cd4dabbc89b1ccae11938 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Thu, 10 Nov 2016 09:16:02 +0100 +Subject: [PATCH] fix for PHP 7.0.13 where php_url_parse fails + +--- + ssh2_fopen_wrappers.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c +index 8472ddd..89b34eb 100644 +--- a/ssh2_fopen_wrappers.c ++++ b/ssh2_fopen_wrappers.c +@@ -198,10 +198,20 @@ php_url *php_ssh2_fopen_wraper_parse_path( char *path, char *type, php_stream_co + php_url *resource; + zval *methods = NULL, *callbacks = NULL, zsession, **tmpzval; + long resource_id; +- char *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL; ++ char *h, *s, *username = NULL, *password = NULL, *pubkey_file = NULL, *privkey_file = NULL; + int username_len = 0, password_len = 0; + +- resource = php_url_parse(path); ++ h = strstr(path, "Resource id #"); ++ if (h) { ++ /* Starting with 5.6.28, 7.0.13 need to be clean, else php_url_parse will fail */ ++ char *tmp = estrdup(path); ++ ++ strncpy(tmp + (h-path), h + sizeof("Resource id #")-1, strlen(tmp)-sizeof("Resource id #")); ++ resource = php_url_parse(tmp); ++ efree(tmp); ++ } else { ++ resource = php_url_parse(path); ++ } + if (!resource || !resource->path) { + return NULL; + } +@@ -232,9 +242,6 @@ php_url *php_ssh2_fopen_wraper_parse_path( char *path, char *type, php_stream_co + + /* Look for a resource ID to reuse a session */ + s = resource->host; +- if (strncmp(resource->host, "Resource id #", sizeof("Resource id #") - 1) == 0) { +- s = resource->host + sizeof("Resource id #") - 1; +- } + if (is_numeric_string(s, strlen(s), &resource_id, NULL, 0) == IS_LONG) { + php_ssh2_sftp_data *sftp_data; + +-- +2.1.4 + |