From 8e1df6e3c35ca1ed12341a42072d3ed51cd67fe2 Mon Sep 17 00:00:00 2001 From: liutec Date: Fri, 20 Jun 2014 13:04:17 +0300 Subject: [PATCH 1/2] Allow setting the terminal window size --- phpseclib/Net/SSH2.php | 83 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 5dfecbda..6ee98094 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -818,6 +818,28 @@ class Net_SSH2 */ var $connectionTimeout; + /** + * Number of columns for terminal window size + * + * @see Net_SSH2::getWindowColumns() + * @see Net_SSH2::setWindowColumns() + * @see Net_SSH2::setWindowSize() + * @var Integer + * @access private + */ + var $windowColumns = 80; + + /** + * Number of columns for terminal window size + * + * @see Net_SSH2::getWindowRows() + * @see Net_SSH2::setWindowRows() + * @see Net_SSH2::setWindowSize() + * @var Integer + * @access private + */ + var $windowRows = 24; + /** * Default Constructor. * @@ -2268,7 +2290,7 @@ class Net_SSH2 $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); $packet = pack('CNNa*CNa*N5a*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_EXEC], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100', - 80, 24, 0, 0, strlen($terminal_modes), $terminal_modes); + $this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes); if (!$this->_send_binary_packet($packet)) { return false; @@ -2375,7 +2397,7 @@ class Net_SSH2 $terminal_modes = pack('C', NET_SSH2_TTY_OP_END); $packet = pack('CNNa*CNa*N5a*', NET_SSH2_MSG_CHANNEL_REQUEST, $this->server_channels[NET_SSH2_CHANNEL_SHELL], strlen('pty-req'), 'pty-req', 1, strlen('vt100'), 'vt100', - 80, 24, 0, 0, strlen($terminal_modes), $terminal_modes); + $this->windowColumns, $this->windowRows, 0, 0, strlen($terminal_modes), $terminal_modes); if (!$this->_send_binary_packet($packet)) { return false; @@ -3775,4 +3797,61 @@ class Net_SSH2 } return $this->exit_status; } + + /** + * Returns the number of columns for the terminal window size. + * + * @return Integer + * @access public + */ + function getWindowColumns() + { + return $this->windowColumns; + } + + /** + * Returns the number of rows for the terminal window size. + * + * @return Integer + * @access public + */ + function getWindowRows() + { + return $this->windowRows; + } + + /** + * Sets the number of columns for the terminal window size. + * + * @param Integer $value + * @access public + */ + function setWindowColumns($value) + { + $this->windowColumns = $value; + } + + /** + * Sets the number of rows for the terminal window size. + * + * @param Integer $value + * @access public + */ + function setWindowRows($value) + { + $this->windowRows = $value; + } + + /** + * Sets the number of columns and rows for the terminal window size. + * + * @param Integer $columns + * @param Integer $rows + * @access public + */ + function setWindowSize($columns = 80, $rows = 24) + { + $this->windowColumns = $columns; + $this->windowRows = $rows; + } } From 10597aed64ebe3decb53ae94ee2bb49d0147bae4 Mon Sep 17 00:00:00 2001 From: liutec Date: Sun, 22 Jun 2014 22:30:52 +0300 Subject: [PATCH 2/2] Removed white-spaces from line ends --- phpseclib/Net/SSH2.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/phpseclib/Net/SSH2.php b/phpseclib/Net/SSH2.php index 6ee98094..5c99242f 100644 --- a/phpseclib/Net/SSH2.php +++ b/phpseclib/Net/SSH2.php @@ -3797,7 +3797,7 @@ class Net_SSH2 } return $this->exit_status; } - + /** * Returns the number of columns for the terminal window size. * @@ -3808,7 +3808,7 @@ class Net_SSH2 { return $this->windowColumns; } - + /** * Returns the number of rows for the terminal window size. * @@ -3819,7 +3819,7 @@ class Net_SSH2 { return $this->windowRows; } - + /** * Sets the number of columns for the terminal window size. * @@ -3830,7 +3830,7 @@ class Net_SSH2 { $this->windowColumns = $value; } - + /** * Sets the number of rows for the terminal window size. * @@ -3841,7 +3841,7 @@ class Net_SSH2 { $this->windowRows = $value; } - + /** * Sets the number of columns and rows for the terminal window size. *