From 374c68c3126c7b341ba0ccc4bea7d01e519abad0 Mon Sep 17 00:00:00 2001 From: Jim Wigginton Date: Mon, 15 Feb 2010 22:24:08 +0000 Subject: [PATCH] - stderr produced by Net_SSH2::exec() calls is now treated the same as stdin data git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@87 21d32557-59b3-4da0-833f-c5933fad653e --- phpseclib/Net/SSH2.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 3d45e189..09554b5b 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -60,7 +60,7 @@ * @author Jim Wigginton * @copyright MMVII Jim Wigginton * @license http://www.gnu.org/licenses/lgpl.txt - * @version $Id: SSH2.php,v 1.37 2010-02-12 23:02:13 terrafrost Exp $ + * @version $Id: SSH2.php,v 1.38 2010-02-15 22:24:08 terrafrost Exp $ * @link http://phpseclib.sourceforge.net */ @@ -1822,12 +1822,16 @@ class Net_SSH2 { if ($client_channel == NET_SSH2_CHANNEL_EXEC) { $this->_send_channel_packet($client_channel, chr(0)); } + // currently, there's only one possible value for $data_type_code: NET_SSH2_EXTENDED_DATA_STDERR extract(unpack('Ndata_type_code/Nlength', $this->_string_shift($response, 8))); $data = $this->_string_shift($response, $length); - switch ($data_type_code) { - case NET_SSH2_EXTENDED_DATA_STDERR: - $this->errors[] = 'SSH_MSG_CHANNEL_EXTENDED_DATA (SSH_EXTENDED_DATA_STDERR): ' . $data; + if ($client_channel == $channel) { + return $data; } + if (!isset($this->channel_buffers[$client_channel])) { + $this->channel_buffers[$client_channel] = array(); + } + $this->channel_buffers[$client_channel][] = $data; break; case NET_SSH2_MSG_CHANNEL_REQUEST: extract(unpack('Nlength', $this->_string_shift($response, 4)));