mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-28 12:10:59 +00:00
Aliases PacketType
This commit is contained in:
parent
dcf3528c8d
commit
fa53c147a5
@ -41,7 +41,7 @@ use phpseclib3\Net\SFTP\Attribute;
|
||||
use phpseclib3\Net\SFTP\FileType;
|
||||
use phpseclib3\Net\SFTP\OpenFlag;
|
||||
use phpseclib3\Net\SFTP\OpenFlag5;
|
||||
use phpseclib3\Net\SFTP\PacketType;
|
||||
use phpseclib3\Net\SFTP\PacketType as SftpPacketType;
|
||||
use phpseclib3\Net\SFTP\StatusCode;
|
||||
use phpseclib3\Net\Ssh2\MessageType as Ssh2MessageType;
|
||||
|
||||
@ -438,10 +438,10 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
$this->channel_status[self::CHANNEL] = Ssh2MessageType::CHANNEL_DATA;
|
||||
$this->send_sftp_packet(PacketType::INIT, "\0\0\0\3");
|
||||
$this->send_sftp_packet(SftpPacketType::INIT, "\0\0\0\3");
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::VERSION) {
|
||||
if ($this->packet_type != SftpPacketType::VERSION) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::VERSION. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -509,9 +509,9 @@ class SFTP extends SSH2
|
||||
}
|
||||
$this->version = (int) $ver;
|
||||
$packet = Strings::packSSH2('ss', 'version-select', "$ver");
|
||||
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::EXTENDED, $packet);
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -686,17 +686,17 @@ class SFTP extends SSH2
|
||||
|
||||
if ($this->pwd === true) {
|
||||
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.9
|
||||
$this->send_sftp_packet(PacketType::REALPATH, Strings::packSSH2('s', $path));
|
||||
$this->send_sftp_packet(SftpPacketType::REALPATH, Strings::packSSH2('s', $path));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::NAME:
|
||||
case SftpPacketType::NAME:
|
||||
// although SSH_FXP_NAME is implemented differently in SFTPv3 than it is in SFTPv4+, the following
|
||||
// should work on all SFTP versions since the only part of the SSH_FXP_NAME packet the following looks
|
||||
// at is the first part and that part is defined the same in SFTP versions 3 through 6.
|
||||
list(, $filename) = Strings::unpackSSH2('Ns', $response);
|
||||
return $filename;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
default:
|
||||
@ -763,15 +763,15 @@ class SFTP extends SSH2
|
||||
// the file's uid / gid match the currently logged in user's uid / gid but how there's no easy
|
||||
// way to get those with SFTP
|
||||
|
||||
$this->send_sftp_packet(PacketType::OPENDIR, Strings::packSSH2('s', $dir));
|
||||
$this->send_sftp_packet(SftpPacketType::OPENDIR, Strings::packSSH2('s', $dir));
|
||||
|
||||
// see \phpseclib3\Net\SFTP::nlist() for a more thorough explanation of the following
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
$handle = substr($response, 4);
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
default:
|
||||
@ -902,17 +902,17 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.2
|
||||
$this->send_sftp_packet(PacketType::OPENDIR, Strings::packSSH2('s', $dir));
|
||||
$this->send_sftp_packet(SftpPacketType::OPENDIR, Strings::packSSH2('s', $dir));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-9.2
|
||||
// since 'handle' is the last field in the SSH_FXP_HANDLE packet, we'll just remove the first four bytes that
|
||||
// represent the length of the string and leave it at that
|
||||
$handle = substr($response, 4);
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
// presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
$this->logError($response);
|
||||
return false;
|
||||
@ -928,11 +928,11 @@ class SFTP extends SSH2
|
||||
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.2.2
|
||||
// why multiple SSH_FXP_READDIR packets would be sent when the response to a single one can span arbitrarily many
|
||||
// SSH_MSG_CHANNEL_DATA messages is not known to me.
|
||||
$this->send_sftp_packet(PacketType::READDIR, Strings::packSSH2('s', $handle));
|
||||
$this->send_sftp_packet(SftpPacketType::READDIR, Strings::packSSH2('s', $handle));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::NAME:
|
||||
case SftpPacketType::NAME:
|
||||
list($count) = Strings::unpackSSH2('N', $response);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
list($shortname) = Strings::unpackSSH2('s', $response);
|
||||
@ -964,7 +964,7 @@ class SFTP extends SSH2
|
||||
// final SSH_FXP_STATUS packet should tell us that, already.
|
||||
}
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
list($status) = Strings::unpackSSH2('N', $response);
|
||||
if ($status != StatusCode::EOF) {
|
||||
$this->logError($response, $status);
|
||||
@ -1215,7 +1215,7 @@ class SFTP extends SSH2
|
||||
}
|
||||
}
|
||||
|
||||
$stat = $this->stat_helper($filename, PacketType::STAT);
|
||||
$stat = $this->stat_helper($filename, SftpPacketType::STAT);
|
||||
if ($stat === false) {
|
||||
$this->remove_from_stat_cache($filename);
|
||||
return false;
|
||||
@ -1272,7 +1272,7 @@ class SFTP extends SSH2
|
||||
}
|
||||
}
|
||||
|
||||
$lstat = $this->stat_helper($filename, PacketType::LSTAT);
|
||||
$lstat = $this->stat_helper($filename, SftpPacketType::LSTAT);
|
||||
if ($lstat === false) {
|
||||
$this->remove_from_stat_cache($filename);
|
||||
return false;
|
||||
@ -1285,7 +1285,7 @@ class SFTP extends SSH2
|
||||
return $lstat;
|
||||
}
|
||||
|
||||
$stat = $this->stat_helper($filename, PacketType::STAT);
|
||||
$stat = $this->stat_helper($filename, SftpPacketType::STAT);
|
||||
|
||||
if ($lstat != $stat) {
|
||||
$lstat = array_merge($lstat, ['type' => FileType::SYMLINK]);
|
||||
@ -1327,9 +1327,9 @@ class SFTP extends SSH2
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::ATTRS:
|
||||
case SftpPacketType::ATTRS:
|
||||
return $this->parseAttributes($response);
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
}
|
||||
@ -1393,13 +1393,13 @@ class SFTP extends SSH2
|
||||
pack('N', OpenFlag::WRITE | OpenFlag::CREATE | OpenFlag::EXCL);
|
||||
$packet.= $attr;
|
||||
|
||||
$this->send_sftp_packet(PacketType::OPEN, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::OPEN, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
return $this->close_handle(substr($response, 4));
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
break;
|
||||
default:
|
||||
@ -1517,14 +1517,14 @@ class SFTP extends SSH2
|
||||
// tell us if the file actually exists.
|
||||
// incidentally, SFTPv4+ adds an additional 32-bit integer field - flags - to the following:
|
||||
$packet = pack('Na*', strlen($filename), $filename);
|
||||
$this->send_sftp_packet(PacketType::STAT, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::STAT, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::ATTRS:
|
||||
case SftpPacketType::ATTRS:
|
||||
$attrs = $this->parseAttributes($response);
|
||||
return $attrs['mode'];
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
}
|
||||
@ -1567,7 +1567,7 @@ class SFTP extends SSH2
|
||||
$packet.= $this->version >= 4 ?
|
||||
pack('a*Ca*', substr($attr, 0, 4), FileType::UNKNOWN, substr($attr, 4)) :
|
||||
$attr;
|
||||
$this->send_sftp_packet(PacketType::SETSTAT, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::SETSTAT, $packet);
|
||||
|
||||
/*
|
||||
"Because some systems must use separate system calls to set various attributes, it is possible that a failure
|
||||
@ -1577,7 +1577,7 @@ class SFTP extends SSH2
|
||||
-- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.6
|
||||
*/
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -1636,7 +1636,7 @@ class SFTP extends SSH2
|
||||
$packet.= $this->version >= 4 ?
|
||||
pack('Ca*', FileType::UNKNOWN, $attr) :
|
||||
$attr;
|
||||
$this->send_sftp_packet(PacketType::SETSTAT, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::SETSTAT, $packet);
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1653,7 +1653,7 @@ class SFTP extends SSH2
|
||||
$packet.= $this->version >= 4 ?
|
||||
pack('Ca*', FileType::UNKNOWN, $attr) :
|
||||
$attr;
|
||||
$this->send_sftp_packet(PacketType::SETSTAT, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::SETSTAT, $packet);
|
||||
|
||||
$i++;
|
||||
|
||||
@ -1683,13 +1683,13 @@ class SFTP extends SSH2
|
||||
|
||||
$link = $this->realpath($link);
|
||||
|
||||
$this->send_sftp_packet(PacketType::READLINK, Strings::packSSH2('s', $link));
|
||||
$this->send_sftp_packet(SftpPacketType::READLINK, Strings::packSSH2('s', $link));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::NAME:
|
||||
case SftpPacketType::NAME:
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
default:
|
||||
@ -1736,10 +1736,10 @@ class SFTP extends SSH2
|
||||
Hopefully the new argument names make it clear which way is which.
|
||||
*/
|
||||
if ($this->version == 6) {
|
||||
$type = PacketType::LINK;
|
||||
$type = SftpPacketType::LINK;
|
||||
$packet = Strings::packSSH2('ssC', $link, $target, 1);
|
||||
} else {
|
||||
$type = PacketType::SYMLINK;
|
||||
$type = SftpPacketType::SYMLINK;
|
||||
/* quoting http://bxr.su/OpenBSD/usr.bin/ssh/PROTOCOL#347 :
|
||||
|
||||
3.1. sftp: Reversal of arguments to SSH_FXP_SYMLINK
|
||||
@ -1761,7 +1761,7 @@ class SFTP extends SSH2
|
||||
$this->send_sftp_packet($type, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -1820,10 +1820,10 @@ class SFTP extends SSH2
|
||||
private function mkdir_helper($dir, $mode)
|
||||
{
|
||||
// send SSH_FXP_MKDIR without any attributes (that's what the \0\0\0\0 is doing)
|
||||
$this->send_sftp_packet(PacketType::MKDIR, Strings::packSSH2('s', $dir) . "\0\0\0\0");
|
||||
$this->send_sftp_packet(SftpPacketType::MKDIR, Strings::packSSH2('s', $dir) . "\0\0\0\0");
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -1860,10 +1860,10 @@ class SFTP extends SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->send_sftp_packet(PacketType::RMDIR, Strings::packSSH2('s', $dir));
|
||||
$this->send_sftp_packet(SftpPacketType::RMDIR, Strings::packSSH2('s', $dir));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -1977,14 +1977,14 @@ class SFTP extends SSH2
|
||||
$packet.= $this->version >= 5 ?
|
||||
pack('N3', 0, $flags, 0) :
|
||||
pack('N2', $flags, 0);
|
||||
$this->send_sftp_packet(PacketType::OPEN, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::OPEN, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
$handle = substr($response, 4);
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
$this->logError($response);
|
||||
return false;
|
||||
default:
|
||||
@ -2060,7 +2060,7 @@ class SFTP extends SSH2
|
||||
$subtemp = $offset + $sent;
|
||||
$packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp);
|
||||
try {
|
||||
$this->send_sftp_packet(PacketType::WRITE, $packet, $j);
|
||||
$this->send_sftp_packet(SftpPacketType::WRITE, $packet, $j);
|
||||
} catch (\Exception $e) {
|
||||
if ($mode & self::SOURCE_LOCAL_FILE) {
|
||||
fclose($fp);
|
||||
@ -2127,7 +2127,7 @@ class SFTP extends SSH2
|
||||
{
|
||||
while ($i--) {
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -2152,12 +2152,12 @@ class SFTP extends SSH2
|
||||
*/
|
||||
private function close_handle($handle)
|
||||
{
|
||||
$this->send_sftp_packet(PacketType::CLOSE, pack('Na*', strlen($handle), $handle));
|
||||
$this->send_sftp_packet(SftpPacketType::CLOSE, pack('Na*', strlen($handle), $handle));
|
||||
|
||||
// "The client MUST release all resources associated with the handle regardless of the status."
|
||||
// -- http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.1.3
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -2204,14 +2204,14 @@ class SFTP extends SSH2
|
||||
$packet.= $this->version >= 5 ?
|
||||
pack('N3', 0, OpenFlag5::OPEN_EXISTING, 0) :
|
||||
pack('N2', OpenFlag::READ, 0);
|
||||
$this->send_sftp_packet(PacketType::OPEN, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::OPEN, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
$handle = substr($response, 4);
|
||||
break;
|
||||
case PacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
case SftpPacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
$this->logError($response);
|
||||
return false;
|
||||
default:
|
||||
@ -2249,7 +2249,7 @@ class SFTP extends SSH2
|
||||
|
||||
$packet = Strings::packSSH2('sN3', $handle, $tempoffset / 4294967296, $tempoffset, $packet_size);
|
||||
try {
|
||||
$this->send_sftp_packet(PacketType::READ, $packet, $i);
|
||||
$this->send_sftp_packet(SftpPacketType::READ, $packet, $i);
|
||||
} catch (\Exception $e) {
|
||||
if ($fclose_check) {
|
||||
fclose($fp);
|
||||
@ -2279,7 +2279,7 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::DATA:
|
||||
case SftpPacketType::DATA:
|
||||
$temp = substr($response, 4);
|
||||
$offset+= strlen($temp);
|
||||
if ($local_file === false) {
|
||||
@ -2294,7 +2294,7 @@ class SFTP extends SSH2
|
||||
}
|
||||
$temp = null;
|
||||
break;
|
||||
case PacketType::STATUS:
|
||||
case SftpPacketType::STATUS:
|
||||
// could, in theory, return false if !strlen($content) but we'll hold off for the time being
|
||||
$this->logError($response);
|
||||
$clear_responses = true; // don't break out of the loop yet, so we can read the remaining responses
|
||||
@ -2375,10 +2375,10 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
// http://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-8.3
|
||||
$this->send_sftp_packet(PacketType::REMOVE, pack('Na*', strlen($path), $path));
|
||||
$this->send_sftp_packet(SftpPacketType::REMOVE, pack('Na*', strlen($path), $path));
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -2438,7 +2438,7 @@ class SFTP extends SSH2
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
$this->send_sftp_packet(PacketType::REMOVE, Strings::packSSH2('s', $temp));
|
||||
$this->send_sftp_packet(SftpPacketType::REMOVE, Strings::packSSH2('s', $temp));
|
||||
$this->remove_from_stat_cache($temp);
|
||||
|
||||
$i++;
|
||||
@ -2452,7 +2452,7 @@ class SFTP extends SSH2
|
||||
}
|
||||
}
|
||||
|
||||
$this->send_sftp_packet(PacketType::RMDIR, Strings::packSSH2('s', $path));
|
||||
$this->send_sftp_packet(SftpPacketType::RMDIR, Strings::packSSH2('s', $path));
|
||||
$this->remove_from_stat_cache($path);
|
||||
|
||||
$i++;
|
||||
@ -2556,13 +2556,13 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
$packet = Strings::packSSH2('sNN', $this->realpath($path), OpenFlag::READ, 0);
|
||||
$this->send_sftp_packet(PacketType::OPEN, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::OPEN, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
return true;
|
||||
case PacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
case SftpPacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
return false;
|
||||
default:
|
||||
throw new \UnexpectedValueException('Expected PacketType::HANDLE or PacketType::STATUS. '
|
||||
@ -2584,13 +2584,13 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
$packet = Strings::packSSH2('sNN', $this->realpath($path), OpenFlag::WRITE, 0);
|
||||
$this->send_sftp_packet(PacketType::OPEN, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::OPEN, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
switch ($this->packet_type) {
|
||||
case PacketType::HANDLE:
|
||||
case SftpPacketType::HANDLE:
|
||||
return true;
|
||||
case PacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
case SftpPacketType::STATUS: // presumably SSH_FX_NO_SUCH_FILE or SSH_FX_PERMISSION_DENIED
|
||||
return false;
|
||||
default:
|
||||
throw new \UnexpectedValueException('Expected SSH_FXP_HANDLE or SSH_FXP_STATUS. '
|
||||
@ -2819,10 +2819,10 @@ class SFTP extends SSH2
|
||||
(none of these are currently supported) */
|
||||
$packet.= "\0\0\0\0";
|
||||
}
|
||||
$this->send_sftp_packet(PacketType::RENAME, $packet);
|
||||
$this->send_sftp_packet(SftpPacketType::RENAME, $packet);
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
if ($this->packet_type != SftpPacketType::STATUS) {
|
||||
throw new \UnexpectedValueException('Expected PacketType::STATUS. '
|
||||
. 'Got packet type: ' . $this->packet_type);
|
||||
}
|
||||
@ -3117,7 +3117,7 @@ class SFTP extends SSH2
|
||||
if (defined('NET_SFTP_LOGGING')) {
|
||||
$packet_type = sprintf(
|
||||
'-> %s (%ss)',
|
||||
PacketType::getConstantNameByValue($type),
|
||||
SftpPacketType::getConstantNameByValue($type),
|
||||
round($stop - $start, 4)
|
||||
);
|
||||
if (NET_SFTP_LOGGING == self::LOG_REALTIME) {
|
||||
@ -3242,7 +3242,7 @@ class SFTP extends SSH2
|
||||
if (defined('NET_SFTP_LOGGING')) {
|
||||
$packet_type = sprintf(
|
||||
'<- %s (%ss)',
|
||||
PacketType::getConstantNameByValue($this->packet_type),
|
||||
SftpPacketType::getConstantNameByValue($this->packet_type),
|
||||
round($stop - $start, 4)
|
||||
);
|
||||
if (NET_SFTP_LOGGING == self::LOG_REALTIME) {
|
||||
|
Loading…
Reference in New Issue
Block a user