# --- SDE-COPYRIGHT-NOTE-BEGIN --- # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # # Filename: package/.../php-ssh2/real_tunnel.patch # Copyright (C) 2010 The OpenSDE Project # # More information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License as published by the Free Software # Foundation; either version 2 of the License, or (at your option) any later # version. # --- SDE-COPYRIGHT-NOTE-END --- http://pecl.php.net/bugs/bug.php?id=9612 patch sugested by Volkan K. --- ./ssh2_fopen_wrappers.c.orig 2008-12-03 00:06:54.000000000 +0200 +++ ./ssh2_fopen_wrappers.c 2010-08-31 21:13:54.811788140 +0300 @@ -1070,13 +1070,13 @@ /* {{{ php_ssh2_direct_tcpip * Make a stream from a session */ -static php_stream *php_ssh2_direct_tcpip(LIBSSH2_SESSION *session, int resource_id, char *host, int port TSRMLS_DC) +static php_stream *php_ssh2_direct_tcpip(LIBSSH2_SESSION *session, int resource_id, char *host, int port, char *shost, int sport TSRMLS_DC) { LIBSSH2_CHANNEL *channel; php_ssh2_channel_data *channel_data; php_stream *stream; - channel = libssh2_channel_direct_tcpip(session, host, port); + channel = libssh2_channel_direct_tcpip_ex(session, host, port, shost, sport); if (!channel) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to request a channel from remote host"); return NULL; @@ -1107,6 +1107,8 @@ char *host = NULL; int port = 0; int resource_id = 0; + char *shost = "127.0.0.1"; + long sport = 22; resource = php_ssh2_fopen_wraper_parse_path(path, "tunnel", context, &session, &resource_id, NULL, NULL TSRMLS_CC); if (!resource || !session) { @@ -1143,7 +1145,7 @@ return NULL; } - stream = php_ssh2_direct_tcpip(session, resource_id, host, port TSRMLS_CC); + stream = php_ssh2_direct_tcpip(session, resource_id, host, port, shost, sport TSRMLS_CC); if (!stream) { zend_list_delete(resource_id); } @@ -1179,14 +1181,17 @@ char *host; int host_len; long port; + char *shost = "127.0.0.1"; + int shost_len; + long sport = 22; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &zsession, &host, &host_len, &port) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsl", &zsession, &host, &host_len, &port, &shost_len, &sport) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(session, LIBSSH2_SESSION*, &zsession, -1, PHP_SSH2_SESSION_RES_NAME, le_ssh2_session); - stream = php_ssh2_direct_tcpip(session, Z_LVAL_P(zsession), host, port TSRMLS_CC); + stream = php_ssh2_direct_tcpip(session, Z_LVAL_P(zsession), host, port, shost, sport TSRMLS_CC); if (!stream) { RETURN_FALSE; }