many improvements

This commit is contained in:
nora 2024-08-12 16:46:27 +02:00
parent 7a129eba2e
commit 193f762ae9
6 changed files with 188 additions and 46 deletions

View file

@ -162,16 +162,17 @@ impl ServerConnection {
} => {
let kex = KeyExchangeInitPacket::parse(&packet.payload)?;
let require_algorithm =
|expected: &'static str, list: NameList<'_>| -> Result<&'static str> {
if list.iter().any(|alg| alg == expected) {
Ok(expected)
} else {
Err(client_error!(
let require_algorithm = |expected: &'static str,
list: NameList<'_>|
-> Result<&'static str> {
if list.iter().any(|alg| alg == expected) {
Ok(expected)
} else {
Err(client_error!(
"client does not supported algorithm {expected}. supported: {list:?}",
))
}
};
}
};
let key_algorithm = require_algorithm("curve25519-sha256", kex.kex_algorithms)?;
let server_host_key_algorithm =

View file

@ -88,6 +88,9 @@ ctors! {
fn new_msg_channel_eof(SSH_MSG_CHANNEL_EOF; recipient_channel: u32);
fn new_msg_channel_close(SSH_MSG_CHANNEL_CLOSE; recipient_channel: u32);
fn new_msg_channel_request_exit_status(SSH_MSG_CHANNEL_REQUEST; recipient_channel: u32, kind_exit_status: string, false_: bool, exit_status: u32);
fn new_msg_channel_success(SSH_MSG_CHANNEL_SUCCESS; recipient_channel: u32);
fn new_msg_channel_failure(SSH_MSG_CHANNEL_FAILURE; recipient_channel: u32);
}