mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 18:25:13 +00:00
SFTP_Stream: Cache didn't work correctly
This commit is contained in:
parent
3153daf548
commit
95f40d9c8f
@ -138,6 +138,7 @@ class Net_SFTP_Stream {
|
||||
function _parse_path($path)
|
||||
{
|
||||
extract(parse_url($path));
|
||||
|
||||
if (!isset($host)) {
|
||||
return false;
|
||||
}
|
||||
@ -175,14 +176,16 @@ class Net_SFTP_Stream {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->instances[$host][$port][$user][$pass])) {
|
||||
$this->sftp = $this->instances[$host][$port][$user][$pass];
|
||||
// casting $pass to a string is necessary in the event that it's a Crypt_RSA object
|
||||
if (isset(self::$instances[$host][$port][$user][(string) $pass])) {
|
||||
$this->sftp = self::$instances[$host][$port][$user][(string) $pass];
|
||||
} else {
|
||||
$this->sftp = new Net_SFTP($host, isset($port) ? $port : 22);
|
||||
if (!$this->sftp->login($user, $pass)) {
|
||||
return false;
|
||||
}
|
||||
self::$instances[$host][$port][$user][(string) $pass] = $this->sftp;
|
||||
}
|
||||
$this->sftp = new Net_SFTP($host, isset($port) ? $port : 22);
|
||||
if (!$this->sftp->login($user, $pass)) {
|
||||
return false;
|
||||
}
|
||||
$this->instances[$host][$port][$user][$pass] = $this->sftp;
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
Loading…
Reference in New Issue
Block a user