P0: exit-status for subsystem, improved error msgs, integration test suite
This commit is contained in:
@@ -106,7 +106,7 @@ impl SshServer {
|
||||
upload_hook_config_clone,
|
||||
)
|
||||
{
|
||||
error!("Connection error: {}", e);
|
||||
error!("SSH connection error: {}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -666,6 +666,10 @@ fn handle_ssh_service_loop(
|
||||
if !has_exec && packet.payload.len() >= 5 {
|
||||
let channel_id =
|
||||
u32::from_be_bytes([packet.payload[1], packet.payload[2], packet.payload[3], packet.payload[4]]);
|
||||
// ⭐⭐⭐⭐⭐ P0: Send exit-status 0 for subsystem channels
|
||||
let exit_status_packet = channel_manager.build_channel_exit_status(channel_id, 0)?;
|
||||
let encrypted_exit = EncryptedPacket::new(&exit_status_packet.payload, encryption_ctx, true)?;
|
||||
encrypted_exit.write(stream)?;
|
||||
let close_packet = channel_manager.build_channel_close(channel_id)?;
|
||||
let encrypted_response =
|
||||
EncryptedPacket::new(&close_packet.payload, encryption_ctx, true)?;
|
||||
@@ -673,7 +677,10 @@ fn handle_ssh_service_loop(
|
||||
}
|
||||
}
|
||||
Some(&pt) if pt == PacketType::SSH_MSG_DISCONNECT as u8 => {
|
||||
info!("Received SSH_MSG_DISCONNECT");
|
||||
let reason_code = if packet.payload.len() >= 5 {
|
||||
u32::from_be_bytes([packet.payload[1], packet.payload[2], packet.payload[3], packet.payload[4]])
|
||||
} else { 0 };
|
||||
info!("Received SSH_MSG_DISCONNECT (reason={})", reason_code);
|
||||
break;
|
||||
}
|
||||
Some(&pt) if pt == PacketType::SSH_MSG_CHANNEL_WINDOW_ADJUST as u8 => {
|
||||
@@ -688,7 +695,8 @@ fn handle_ssh_service_loop(
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
warn!("Unknown packet type: {:?}", packet.payload.first());
|
||||
let pt = packet.payload.first().copied().unwrap_or(0);
|
||||
warn!("Unknown/unhandled packet type: {} (0x{:02x}), payload_len={}", pt, pt, packet.payload.len());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user