Fix SSH FSETSTAT and simplify SCP execution
- 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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user