[Pkg-gnupg-commit] [gnupg2] 131/205: tests: Set fake-pinentry's stdout and stdin to _IOLBF.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Wed May 11 08:38:28 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
commit 94504b3d5af126abb591dedda1ca0f0970822f55
Author: Werner Koch <wk at gnupg.org>
Date: Thu Apr 14 09:08:50 2016 +0200
tests: Set fake-pinentry's stdout and stdin to _IOLBF.
* tests/openpgp/fake-pinentry.c (main): Call setvbuf. Show passphrase
at startup. Increase buffer.
--
Signed-off-by: Werner Koch <wk at gnupg.org>
---
tests/openpgp/fake-pinentry.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/tests/openpgp/fake-pinentry.c b/tests/openpgp/fake-pinentry.c
index c906370..b8aa848 100644
--- a/tests/openpgp/fake-pinentry.c
+++ b/tests/openpgp/fake-pinentry.c
@@ -25,19 +25,36 @@
int
main (int argc, char **argv)
{
+ static char *passphrase;
+ char *p;
+
(void) argc, (void) argv;
+ setvbuf (stdin, NULL, _IOLBF, BUFSIZ);
+ setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
+
+ if (!passphrase)
+ {
+ passphrase = getenv ("PINENTRY_USER_DATA");
+ if (!passphrase)
+ passphrase = "";
+ for (p=passphrase; *p; p++)
+ if (*p == '\r' || *p == '\n')
+ *p = '.';
+ printf ("# Passphrase='%s'\n", passphrase);
+ }
+
printf ("OK - what's up?\n");
while (! feof (stdin))
{
- char buffer[128];
+ char buffer[1024];
if (fgets (buffer, sizeof buffer, stdin) == NULL)
break;
if (strncmp (buffer, "GETPIN", 6) == 0)
- printf ("D %s\nOK\n", getenv ("PINENTRY_USER_DATA") ?: "");
+ printf ("D %s\nOK\n", passphrase);
else if (strncmp (buffer, "BYE", 3) == 0)
{
printf ("OK\n");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git
More information about the Pkg-gnupg-commit
mailing list