[PINENTRY PATCH 3/8] tty: Report timeout.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Nov 4 23:57:47 CET 2016


* tty/pinentry-tty.c (confirm): Report if canceled due to timeout.
(password): Report if canceled due to timeout.

Signed-off-by: Daniel Kahn Gillmor <dkg at fifthhorseman.net>
---
 tty/pinentry-tty.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c
index cef6947..183b7a5 100644
--- a/tty/pinentry-tty.c
+++ b/tty/pinentry-tty.c
@@ -37,6 +37,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ctype.h>
+#include <gpg-error.h>
 
 #include "pinentry.h"
 #include "memory.h"
@@ -283,6 +284,11 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
         }
     }
 
+#ifndef HAVE_DOSISH_SYSTEM
+  if (timed_out)
+    pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+#endif
+
   tcsetattr (fileno(ttyfi), TCSANOW, &o_term);
 
   return ret;
@@ -447,6 +453,11 @@ password (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo)
 	secmem_free (passphrase);
     }
 
+#ifndef HAVE_DOSISH_SYSTEM
+  if (timed_out)
+    pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT);
+#endif
+
   return done;
 }
 
-- 
2.10.1




More information about the Gnupg-devel mailing list