From b24e4f727b8139a0711529425ae1bbbd4a9814af Mon Sep 17 00:00:00 2001 From: Warren Date: Sun, 21 Jun 2026 02:32:32 +0800 Subject: [PATCH] Implement SSH X11 forwarding Phase 4: Save X11ForwardContext - Save X11ForwardContext to Channel.x11_forward_context - Clone context for later use in data forwarding - Prepare for actual X11 data forwarding in handle_channel_data All 182 tests pass. --- markbase-core/src/ssh_server/channel.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/markbase-core/src/ssh_server/channel.rs b/markbase-core/src/ssh_server/channel.rs index 8904b2e..65d59f4 100644 --- a/markbase-core/src/ssh_server/channel.rs +++ b/markbase-core/src/ssh_server/channel.rs @@ -1517,6 +1517,11 @@ direct_tcpip: None, let display = std::env::var("DISPLAY").unwrap_or_else(|_| ":0".to_string()); let x11_ctx = super::x11_forward::X11ForwardContext::new(&display)?; + // Phase 4: 保存 X11ForwardContext 到 Channel + if let Some(ch) = self.channels.get_mut(&channel) { + ch.x11_forward_context = Some(x11_ctx.clone()); + } + // 设置 DISPLAY 环境变量(client 会使用) // Server 需要在 exec/shell 环境中设置 DISPLAY // 这里只是记录,实际设置在 exec/shell handler 中