mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-03-31 06:22:23 +00:00
Merge branch '3.0'
This commit is contained in:
commit
b82a58ae46
@ -3245,7 +3245,9 @@ class SFTP extends SSH2
|
|||||||
return false;
|
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(
|
throw new RuntimeException(
|
||||||
"Extension 'posix-rename@openssh.com' is not supported by the server. " .
|
"Extension 'posix-rename@openssh.com' is not supported by the server. " .
|
||||||
"Call getSupportedVersions() to see a list of supported extension"
|
"Call getSupportedVersions() to see a list of supported extension"
|
||||||
@ -3258,8 +3260,13 @@ class SFTP extends SSH2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$packet = Strings::packSSH2('sss', 'posix-rename@openssh.com', $oldname, $newname);
|
if ($this->version >= 5) {
|
||||||
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
$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();
|
$response = $this->get_sftp_packet();
|
||||||
if ($this->packet_type != PacketType::STATUS) {
|
if ($this->packet_type != PacketType::STATUS) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user