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:
@@ -12,20 +12,22 @@ fn get_test_provider() -> Arc<dyn DataProvider> {
|
||||
#[test]
|
||||
fn test_password_authentication_brute_force_prevention() {
|
||||
let provider = get_test_provider();
|
||||
|
||||
|
||||
assert!(provider.check_password("demo", "demo123").unwrap());
|
||||
assert!(!provider.check_password("demo", "wrongpassword").unwrap());
|
||||
assert!(!provider.check_password("demo", "").unwrap());
|
||||
assert!(!provider.check_password("__nonexistent__", "anypassword").unwrap());
|
||||
assert!(!provider
|
||||
.check_password("__nonexistent__", "anypassword")
|
||||
.unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_publickey_authentication_security() {
|
||||
let provider = get_test_provider();
|
||||
|
||||
|
||||
let keys = provider.get_public_keys("demo").unwrap();
|
||||
assert!(keys.is_empty() || keys.len() >= 0);
|
||||
|
||||
|
||||
let keys = provider.get_public_keys("__nonexistent__").unwrap();
|
||||
assert!(keys.is_empty());
|
||||
}
|
||||
@@ -33,10 +35,10 @@ fn test_publickey_authentication_security() {
|
||||
#[test]
|
||||
fn test_user_status_check() {
|
||||
let provider = get_test_provider();
|
||||
|
||||
|
||||
let user = provider.get_user("demo").unwrap();
|
||||
assert!(user.is_some());
|
||||
|
||||
|
||||
let user = provider.get_user("demo").unwrap();
|
||||
if let Some(u) = user {
|
||||
assert_eq!(u.status, 1);
|
||||
@@ -46,16 +48,16 @@ fn test_user_status_check() {
|
||||
#[test]
|
||||
fn test_home_dir_security() {
|
||||
let provider = get_test_provider();
|
||||
|
||||
|
||||
let home = provider.get_home_dir("demo").unwrap();
|
||||
assert!(home.is_some());
|
||||
|
||||
|
||||
let home = provider.get_home_dir("__nonexistent__").unwrap();
|
||||
assert!(home.is_none());
|
||||
|
||||
|
||||
if let Some(home_path) = provider.get_home_dir("demo").unwrap() {
|
||||
assert!(!home_path.contains(".."));
|
||||
assert!(!home_path.starts_with("/etc"));
|
||||
assert!(!home_path.starts_with("/root"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user