SSH2: if string is passed to setPreferredAlgorithms treat as array

This commit is contained in:
terrafrost 2024-09-04 21:25:09 -05:00
parent 90eb0220af
commit 3e8ce2ba4b

View File

@ -5137,14 +5137,14 @@ class Net_SSH2
if (isset($preferred['kex'])) { if (isset($preferred['kex'])) {
$preferred['kex'] = array_intersect( $preferred['kex'] = array_intersect(
$preferred['kex'], is_string($preferred['kex']) ? array($preferred['kex']) : $preferred['kex'],
$this->getSupportedKEXAlgorithms() $this->getSupportedKEXAlgorithms()
); );
} }
if (isset($preferred['hostkey'])) { if (isset($preferred['hostkey'])) {
$preferred['hostkey'] = array_intersect( $preferred['hostkey'] = array_intersect(
$preferred['hostkey'], is_string($preferred['hostkey']) ? array($preferred['hostkey']) : $preferred['hostkey'],
$this->getSupportedHostKeyAlgorithms() $this->getSupportedHostKeyAlgorithms()
); );
} }
@ -5155,19 +5155,19 @@ class Net_SSH2
$a = &$preferred[$key]; $a = &$preferred[$key];
if (isset($a['crypt'])) { if (isset($a['crypt'])) {
$a['crypt'] = array_intersect( $a['crypt'] = array_intersect(
$a['crypt'], is_string($a['crypt']) ? array($a['crypt']) : $a['crypt'],
$this->getSupportedEncryptionAlgorithms() $this->getSupportedEncryptionAlgorithms()
); );
} }
if (isset($a['comp'])) { if (isset($a['comp'])) {
$a['comp'] = array_intersect( $a['comp'] = array_intersect(
$a['comp'], is_string($a['comp']) ? array($a['comp']) : $a['comp'],
$this->getSupportedCompressionAlgorithms() $this->getSupportedCompressionAlgorithms()
); );
} }
if (isset($a['mac'])) { if (isset($a['mac'])) {
$a['mac'] = array_intersect( $a['mac'] = array_intersect(
$a['mac'], is_string($a['mac']) ? array($a['mac']) : $a['mac'],
$this->getSupportedMACAlgorithms() $this->getSupportedMACAlgorithms()
); );
} }