Skip to content

Commit d38bd8e

Browse files
committed
Challenge for password when using cdr auth.
1 parent 77b8a62 commit d38bd8e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/secret_reader.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use zeroize::Zeroizing;
1818
use crate::{
1919
backup::{Share, Verifier},
2020
cdrw::{CdReader, IsoReader},
21+
util,
2122
};
2223

2324
#[derive(ValueEnum, Copy, Clone, Debug, Default, PartialEq)]
@@ -131,10 +132,24 @@ impl CdrPasswordReader {
131132

132133
impl PasswordReader for CdrPasswordReader {
133134
fn read(&mut self, _prompt: &str) -> Result<Zeroizing<String>> {
134-
let password = self.cdr.read("password")?;
135+
match self.cdr.eject() {
136+
Ok(()) => (),
137+
Err(e) => return Err(e),
138+
}
139+
140+
print!(
141+
"Place authentication CD in the drive, close the drive, then press \n\
142+
any key to continue: "
143+
);
144+
match io::stdout().flush() {
145+
Ok(()) => (),
146+
Err(e) => return Err(e.into()),
147+
}
148+
util::wait_for_line()?;
135149

136150
// Passwords are utf8 and `String::from_utf8` explicitly does *not*
137151
// copy the Vec<u8>.
152+
let password = self.cdr.read("password")?;
138153
let password = Zeroizing::new(String::from_utf8(password)?);
139154
debug!("read password: {:?}", password.deref());
140155

0 commit comments

Comments
 (0)