mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-16 09:25:04 +01:00
disconnect after ctrl c
This commit is contained in:
parent
bc7e12e50b
commit
b75db7c21f
3 changed files with 78 additions and 13 deletions
|
|
@ -7,7 +7,7 @@ use tokio::{
|
|||
};
|
||||
use tracing::{error, info};
|
||||
|
||||
use ssh_transport::{ServerConnection, SshError, ThreadRngRand};
|
||||
use ssh_transport::{ServerConnection, SshStatus, ThreadRngRand};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
#[tokio::main]
|
||||
|
|
@ -67,13 +67,16 @@ async fn handle_connection(next: (TcpStream, SocketAddr)) -> Result<()> {
|
|||
|
||||
if let Err(err) = state.recv_bytes(&buf[..read]) {
|
||||
match err {
|
||||
SshError::ClientError(err) => {
|
||||
SshStatus::ClientError(err) => {
|
||||
info!(?err, "disconnecting client after invalid operation");
|
||||
return Ok(());
|
||||
}
|
||||
SshError::ServerError(err) => {
|
||||
SshStatus::ServerError(err) => {
|
||||
return Err(err);
|
||||
}
|
||||
SshStatus::Disconnect => {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue