diff options
-rw-r--r-- | php-pecl-ssh2-php7.spec | 13 | ||||
-rw-r--r-- | ssh2-php7013.patch | 77 |
2 files changed, 88 insertions, 2 deletions
diff --git a/php-pecl-ssh2-php7.spec b/php-pecl-ssh2-php7.spec index 010d528..1234c77 100644 --- a/php-pecl-ssh2-php7.spec +++ b/php-pecl-ssh2-php7.spec @@ -30,13 +30,15 @@ Version: 1.0 Release: 0.2.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz %else -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Source0: http://pecl.php.net/get/ssh2-%{version}.tgz %endif Summary: Bindings for the libssh2 library %global buildver %(pkg-config --silence-errors --modversion libssh2 2>/dev/null || echo 65536) +Patch0: %{pecl_name}-php7013.patch + License: PHP Group: Development/Languages URL: http://pecl.php.net/package/ssh2 @@ -114,12 +116,16 @@ sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -extver=$(sed -n '/#define PHP_SSH2_VERSION/{s/.* "//;s/".*$//;p}' NTS/php_ssh2.h) +cd NTS +%patch0 -p1 -b .php7013 + +extver=$(sed -n '/#define PHP_SSH2_VERSION/{s/.* "//;s/".*$//;p}' php_ssh2.h) if test "x${extver}" != "x%{version}%{?gh_date:-dev}"; then : Error: Upstream version is now ${extver}, expecting %{version}%{?gh_date:-dev}. : Update the pdover macro and rebuild. exit 1 fi +cd .. cat > %{ini_name} << 'EOF' ; Enable ssh2 extension module @@ -221,6 +227,9 @@ fi %changelog +* Thu Nov 10 2016 Remi Collet <remi@fedoraproject.org> - 1.0-3 +- add patch for parse_url change in PHP 7.0.13 + * Wed Sep 14 2016 Remi Collet <remi@fedoraproject.org> - 1.0-2 - rebuild for PHP 7.1 new API version diff --git a/ssh2-php7013.patch b/ssh2-php7013.patch new file mode 100644 index 0000000..099d442 --- /dev/null +++ b/ssh2-php7013.patch @@ -0,0 +1,77 @@ +Adapted for 1.0 from: + + +From 17680cf039f0cfac53b5a2531fdb715b95e9cc42 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 | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c +index c8d1d07..17444dc 100644 +--- a/ssh2_fopen_wrappers.c ++++ b/ssh2_fopen_wrappers.c +@@ -213,10 +213,19 @@ + 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)); ++ resource = php_url_parse(tmp); ++ efree(tmp); ++ } else { ++ resource = php_url_parse(path); ++ } + if (!resource || !resource->path) { + return NULL; + } +@@ -247,9 +256,6 @@ + + /* 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 + +From 756e2f1369f2d5ff006222d978806f4fd91659e1 Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Thu, 10 Nov 2016 09:33:25 +0100 +Subject: [PATCH] fix Invalid write of size 1 + +--- + ssh2_fopen_wrappers.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c +index 17444dc..ffbd6e3 100644 +--- a/ssh2_fopen_wrappers.c ++++ b/ssh2_fopen_wrappers.c +@@ -220,7 +220,8 @@ php_url *php_ssh2_fopen_wraper_parse_path(const char *path, char *type, php_stre + 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)); ++ ++ strncpy(tmp + (h-path), h + sizeof("Resource id #")-1, strlen(tmp)-sizeof("Resource id #")); + resource = php_url_parse(tmp); + efree(tmp); + } else { +-- +2.1.4 + |