Fix code quality: trailing whitespace, unused imports, clippy warnings
- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
This commit is contained in:
@@ -17,4 +17,4 @@ pub async fn handle_tools_command(cmd: ToolsCommands) -> anyhow::Result<()> {
|
||||
ToolsCommands::Test(c) => test::handle_test_command(c)?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,4 @@ pub fn handle_render_command(cmd: RenderCommand) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,36 +16,39 @@ pub enum TestCommand {
|
||||
|
||||
pub fn handle_test_command(cmd: TestCommand) -> anyhow::Result<()> {
|
||||
match cmd {
|
||||
TestCommand::Bcrypt { password, verify_hash } => {
|
||||
TestCommand::Bcrypt {
|
||||
password,
|
||||
verify_hash,
|
||||
} => {
|
||||
use bcrypt::{hash, verify, DEFAULT_COST};
|
||||
|
||||
println!("=== bcrypt Hash Test ===");
|
||||
println!("Password: {}", password);
|
||||
println!("");
|
||||
println!();
|
||||
|
||||
let new_hash = hash(&password, DEFAULT_COST)?;
|
||||
println!("Generated hash:");
|
||||
println!("{}", new_hash);
|
||||
println!("");
|
||||
println!();
|
||||
|
||||
if let Some(hash_to_verify) = verify_hash {
|
||||
println!("Verifying hash: {}", hash_to_verify);
|
||||
let valid = verify(&password, &hash_to_verify)?;
|
||||
println!("Valid: {}", valid);
|
||||
println!("");
|
||||
println!();
|
||||
}
|
||||
|
||||
let db_hash = "$2b$10$ha5wU.mOi8fHLJCfun860u2cfVopa04jwe/q82IKOwqp5uG70qsH6";
|
||||
println!("Database hash: {}", db_hash);
|
||||
let valid = verify(&password, db_hash)?;
|
||||
println!("Database hash valid for '{}': {}", password, valid);
|
||||
println!("");
|
||||
println!();
|
||||
|
||||
if !valid {
|
||||
println!("❌ Database hash is incorrect!");
|
||||
println!("Update SQL:");
|
||||
println!("UPDATE sftpgo_users SET password_hash = '{}' WHERE username IN ('testuser', 'demo', 'warren', 'momentry');", new_hash);
|
||||
println!("");
|
||||
println!();
|
||||
println!("Execute:");
|
||||
println!("sqlite3 data/auth.sqlite \"UPDATE sftpgo_users SET password_hash = '{}' WHERE username IN ('testuser', 'demo', 'warren', 'momentry');\"", new_hash);
|
||||
} else {
|
||||
@@ -58,4 +61,4 @@ pub fn handle_test_command(cmd: TestCommand) -> anyhow::Result<()> {
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user