mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
Merge branch '3.0'
This commit is contained in:
commit
702ec756f4
@ -3245,15 +3245,6 @@ class SFTP extends SSH2
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$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"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$oldname = $this->realpath($oldname);
|
$oldname = $this->realpath($oldname);
|
||||||
$newname = $this->realpath($newname);
|
$newname = $this->realpath($newname);
|
||||||
if ($oldname === false || $newname === false) {
|
if ($oldname === false || $newname === false) {
|
||||||
@ -3263,9 +3254,14 @@ class SFTP extends SSH2
|
|||||||
if ($this->version >= 5) {
|
if ($this->version >= 5) {
|
||||||
$packet = Strings::packSSH2('ssN', $oldname, $newname, 2); // 2 = SSH_FXP_RENAME_ATOMIC
|
$packet = Strings::packSSH2('ssN', $oldname, $newname, 2); // 2 = SSH_FXP_RENAME_ATOMIC
|
||||||
$this->send_sftp_packet(PacketType::RENAME, $packet);
|
$this->send_sftp_packet(PacketType::RENAME, $packet);
|
||||||
} else {
|
} elseif (isset($this->extensions['posix-rename@openssh.com']) && $this->extensions['posix-rename@openssh.com'] === '1') {
|
||||||
$packet = Strings::packSSH2('sss', 'posix-rename@openssh.com', $oldname, $newname);
|
$packet = Strings::packSSH2('sss', 'posix-rename@openssh.com', $oldname, $newname);
|
||||||
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
$this->send_sftp_packet(PacketType::EXTENDED, $packet);
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Extension 'posix-rename@openssh.com' is not supported by the server. " .
|
||||||
|
"Call getSupportedVersions() to see a list of supported extension"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->get_sftp_packet();
|
$response = $this->get_sftp_packet();
|
||||||
|
Loading…
Reference in New Issue
Block a user