mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-16 01:15:04 +01:00
authentication and start of connection
This commit is contained in:
parent
faf2010051
commit
2b2e2ac1f0
6 changed files with 232 additions and 17 deletions
40
ssh-transport/src/channel.rs
Normal file
40
ssh-transport/src/channel.rs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
use tracing::debug;
|
||||
|
||||
use crate::packet::Packet;
|
||||
use crate::parse::Parser;
|
||||
use crate::Result;
|
||||
use crate::client_error;
|
||||
|
||||
pub(crate) struct ServerChannelsState {}
|
||||
|
||||
impl ServerChannelsState {
|
||||
pub(crate) fn new() -> Self {
|
||||
ServerChannelsState {}
|
||||
}
|
||||
|
||||
pub(crate) fn on_packet(&mut self, packet_type: u8, mut payload: Parser<'_>) -> Result<()> {
|
||||
match packet_type {
|
||||
Packet::SSH_MSG_CHANNEL_OPEN => {
|
||||
// <https://datatracker.ietf.org/doc/html/rfc4254#section-5.1>
|
||||
let channel_type = payload.utf8_string()?;
|
||||
let sender_channel = payload.u32()?;
|
||||
let initial_window_size = payload.u32()?;
|
||||
let max_packet_size = payload.u32()?;
|
||||
|
||||
debug!(?channel_type, ?sender_channel, "Opening channel");
|
||||
|
||||
match channel_type {
|
||||
"session" => {
|
||||
todo!("open session")
|
||||
}
|
||||
_ => todo!("response with SSH_MSG_CHANNEL_OPEN_FAILURE"),
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
todo!("{packet_type}");
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue