client: improve connection/new fingerprint query
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
add5861e8d
commit
a595f0fee0
@ -400,21 +400,22 @@ impl HttpClient {
|
|||||||
if interactive && tty::stdin_isatty() {
|
if interactive && tty::stdin_isatty() {
|
||||||
println!("fingerprint: {}", fp_string);
|
println!("fingerprint: {}", fp_string);
|
||||||
loop {
|
loop {
|
||||||
print!("Want to trust? (y/n): ");
|
print!("Are you sure you want to continue connecting? (y/n): ");
|
||||||
let _ = std::io::stdout().flush();
|
let _ = std::io::stdout().flush();
|
||||||
let mut buf = [0u8; 1];
|
use std::io::{BufRead, BufReader};
|
||||||
use std::io::Read;
|
let mut line = String::new();
|
||||||
match std::io::stdin().read_exact(&mut buf) {
|
match BufReader::new(std::io::stdin()).read_line(&mut line) {
|
||||||
Ok(()) => {
|
Ok(_) => {
|
||||||
if buf[0] == b'y' || buf[0] == b'Y' {
|
let trimmed = line.trim();
|
||||||
|
if trimmed == "y" || trimmed == "Y" {
|
||||||
return (true, Some(fp_string));
|
return (true, Some(fp_string));
|
||||||
} else if buf[0] == b'n' || buf[0] == b'N' {
|
} else if trimmed == "n" || trimmed == "N" {
|
||||||
return (false, None);
|
return (false, None);
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => return (false, None),
|
||||||
return (false, None);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user