Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed May 25, 2024
2 parents 0aae9c7 + da7b239 commit 9ea1b59
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions phpseclib/Net/SSH2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2086,20 +2086,6 @@ private function login_helper(string $username, $password = null): bool
}

[$type] = Strings::unpackSSH2('C', $response);

if ($type == MessageType::EXT_INFO) {
[$nr_extensions] = Strings::unpackSSH2('N', $response);
for ($i = 0; $i < $nr_extensions; $i++) {
[$extension_name, $extension_value] = Strings::unpackSSH2('ss', $response);
if ($extension_name == 'server-sig-algs') {
$this->supported_private_key_algorithms = explode(',', $extension_value);
}
}

$response = $this->get_binary_packet();
[$type] = Strings::unpackSSH2('C', $response);
}

[$service] = Strings::unpackSSH2('s', $response);
if ($type != MessageType::SERVICE_ACCEPT || $service != 'ssh-userauth') {
$this->disconnect_helper(DisconnectReason::PROTOCOL_ERROR);
Expand Down Expand Up @@ -3518,6 +3504,17 @@ private function filter(string $payload, bool $skip_channel_filter)
}
$payload = $this->get_binary_packet($skip_channel_filter);
}
break;
case MessageType::EXT_INFO:
Strings::shift($payload, 1);
[$nr_extensions] = Strings::unpackSSH2('N', $payload);
for ($i = 0; $i < $nr_extensions; $i++) {
[$extension_name, $extension_value] = Strings::unpackSSH2('ss', $payload);
if ($extension_name == 'server-sig-algs') {
$this->supported_private_key_algorithms = explode(',', $extension_value);
}
}
$payload = $this->get_binary_packet($skip_channel_filter);
}

// see http://tools.ietf.org/html/rfc4252#section-5.4; only called when the encryption has been activated and when we haven't already logged in
Expand Down

0 comments on commit 9ea1b59

Please sign in to comment.