mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 11:20:03 +00:00
Merge branch '3.0'
This commit is contained in:
commit
b82a58ae46
@ -3245,7 +3245,9 @@ class SFTP extends SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isset($this->extensions['posix-rename@openssh.com']) || $this->extensions['posix-rename@openssh.com'] !== '1') {
|
||||
$testA = $this->version >= 5;
|
||||
$testB = isset($this->extensions['posix-rename@openssh.com']) && $this->extensions['posix-rename@openssh.com'] === '1';
|
||||
if (!$testA && !$testB) {
|
||||
throw new RuntimeException(
|
||||
"Extension 'posix-rename@openssh.com' is not supported by the server. " .
|
||||
"Call getSupportedVersions() to see a list of supported extension"
|
||||
@ -3258,8 +3260,13 @@ class SFTP extends SSH2
|
||||
return false;
|
||||
}
|
||||
|
||||
$packet = Strings::packSSH2('sss', 'posix-rename@openssh.com', $oldname, $newname);
|
||||
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
||||
if ($this->version >= 5) {
|
||||
$packet = Strings::packSSH2('ssN', $oldname, $newname, 2); // 2 = SSH_FXP_RENAME_ATOMIC
|
||||
$this->send_sftp_packet(PacketType::RENAME, $packet);
|
||||
} else {
|
||||
$packet = Strings::packSSH2('sss', 'posix-rename@openssh.com', $oldname, $newname);
|
||||
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
||||
}
|
||||
|
||||
$response = $this->get_sftp_packet();
|
||||
if ($this->packet_type != PacketType::STATUS) {
|
||||
|
Loading…
Reference in New Issue
Block a user