mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-15 03:03:49 +00:00
Merge branch '3.0-openchannel' into master-openchannel
This commit is contained in:
commit
e6f86e1770
@ -349,8 +349,6 @@ class SFTP extends SSH2
|
|||||||
*/
|
*/
|
||||||
private function partial_init_sftp_connection(): bool
|
private function partial_init_sftp_connection(): bool
|
||||||
{
|
{
|
||||||
$this->window_size_server_to_client[self::CHANNEL] = $this->window_size;
|
|
||||||
|
|
||||||
$response = $this->openChannel(self::CHANNEL, true);
|
$response = $this->openChannel(self::CHANNEL, true);
|
||||||
if ($response === true && $this->isTimeout()) {
|
if ($response === true && $this->isTimeout()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2754,6 +2754,10 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
public function read(string $expect = '', int $mode = self::READ_SIMPLE, int $channel = null)
|
public function read(string $expect = '', int $mode = self::READ_SIMPLE, int $channel = null)
|
||||||
{
|
{
|
||||||
|
if (!$this->isAuthenticated()) {
|
||||||
|
throw new InsufficientSetupException('Operation disallowed prior to login()');
|
||||||
|
}
|
||||||
|
|
||||||
$this->curTimeout = $this->timeout;
|
$this->curTimeout = $this->timeout;
|
||||||
$this->is_timeout = false;
|
$this->is_timeout = false;
|
||||||
|
|
||||||
@ -2761,7 +2765,7 @@ class SSH2
|
|||||||
$channel = $this->get_interactive_channel();
|
$channel = $this->get_interactive_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isInteractiveChannelOpen($channel) && empty($this->channel_buffers[$channel])) {
|
if (!$this->is_channel_status_data($channel) && empty($this->channel_buffers[$channel])) {
|
||||||
if ($channel != self::CHANNEL_SHELL) {
|
if ($channel != self::CHANNEL_SHELL) {
|
||||||
throw new InsufficientSetupException('Data is not available on channel');
|
throw new InsufficientSetupException('Data is not available on channel');
|
||||||
} elseif (!$this->openShell()) {
|
} elseif (!$this->openShell()) {
|
||||||
@ -2809,11 +2813,15 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
public function write(string $cmd, int $channel = null): void
|
public function write(string $cmd, int $channel = null): void
|
||||||
{
|
{
|
||||||
|
if (!$this->isAuthenticated()) {
|
||||||
|
throw new InsufficientSetupException('Operation disallowed prior to login()');
|
||||||
|
}
|
||||||
|
|
||||||
if ($channel === null) {
|
if ($channel === null) {
|
||||||
$channel = $this->get_interactive_channel();
|
$channel = $this->get_interactive_channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isInteractiveChannelOpen($channel)) {
|
if (!$this->is_channel_status_data($channel)) {
|
||||||
if ($channel != self::CHANNEL_SHELL) {
|
if ($channel != self::CHANNEL_SHELL) {
|
||||||
throw new InsufficientSetupException('Data is not available on channel');
|
throw new InsufficientSetupException('Data is not available on channel');
|
||||||
} elseif (!$this->openShell()) {
|
} elseif (!$this->openShell()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user