Implement SSH Phase 13.3: Channel.rs support for port forwarding channels
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

- Modify Channel struct to add direct_tcpip and forwarded_tcpip fields
- Modify handle_channel_open to support 'direct-tcpip' and 'forwarded-tcpip' channel types
- Add handle_session_channel_open() function (Phase 6)
- Add handle_direct_tcpip_channel_open() function (Phase 13.3: Remote port forwarding)
- Add handle_forwarded_tcpip_channel_open() function (Phase 13.3: Local port forwarding)
- Integrate security validation in direct-tcpip channel open
- Modify server.rs to pass security_config to handle_channel_open
- Add 128 lines of new channel handling functions
- All compilation tests passed successfully

Phase 13.1-13.3 completed: Enterprise security + Global request + Channel support
This commit is contained in:
Warren
2026-06-15 18:47:40 +08:00
parent 66d5c35b16
commit 742a40e52e
3 changed files with 134 additions and 1 deletions

View File

@@ -403,7 +403,12 @@ fn handle_ssh_service_loop(
Some(&pt) if pt == PacketType::SSH_MSG_CHANNEL_OPEN as u8 => {
info!("Received SSH_MSG_CHANNEL_OPEN");
let response = channel_manager.handle_channel_open(&packet)?;
// Phase 13.3: 获取security_config并传递给handle_channel_open
let security = security_config.lock().unwrap();
let response = channel_manager.handle_channel_open(&packet, Some(&security))?;
drop(security); // 释放锁
let encrypted_response = EncryptedPacket::new(&response.payload, encryption_ctx, true)?;
encrypted_response.write(stream)?;
info!("Sent SSH_MSG_CHANNEL_OPEN_CONFIRMATION");