1
0
mirror of https://github.com/danog/tgseclib.git synced 2024-11-27 12:44:38 +01:00

- read(...) only returned first byte of matched string - not entire matched string

git-svn-id: http://phpseclib.svn.sourceforge.net/svnroot/phpseclib/trunk@153 21d32557-59b3-4da0-833f-c5933fad653e
This commit is contained in:
Jim Wigginton 2011-04-18 21:37:06 +00:00
parent 392d96445e
commit b614ab4dc0

View File

@ -1778,15 +1778,13 @@ class Net_SSH2 {
}
while (true) {
if ($mode != NET_SSH2_READ_REGEX) {
$pos = strpos($this->interactiveBuffer, $expect);
} else {
$pos = preg_match($expect, $this->interactiveBuffer, $matches) ?
strpos($this->interactiveBuffer, $matches[0]) :
false;
if ($mode == NET_SSH2_READ_REGEX) {
preg_match($expect, $this->interactiveBuffer, $matches);
$expect = $matches[0];
}
$pos = strpos($this->interactiveBuffer, $expect);
if ($pos !== false) {
return $this->_string_shift($this->interactiveBuffer, $pos + 1);
return $this->_string_shift($this->interactiveBuffer, $pos + strlen($expect));
}
$response = $this->_get_channel_packet(NET_SSH2_CHANNEL_SHELL);