mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-11 16:15:52 +00:00
SSH2: allow for stringable objects
This commit is contained in:
parent
20b9abf589
commit
072a56b2f9
@ -1205,7 +1205,7 @@ class SSH2
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($host)) {
|
if (Strings::is_stringable($host)) {
|
||||||
$this->host = $host;
|
$this->host = $host;
|
||||||
$this->port = $port;
|
$this->port = $port;
|
||||||
$this->timeout = $timeout;
|
$this->timeout = $timeout;
|
||||||
@ -2179,7 +2179,7 @@ class SSH2
|
|||||||
case $arg instanceof PrivateKey:
|
case $arg instanceof PrivateKey:
|
||||||
case $arg instanceof Agent:
|
case $arg instanceof Agent:
|
||||||
case is_array($arg):
|
case is_array($arg):
|
||||||
case is_string($arg):
|
case Strings::is_stringable($arg):
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \UnexpectedValueException('$password needs to either be an instance of \phpseclib3\Crypt\Common\PrivateKey, \System\SSH\Agent, an array or a string');
|
throw new \UnexpectedValueException('$password needs to either be an instance of \phpseclib3\Crypt\Common\PrivateKey, \System\SSH\Agent, an array or a string');
|
||||||
@ -2210,7 +2210,7 @@ class SSH2
|
|||||||
$hasArray = true;
|
$hasArray = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ($hasString || is_string($arg)) {
|
if ($hasString || Strings::is_stringable($arg)) {
|
||||||
$hasString = true;
|
$hasString = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2290,7 +2290,7 @@ class SSH2
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->last_interactive_response)) {
|
if (strlen($this->last_interactive_response)) {
|
||||||
return !is_string($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password);
|
return !Strings::is_stringable($password) && !is_array($password) ? false : $this->keyboard_interactive_process($password);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($password instanceof PrivateKey) {
|
if ($password instanceof PrivateKey) {
|
||||||
|
Loading…
Reference in New Issue
Block a user