Merge branch '1.0' into 2.0

This commit is contained in:
terrafrost 2021-05-15 22:22:35 -05:00
commit 94abf563ad

View File

@ -1355,6 +1355,7 @@ class SSH2
function _key_exchange($kexinit_payload_server = false) function _key_exchange($kexinit_payload_server = false)
{ {
$preferred = $this->preferred; $preferred = $this->preferred;
$send_kex = true;
$kex_algorithms = isset($preferred['kex']) ? $kex_algorithms = isset($preferred['kex']) ?
$preferred['kex'] : $preferred['kex'] :
@ -1438,7 +1439,7 @@ class SSH2
0 0
); );
if ($this->send_kex_first) { if ($kexinit_payload_server === false) {
if (!$this->_send_binary_packet($kexinit_payload_client)) { if (!$this->_send_binary_packet($kexinit_payload_client)) {
return false; return false;
} }
@ -1454,6 +1455,8 @@ class SSH2
user_error('Expected SSH_MSG_KEXINIT'); user_error('Expected SSH_MSG_KEXINIT');
return false; return false;
} }
$send_kex = false;
} }
$response = $kexinit_payload_server; $response = $kexinit_payload_server;
@ -1526,7 +1529,7 @@ class SSH2
extract(unpack('Cfirst_kex_packet_follows', $this->_string_shift($response, 1))); extract(unpack('Cfirst_kex_packet_follows', $this->_string_shift($response, 1)));
$first_kex_packet_follows = $first_kex_packet_follows != 0; $first_kex_packet_follows = $first_kex_packet_follows != 0;
if (!$this->send_kex_first && !$this->_send_binary_packet($kexinit_payload_client)) { if ($send_kex && !$this->_send_binary_packet($kexinit_payload_client)) {
return false; return false;
} }