Fix clippy warnings: unused imports, minor style fixes
This commit is contained in:
@@ -1340,7 +1340,7 @@ impl ChannelManager {
|
||||
|
||||
/// ⭐⭐⭐⭐⭐ Phase 17: Check if a specific channel has an exec process
|
||||
pub fn channel_has_exec_process(&self, channel_id: u32) -> bool {
|
||||
self.channels.get(&channel_id).map_or(false, |ch| ch.exec_process.is_some())
|
||||
self.channels.get(&channel_id).is_some_and(|ch| ch.exec_process.is_some())
|
||||
}
|
||||
|
||||
/// 获取channel输出(Phase 6新增)
|
||||
@@ -2053,8 +2053,8 @@ impl ChannelManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if command.contains("rsync") {
|
||||
if command.contains("--server") {
|
||||
} else if command.contains("rsync")
|
||||
&& command.contains("--server") {
|
||||
let parts: Vec<&str> = command.split_whitespace().collect();
|
||||
for part in parts.iter().rev() {
|
||||
if !part.starts_with("-") && !part.contains("--") && *part != "rsync" && *part != "--server" && *part != "--sender" {
|
||||
@@ -2062,7 +2062,6 @@ impl ChannelManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ use chacha20poly1305::{
|
||||
ChaCha20Poly1305, Key as ChaKey, Nonce as ChaNonce, // Phase 5: ChaCha20-Poly1305 AEAD
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use byteorder::{BigEndian, WriteBytesExt};
|
||||
use cipher::{KeyIvInit, StreamCipher};
|
||||
use ctr::Ctr128BE;
|
||||
use hmac::{Hmac, Mac};
|
||||
@@ -1046,7 +1045,7 @@ impl EncryptedPacket {
|
||||
let cipher = Aes256GcmAead::new_from_slice(&key_bytes[..32])
|
||||
.map_err(|e| anyhow!("AES-GCM key init failed: {}", e))?;
|
||||
let nonce = Nonce::from_slice(&prep.nonce_bytes);
|
||||
let packet_length_bytes = (prep.packet_length as u32).to_be_bytes();
|
||||
let packet_length_bytes = prep.packet_length.to_be_bytes();
|
||||
let ciphertext = cipher
|
||||
.encrypt(
|
||||
nonce,
|
||||
@@ -1068,7 +1067,7 @@ impl EncryptedPacket {
|
||||
|
||||
// Full packet: [packet_length (plaintext)] [ciphertext (payload + padding + tag)]
|
||||
let mut full_buf = SshBuf::with_capacity(4 + ciphertext.len());
|
||||
full_buf.put(&(prep.packet_length as u32).to_be_bytes())?;
|
||||
full_buf.put(&prep.packet_length.to_be_bytes())?;
|
||||
full_buf.put(&ciphertext)?;
|
||||
|
||||
packets.push(Self {
|
||||
|
||||
@@ -261,8 +261,8 @@ impl SshBuf {
|
||||
|
||||
/// 消费内部 Vec,提取有效数据(零拷贝)
|
||||
/// 相当于 OpenSSH sshbuf_free() 但返回数据
|
||||
pub fn into_vec(mut self) -> Vec<u8> {
|
||||
let len = self.len();
|
||||
pub fn into_vec(self) -> Vec<u8> {
|
||||
let _len = self.len();
|
||||
if self.off == 0 && self.size == self.data.len() {
|
||||
// 正好是完整 buffer,直接返回
|
||||
self.data
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use anyhow::{anyhow, Result};
|
||||
use log::{info, warn, error};
|
||||
use log::{info, error};
|
||||
|
||||
pub struct UploadHook {
|
||||
enabled: bool,
|
||||
|
||||
Reference in New Issue
Block a user