SSH1: backport fixes from rrran

This commit is contained in:
terrafrost 2017-07-30 16:19:23 -05:00
parent 6922e6d476
commit f68a85e99b

View File

@ -916,7 +916,7 @@ class SSH1
/** /**
* Returns the output of an interactive shell when there's a match for $expect * Returns the output of an interactive shell when there's a match for $expect
* *
* $expect can take the form of a string literal or, if $mode == self::READ__REGEX, * $expect can take the form of a string literal or, if $mode == self::READ_REGEX,
* a regular expression. * a regular expression.
* *
* @see self::write() * @see self::write()
@ -925,7 +925,7 @@ class SSH1
* @return bool * @return bool
* @access public * @access public
*/ */
function read($expect, $mode = self::READ__SIMPLE) function read($expect, $mode = self::READ_SIMPLE)
{ {
if (!($this->bitmap & self::MASK_LOGIN)) { if (!($this->bitmap & self::MASK_LOGIN)) {
user_error('Operation disallowed prior to login()'); user_error('Operation disallowed prior to login()');
@ -939,7 +939,7 @@ class SSH1
$match = $expect; $match = $expect;
while (true) { while (true) {
if ($mode == self::READ__REGEX) { if ($mode == self::READ_REGEX) {
preg_match($expect, $this->interactiveBuffer, $matches); preg_match($expect, $this->interactiveBuffer, $matches);
$match = isset($matches[0]) ? $matches[0] : ''; $match = isset($matches[0]) ? $matches[0] : '';
} }