Re: pinentry-tty writes the typed passphrase to stdin if it times out
NIIBE Yutaka via Gnupg-users <[email protected]> Tue, 26 May 2026 09:25:42 +0900
| Newsgroups | gmane.comp.encryption.gpg.user |
|---|---|
| Message-ID | <[email protected]> |
--=-=-=
Content-Type: text/plain
Hello,
Thank you for your report.
paolobrignoli25 wrote:
> Is this an intended, or at least known behavior?
I don't think it is intended.
I think that pinentry-tty is not recommended to use (use loopback
pinentry mode, instead).
I will commit the change attached if no one complains.
--
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename="pinentry-tty-should-flush-input-at-timeout.patch "
diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index 0feb27c..48b53ff 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -322,7 +322,10 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
#ifndef HAVE_DOSISH_SYSTEM
if (timed_out)
- pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+ {
+ pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+ tcflush (fileno (ttyfi), TCIFLUSH);
+ }
#endif
return ret;
@@ -478,7 +481,10 @@ password (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
#ifndef HAVE_DOSISH_SYSTEM
if (timed_out)
- pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+ {
+ pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+ tcflush (fileno (ttyfi), TCIFLUSH);
+ }
#endif
return done;
--=-=-=
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
Gnupg-users mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-users
--=-=-=--