diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-04-18 18:42:30 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-04-18 18:42:30 -0400 |
commit | 1f9dd8c079b168be8e3468198a28d8536c2d02d0 (patch) | |
tree | baacec2ed11a9061462bf93f835a2e3b159de292 /src/pinentry.rs | |
parent | 80688313eddf2111fbdbd2b897bc2159d699a6d1 (diff) | |
download | rbw-1f9dd8c079b168be8e3468198a28d8536c2d02d0.tar.gz rbw-1f9dd8c079b168be8e3468198a28d8536c2d02d0.zip |
allow multiple attempts for password entry
Diffstat (limited to 'src/pinentry.rs')
-rw-r--r-- | src/pinentry.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs index c0a929b..707fb24 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -5,6 +5,7 @@ use tokio::io::AsyncWriteExt as _; pub async fn getpin( prompt: &str, desc: &str, + err: Option<&str>, tty: Option<&str>, ) -> Result<crate::locked::Password> { let mut opts = tokio::process::Command::new("pinentry"); @@ -33,6 +34,12 @@ pub async fn getpin( .write_all(format!("SETDESC {}\n", desc).as_bytes()) .await .context(crate::error::WriteStdin)?; + if let Some(err) = err { + stdin + .write_all(format!("SETERROR {}\n", err).as_bytes()) + .await + .context(crate::error::WriteStdin)?; + } stdin .write_all(b"GETPIN\n") .await |