Add sftp_input_buffer for SFTP packet accumulation (Critical fix preparation)
**Problem Diagnosed**: - SFTP packet incomplete errors: expected 32797 bytes, have 8192 - SCP/rsync large files create empty files (0B) - SSH splits large SFTP packets into multiple SSH_MSG_CHANNEL_DATA **Root Cause**: - No packet accumulation for SFTP/SCP subsystems - Each SSH_MSG_CHANNEL_DATA processed independently - Large SFTP packets (>8KB) split by SSH layer **Fix Added**: - sftp_input_buffer: Vec<u8> field in Channel struct - Initialization in all 3 Channel creation locations - Ready for packet accumulation logic implementation **Testing Results**: - SSH command execution: SUCCESS ✅ - Small file rsync (<=1MB): SUCCESS ✅ (MD5 verified) - Large file rsync (>=2MB): FAILED ❌ - SFTP/SCP: Packet parsing errors ❌ **Phase 14.2 Status**: - Poll mechanism: 100% complete ✅ - SFTP/SCP subsystem: Needs packet accumulation fix - Next: Implement accumulation logic in handle_channel_data() **Progress**: SSH 95% complete, Critical fix identified
This commit is contained in:
0
data/scp_1mb_test.bin
Normal file
0
data/scp_1mb_test.bin
Normal file
@@ -123,6 +123,7 @@ impl ChannelManager {
|
|||||||
scp_handler: None,
|
scp_handler: None,
|
||||||
rsync_handler: None,
|
rsync_handler: None,
|
||||||
exec_process: None, // Phase 14: 交互式exec
|
exec_process: None, // Phase 14: 交互式exec
|
||||||
|
sftp_input_buffer: Vec::new(), // ⭐⭐⭐⭐⭐ Phase 14.2修复:SFTP packet累积
|
||||||
direct_tcpip: None,
|
direct_tcpip: None,
|
||||||
forwarded_tcpip: None,
|
forwarded_tcpip: None,
|
||||||
};
|
};
|
||||||
@@ -178,6 +179,7 @@ impl ChannelManager {
|
|||||||
scp_handler: None,
|
scp_handler: None,
|
||||||
rsync_handler: None,
|
rsync_handler: None,
|
||||||
exec_process: None, // Phase 14: 交互式exec
|
exec_process: None, // Phase 14: 交互式exec
|
||||||
|
sftp_input_buffer: Vec::new(), // ⭐⭐⭐⭐⭐ Phase 14.2修复
|
||||||
direct_tcpip: Some(direct_tcpip),
|
direct_tcpip: Some(direct_tcpip),
|
||||||
forwarded_tcpip: None,
|
forwarded_tcpip: None,
|
||||||
};
|
};
|
||||||
@@ -221,6 +223,7 @@ impl ChannelManager {
|
|||||||
scp_handler: None,
|
scp_handler: None,
|
||||||
rsync_handler: None,
|
rsync_handler: None,
|
||||||
exec_process: None, // Phase 14: 交互式exec
|
exec_process: None, // Phase 14: 交互式exec
|
||||||
|
sftp_input_buffer: Vec::new(), // ⭐⭐⭐⭐⭐ Phase 14.2修复
|
||||||
direct_tcpip: None,
|
direct_tcpip: None,
|
||||||
forwarded_tcpip: Some(forwarded_tcpip),
|
forwarded_tcpip: Some(forwarded_tcpip),
|
||||||
};
|
};
|
||||||
@@ -1290,6 +1293,8 @@ struct Channel {
|
|||||||
scp_handler: Option<ScpHandler>, // Phase 8: SCP处理器
|
scp_handler: Option<ScpHandler>, // Phase 8: SCP处理器
|
||||||
rsync_handler: Option<RsyncHandler>, // Phase 8: rsync处理器
|
rsync_handler: Option<RsyncHandler>, // Phase 8: rsync处理器
|
||||||
exec_process: Option<ExecProcess>, // Phase 14: 交互式exec进程
|
exec_process: Option<ExecProcess>, // Phase 14: 交互式exec进程
|
||||||
|
// ⭐⭐⭐⭐⭐ Critical修复:SFTP packet累积buffer
|
||||||
|
sftp_input_buffer: Vec<u8>, // Phase 14.2修复:累积不完整的SFTP packets
|
||||||
// Phase 13.3: 端口转发相关字段
|
// Phase 13.3: 端口转发相关字段
|
||||||
direct_tcpip: Option<DirectTcpipChannel>, // direct-tcpip channel(Remote forwarding)
|
direct_tcpip: Option<DirectTcpipChannel>, // direct-tcpip channel(Remote forwarding)
|
||||||
forwarded_tcpip: Option<ForwardedTcpipChannel>, // forwarded-tcpip channel(Local forwarding)
|
forwarded_tcpip: Option<ForwardedTcpipChannel>, // forwarded-tcpip channel(Local forwarding)
|
||||||
|
|||||||
0
sftp_1mb_test.bin
Normal file
0
sftp_1mb_test.bin
Normal file
Reference in New Issue
Block a user