diff options
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | 44.patch | 287 | ||||
| -rw-r--r-- | PHPINFO | 2 | ||||
| -rw-r--r-- | REFLECTION | 64 | ||||
| -rw-r--r-- | php-pecl-ssh2.spec | 23 | 
5 files changed, 54 insertions, 324 deletions
@@ -1,5 +1,7 @@ +clog  package-*.xml  *.tgz +*.tar.bz2  *.tar.gz  *.tar.xz  *.tar.xz.asc diff --git a/44.patch b/44.patch deleted file mode 100644 index 3af71f1..0000000 --- a/44.patch +++ /dev/null @@ -1,287 +0,0 @@ -From 167a679db79a93c27b7bb367bef9e0d9abdc47d0 Mon Sep 17 00:00:00 2001 -From: Andy Postnikov <apostnikov@gmail.com> -Date: Mon, 13 Jul 2020 20:13:34 +0300 -Subject: [PATCH 1/4] Fix compatibility with 8.0 - call_user_function_ex - ---- - ssh2.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/ssh2.c b/ssh2.c -index 5a1deef..ee60f7b 100644 ---- a/ssh2.c -+++ b/ssh2.c -@@ -100,7 +100,7 @@ LIBSSH2_DEBUG_FUNC(php_ssh2_debug_cb) - 	ZVAL_STRINGL(&args[1], language, language_len); - 	ZVAL_LONG(&args[2], always_display); -  --	if (FAILURE == call_user_function_ex(NULL, NULL, data->disconnect_cb, NULL, 3, args, 0, NULL)) { -+	if (FAILURE == call_user_function(NULL, NULL, data->disconnect_cb, NULL, 3, args)) { - 		php_error_docref(NULL, E_WARNING, "Failure calling disconnect callback"); - 	} - } -@@ -125,7 +125,7 @@ LIBSSH2_IGNORE_FUNC(php_ssh2_ignore_cb) -  - 	ZVAL_STRINGL(&args[0], message, message_len); -  --	if (FAILURE == call_user_function_ex(NULL, NULL, data->ignore_cb, &zretval, 1, args, 0, NULL)) { -+	if (FAILURE == call_user_function(NULL, NULL, data->ignore_cb, &zretval, 1, args)) { - 		php_error_docref(NULL, E_WARNING, "Failure calling ignore callback"); - 	} - 	if (Z_TYPE_P(&zretval) != IS_UNDEF) { -@@ -155,7 +155,7 @@ LIBSSH2_MACERROR_FUNC(php_ssh2_macerror_cb) -  - 	ZVAL_STRINGL(&args[0], packet, packet_len); -  --	if (FAILURE == call_user_function_ex(NULL, NULL, data->macerror_cb, &zretval, 1, args, 0, NULL)) { -+	if (FAILURE == call_user_function(NULL, NULL, data->macerror_cb, &zretval, 1, args)) { - 		php_error_docref(NULL, E_WARNING, "Failure calling macerror callback"); - 	} else { - 		retval = zval_is_true(&zretval) ? 0 : -1; -@@ -188,7 +188,7 @@ LIBSSH2_DISCONNECT_FUNC(php_ssh2_disconnect_cb) - 	ZVAL_STRINGL(&args[1], message, message_len); - 	ZVAL_STRINGL(&args[2], language, language_len); -  --	if (FAILURE == call_user_function_ex(NULL, NULL, data->disconnect_cb, NULL, 3, args, 0, NULL)) { -+	if (FAILURE == call_user_function(NULL, NULL, data->disconnect_cb, NULL, 3, args)) { - 		php_error_docref(NULL, E_WARNING, "Failure calling disconnect callback"); - 	} - } - -From 9e6074a4eae3b4ebbe883ba1b93c9eccb9c78d02 Mon Sep 17 00:00:00 2001 -From: Andy Postnikov <apostnikov@gmail.com> -Date: Mon, 13 Jul 2020 23:32:53 +0300 -Subject: [PATCH 3/4] Fix function definition arguments - -- ssh2_poll() updated outdated ZEND_ARG_PASS_INFO usage and argument names -- added argument definition for ssh2_forward_listen() and ssh2_forward_accept() ---- - ssh2.c | 28 +++++++++++++++++++++------- - 1 file changed, 21 insertions(+), 7 deletions(-) - -diff --git a/ssh2.c b/ssh2.c -index ee60f7b..4605f1a 100644 ---- a/ssh2.c -+++ b/ssh2.c -@@ -45,10 +45,6 @@ int le_ssh2_listener; - int le_ssh2_sftp; - int le_ssh2_pkey_subsys; -  --ZEND_BEGIN_ARG_INFO(php_ssh2_first_arg_force_ref, 0) --	ZEND_ARG_PASS_INFO(1) --ZEND_END_ARG_INFO() -- - /* ************* -    * Callbacks * -    ************* */ -@@ -1416,6 +1412,19 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_ssh2_auth_hostbased_file, 0, 0, 5) -  	ZEND_ARG_INFO(0, local_username) - ZEND_END_ARG_INFO() -  -+ZEND_BEGIN_ARG_INFO_EX(arginfo_ssh2_forward_listen, 0, 0, 2) -+ 	ZEND_ARG_INFO(0, session) -+ 	ZEND_ARG_INFO(0, port) -+ 	ZEND_ARG_INFO(0, host) -+ 	ZEND_ARG_INFO(0, max_connections) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_ssh2_forward_accept, 0, 0, 1) -+ 	ZEND_ARG_INFO(0, listener) -+ 	ZEND_ARG_INFO(1, host) -+ 	ZEND_ARG_INFO(0, port) -+ZEND_END_ARG_INFO() -+ - ZEND_BEGIN_ARG_INFO_EX(arginfo_ssh2_shell, 0, 0, 1) -  	ZEND_ARG_INFO(0, session) -  	ZEND_ARG_INFO(0, termtype) -@@ -1459,6 +1468,11 @@ ZEND_BEGIN_ARG_INFO(arginfo_ssh2_fetch_stream, 2) -  	ZEND_ARG_INFO(0, streamid) - ZEND_END_ARG_INFO() -  -+ZEND_BEGIN_ARG_INFO_EX(arginfo_ssh2_poll, 0, 0, 1) -+ 	ZEND_ARG_INFO(1, polldes) -+ 	ZEND_ARG_INFO(0, timeout) -+ZEND_END_ARG_INFO() -+ - ZEND_BEGIN_ARG_INFO(arginfo_ssh2_sftp, 1) -  	ZEND_ARG_INFO(0, session) - ZEND_END_ARG_INFO() -@@ -1559,8 +1573,8 @@ zend_function_entry ssh2_functions[] = { - 	PHP_FE(ssh2_auth_pubkey_file,				arginfo_ssh2_auth_pubkey_file) - 	PHP_FE(ssh2_auth_hostbased_file,			arginfo_ssh2_auth_hostbased_file) -  --	PHP_FE(ssh2_forward_listen,					NULL) --	PHP_FE(ssh2_forward_accept,					NULL) -+	PHP_FE(ssh2_forward_listen,					arginfo_ssh2_forward_listen) -+	PHP_FE(ssh2_forward_accept,					arginfo_ssh2_forward_accept) -  - 	/* Stream Stuff */ - 	PHP_FE(ssh2_shell,							arginfo_ssh2_shell) -@@ -1569,7 +1583,7 @@ zend_function_entry ssh2_functions[] = { - 	PHP_FE(ssh2_scp_recv,						arginfo_ssh2_scp_recv) - 	PHP_FE(ssh2_scp_send,						arginfo_ssh2_scp_send) - 	PHP_FE(ssh2_fetch_stream,					arginfo_ssh2_fetch_stream) --	PHP_FE(ssh2_poll,							php_ssh2_first_arg_force_ref) -+	PHP_FE(ssh2_poll,							arginfo_ssh2_poll) -  - 	/* SFTP Stuff */ - 	PHP_FE(ssh2_sftp,							arginfo_ssh2_sftp) - -From c9647c5d296e8693d0b5672f1c22945ea024ebdc Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Thu, 10 Sep 2020 15:53:52 +0200 -Subject: [PATCH 4/4] fix for PHP 7.4 (stream API) and 8.0 - ---- - ssh2.c                |  4 +--- - ssh2_fopen_wrappers.c | 26 +++++++++++++++++++------- - ssh2_sftp.c           | 20 ++++++++++++++++++++ - 3 files changed, 40 insertions(+), 10 deletions(-) - -diff --git a/ssh2.c b/ssh2.c -index 4605f1a..31ee8f7 100644 ---- a/ssh2.c -+++ b/ssh2.c -@@ -436,9 +436,7 @@ PHP_FUNCTION(ssh2_disconnect) - 		RETURN_FALSE; - 	} -  --	if (zend_list_close(Z_RES_P(zsession)) != SUCCESS) { --		RETURN_FALSE; --	} -+	zend_list_close(Z_RES_P(zsession)); -  - 	RETURN_TRUE; - } -diff --git a/ssh2_fopen_wrappers.c b/ssh2_fopen_wrappers.c -index ef82134..d79a051 100644 ---- a/ssh2_fopen_wrappers.c -+++ b/ssh2_fopen_wrappers.c -@@ -40,10 +40,14 @@ void *php_ssh2_zval_from_resource_handle(int handle) { -    * channel_stream_ops * -    ********************** */ -  -+#if PHP_VERSION_ID < 70400 - static size_t php_ssh2_channel_stream_write(php_stream *stream, const char *buf, size_t count) -+#else -+static ssize_t php_ssh2_channel_stream_write(php_stream *stream, const char *buf, size_t count) -+#endif - { - 	php_ssh2_channel_data *abstract = (php_ssh2_channel_data*)stream->abstract; --	size_t writestate; -+	ssize_t writestate; - 	LIBSSH2_SESSION *session; -  - 	libssh2_channel_set_blocking(abstract->channel, abstract->is_blocking); -@@ -64,24 +68,31 @@ static size_t php_ssh2_channel_stream_write(php_stream *stream, const char *buf, - 		libssh2_session_set_timeout(session, 0); - 	} - #endif -+ - 	if (writestate == LIBSSH2_ERROR_EAGAIN) { -+#if PHP_VERSION_ID < 70400 - 		writestate = 0; --	} -- --	if (writestate < 0) { -+#endif -+	} else if (writestate < 0) { - 		char *error_msg = NULL; - 		if (libssh2_session_last_error(session, &error_msg, NULL, 0) == writestate) { - 			php_error_docref(NULL, E_WARNING, "Failure '%s' (%ld)", error_msg, writestate); - 		} -  - 		stream->eof = 1; -+#if PHP_VERSION_ID < 70400 - 		writestate = 0; -+#endif - 	} -  - 	return writestate; - } -  -+#if PHP_VERSION_ID < 70400 - static size_t php_ssh2_channel_stream_read(php_stream *stream, char *buf, size_t count) -+#else -+static ssize_t php_ssh2_channel_stream_read(php_stream *stream, char *buf, size_t count) -+#endif - { - 	php_ssh2_channel_data *abstract = (php_ssh2_channel_data*)stream->abstract; - 	ssize_t readstate; -@@ -104,11 +115,12 @@ static size_t php_ssh2_channel_stream_read(php_stream *stream, char *buf, size_t - 		libssh2_session_set_timeout(session, 0); - 	} - #endif -+ - 	if (readstate == LIBSSH2_ERROR_EAGAIN) { -+#if PHP_VERSION_ID < 70400 - 		readstate = 0; --	} -- --	if (readstate < 0) { -+#endif -+	} else if (readstate < 0) { - 		char *error_msg = NULL; - 		if (libssh2_session_last_error(session, &error_msg, NULL, 0) == readstate) { - 			php_error_docref(NULL, E_WARNING, "Failure '%s' (%ld)", error_msg, readstate); -diff --git a/ssh2_sftp.c b/ssh2_sftp.c -index ae8f6f8..0f62d35 100644 ---- a/ssh2_sftp.c -+++ b/ssh2_sftp.c -@@ -103,20 +103,32 @@ typedef struct _php_ssh2_sftp_handle_data { -  - /* {{{ php_ssh2_sftp_stream_write -  */ -+#if PHP_VERSION_ID < 70400 - static size_t php_ssh2_sftp_stream_write(php_stream *stream, const char *buf, size_t count) -+#else -+static ssize_t php_ssh2_sftp_stream_write(php_stream *stream, const char *buf, size_t count) -+#endif - { - 	php_ssh2_sftp_handle_data *data = (php_ssh2_sftp_handle_data*)stream->abstract; - 	ssize_t bytes_written; -  - 	bytes_written = libssh2_sftp_write(data->handle, buf, count); -  -+#if PHP_VERSION_ID < 70400 - 	return (size_t)(bytes_written<0 ? 0 : bytes_written); -+#else -+	return bytes_written; -+#endif - } - /* }}} */ -  - /* {{{ php_ssh2_sftp_stream_read -  */ -+#if PHP_VERSION_ID < 70400 - static size_t php_ssh2_sftp_stream_read(php_stream *stream, char *buf, size_t count) -+#else -+static ssize_t php_ssh2_sftp_stream_read(php_stream *stream, char *buf, size_t count) -+#endif - { - 	php_ssh2_sftp_handle_data *data = (php_ssh2_sftp_handle_data*)stream->abstract; - 	ssize_t bytes_read; -@@ -125,7 +137,11 @@ static size_t php_ssh2_sftp_stream_read(php_stream *stream, char *buf, size_t co -  - 	stream->eof = (bytes_read <= 0 && bytes_read != LIBSSH2_ERROR_EAGAIN); -  -+#if PHP_VERSION_ID < 70400 - 	return (size_t)(bytes_read<0 ? 0 : bytes_read); -+#else -+	return bytes_read; -+#endif - } - /* }}} */ -  -@@ -264,7 +280,11 @@ static php_stream *php_ssh2_sftp_stream_opener(php_stream_wrapper *wrapper, cons -  - /* {{{ php_ssh2_sftp_dirstream_read -  */ -+#if PHP_VERSION_ID < 70400 - static size_t php_ssh2_sftp_dirstream_read(php_stream *stream, char *buf, size_t count) -+#else -+static ssize_t php_ssh2_sftp_dirstream_read(php_stream *stream, char *buf, size_t count) -+#endif - { - 	php_ssh2_sftp_handle_data *data = (php_ssh2_sftp_handle_data*)stream->abstract; - 	php_stream_dirent *ent = (php_stream_dirent*)buf; @@ -2,6 +2,6 @@  ssh2  SSH2 support => enabled -extension version => 1.2 +extension version => 1.3  libssh2 version => 1.9.0  banner => SSH-2.0-libssh2_1.9.0 @@ -1,27 +1,27 @@ -Extension [ <persistent> extension #148 ssh2 version 1.2 ] { +Extension [ <persistent> extension #120 ssh2 version 1.3 ] {    - Constants [21] { -    Constant [ integer SSH2_FINGERPRINT_MD5 ] { 0 } -    Constant [ integer SSH2_FINGERPRINT_SHA1 ] { 1 } -    Constant [ integer SSH2_FINGERPRINT_HEX ] { 0 } -    Constant [ integer SSH2_FINGERPRINT_RAW ] { 2 } -    Constant [ integer SSH2_TERM_UNIT_CHARS ] { 0 } -    Constant [ integer SSH2_TERM_UNIT_PIXELS ] { 1 } +    Constant [ int SSH2_FINGERPRINT_MD5 ] { 0 } +    Constant [ int SSH2_FINGERPRINT_SHA1 ] { 1 } +    Constant [ int SSH2_FINGERPRINT_HEX ] { 0 } +    Constant [ int SSH2_FINGERPRINT_RAW ] { 2 } +    Constant [ int SSH2_TERM_UNIT_CHARS ] { 0 } +    Constant [ int SSH2_TERM_UNIT_PIXELS ] { 1 }      Constant [ string SSH2_DEFAULT_TERMINAL ] { vanilla } -    Constant [ integer SSH2_DEFAULT_TERM_WIDTH ] { 80 } -    Constant [ integer SSH2_DEFAULT_TERM_HEIGHT ] { 25 } -    Constant [ integer SSH2_DEFAULT_TERM_UNIT ] { 0 } -    Constant [ integer SSH2_STREAM_STDIO ] { 0 } -    Constant [ integer SSH2_STREAM_STDERR ] { 1 } -    Constant [ integer SSH2_POLLIN ] { 1 } -    Constant [ integer SSH2_POLLEXT ] { 2 } -    Constant [ integer SSH2_POLLOUT ] { 4 } -    Constant [ integer SSH2_POLLERR ] { 8 } -    Constant [ integer SSH2_POLLHUP ] { 16 } -    Constant [ integer SSH2_POLLNVAL ] { 32 } -    Constant [ integer SSH2_POLL_SESSION_CLOSED ] { 16 } -    Constant [ integer SSH2_POLL_CHANNEL_CLOSED ] { 128 } -    Constant [ integer SSH2_POLL_LISTENER_CLOSED ] { 128 } +    Constant [ int SSH2_DEFAULT_TERM_WIDTH ] { 80 } +    Constant [ int SSH2_DEFAULT_TERM_HEIGHT ] { 25 } +    Constant [ int SSH2_DEFAULT_TERM_UNIT ] { 0 } +    Constant [ int SSH2_STREAM_STDIO ] { 0 } +    Constant [ int SSH2_STREAM_STDERR ] { 1 } +    Constant [ int SSH2_POLLIN ] { 1 } +    Constant [ int SSH2_POLLEXT ] { 2 } +    Constant [ int SSH2_POLLOUT ] { 4 } +    Constant [ int SSH2_POLLERR ] { 8 } +    Constant [ int SSH2_POLLHUP ] { 16 } +    Constant [ int SSH2_POLLNVAL ] { 32 } +    Constant [ int SSH2_POLL_SESSION_CLOSED ] { 16 } +    Constant [ int SSH2_POLL_CHANNEL_CLOSED ] { 128 } +    Constant [ int SSH2_POLL_LISTENER_CLOSED ] { 128 }    }    - Functions { @@ -91,8 +91,21 @@ Extension [ <persistent> extension #148 ssh2 version 1.2 ] {        }      }      Function [ <internal:ssh2> function ssh2_forward_listen ] { + +      - Parameters [4] { +        Parameter #0 [ <required> $session ] +        Parameter #1 [ <required> $port ] +        Parameter #2 [ <optional> $host ] +        Parameter #3 [ <optional> $max_connections ] +      }      }      Function [ <internal:ssh2> function ssh2_forward_accept ] { + +      - Parameters [3] { +        Parameter #0 [ <required> $listener ] +        Parameter #1 [ <optional> &$host ] +        Parameter #2 [ <optional> $port ] +      }      }      Function [ <internal:ssh2> function ssh2_shell ] { @@ -151,8 +164,15 @@ Extension [ <persistent> extension #148 ssh2 version 1.2 ] {      }      Function [ <internal:ssh2> function ssh2_poll ] { +      - Parameters [2] { +        Parameter #0 [ <required> &$polldes ] +        Parameter #1 [ <optional> $timeout ] +      } +    } +    Function [ <internal:ssh2> function ssh2_send_eof ] { +        - Parameters [1] { -        Parameter #0 [ <required> &$param0 ] +        Parameter #0 [ <required> $channel ]        }      }      Function [ <internal:ssh2> function ssh2_sftp ] { diff --git a/php-pecl-ssh2.spec b/php-pecl-ssh2.spec index 7b7a486..8d0a760 100644 --- a/php-pecl-ssh2.spec +++ b/php-pecl-ssh2.spec @@ -1,7 +1,7 @@  # remirepo spec file for php-pecl-ssh2  # with SCL compatibility  # -# Copyright (c) 2011-2020 Remi Collet +# Copyright (c) 2011-2021 Remi Collet  #  # Fedora spec file for php-pecl-ssh2  # @@ -27,23 +27,22 @@  Name:           %{?sub_prefix}php-pecl-ssh2  Summary:        Bindings for the libssh2 library -Version:        1.2 +Version:        1.3  %if 0%{?gh_date}  Release:        0.8.%{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:        4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release:        1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}  Source0:        https://pecl.php.net/get/%{pecl_name}-%{version}.tgz  %endif -Patch0:         https://patch-diff.githubusercontent.com/raw/php/pecl-networking-ssh2/pull/44.patch -  License:        PHP  URL:            https://pecl.php.net/package/%{pecl_name} +BuildRequires:  make  BuildRequires:  libssh2-devel >= 1.2  BuildRequires:  %{?dtsprefix}gcc -BuildRequires:  %{?scl_prefix}php-devel > 7 +BuildRequires:  %{?scl_prefix}php-devel >= 7.0  BuildRequires:  %{?scl_prefix}php-pear  Requires:       %{?scl_prefix}php(zend-abi) = %{php_zend_api} @@ -80,12 +79,6 @@ Obsoletes:      php80-pecl-%{pecl_name} <= %{version}  %endif  %endif -%if 0%{?fedora} < 20 && 0%{?rhel} < 7 -# Filter private shared -%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} -%{?filter_setup} -%endif -  %description  Bindings to the libssh2 library which provide access to resources @@ -118,8 +111,6 @@ sed -e 's/role="test"/role="src"/' \      -i package.xml  cd NTS -%patch0 -p1 -b .pr43 -  extver=$(sed -n '/#define PHP_SSH2_VERSION/{s/.*\t"//;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}. @@ -232,6 +223,10 @@ fi  %changelog +* Tue Mar  2 2021 Remi Collet <remi@remirepo.net> - 1.3-1 +- update to 1.3 +- drop patch merged upstream +  * Wed Sep 30 2020 Remi Collet <remi@remirepo.net> - 1.2-4  - rebuild for PHP 8.0.0RC1  | 
