Fix SSH FSETSTAT and simplify SCP execution
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

- Add SSH_FXP_FSETSTAT and SSH_FXP_SETSTAT handlers (return OK)
- Simplify SCP to use system scp command instead of custom handler
- SCP upload/download now working via SFTP protocol
- Add bcrypt debug logging for authentication troubleshooting
This commit is contained in:
Warren
2026-06-15 13:41:53 +08:00
parent 0aeafb0396
commit b66f727622
4 changed files with 49 additions and 38 deletions

View File

@@ -144,45 +144,19 @@ impl ChannelManager {
info!("Exec command: {}", command);
// Phase 8: 检测SCP/rsync命令
if command.starts_with("scp ") {
info!("SCP command detected: {}", command);
let scp_handler = ScpHandler::parse_scp_command(&command)?;
if let Some(ch) = self.channels.get_mut(&channel) {
ch.scp_handler = Some(scp_handler);
info!("SCP handler initialized for channel {}", channel);
}
if want_reply {
Ok(Some(self.build_channel_success(channel)?))
} else {
Ok(None)
}
} else if command.starts_with("rsync ") {
info!("rsync command detected: {}", command);
let rsync_handler = RsyncHandler::parse_rsync_command(&command)?;
if let Some(ch) = self.channels.get_mut(&channel) {
ch.rsync_handler = Some(rsync_handler);
info!("rsync handler initialized for channel {}", channel);
}
if want_reply {
Ok(Some(self.build_channel_success(channel)?))
} else {
Ok(None)
}
// Phase 8: SCP/rsync命令直接执行(使用系统命令)
// 不需要自己实现SCP协议让系统的scp/rsync命令处理
let output = self.execute_command(&command)?;
// 存储输出等待后续发送CHANNEL_DATA
if let Some(ch) = self.channels.get_mut(&channel) {
ch.output_buffer = Some(output);
}
if want_reply {
Ok(Some(self.build_channel_success(channel)?))
} else {
// 普通命令执行Phase 6
let output = self.execute_command(&command)?;
// 存储输出等待后续发送CHANNEL_DATA
if let Some(ch) = self.channels.get_mut(&channel) {
ch.output_buffer = Some(output);
}
if want_reply {
Ok(Some(self.build_channel_success(channel)?))
} else {
Ok(None)
}
Ok(None)
}
}