1 From: Werner Koch <wk@gnupg.org>
2 Date: Fri, 3 Feb 2017 12:04:52 +0100
3 Subject: gpg: More diagnostics for a launched pinentry.
5 * agent/call-pinentry.c (start_pinentry): Call getinfo/ttyinfo.
6 * g10/server.c (gpg_proxy_pinentry_notify): Simplify the output so
7 that we do not change the code when adding new fields to
11 This patch changes the --verbose output of gpg to show
14 gpg: pinentry launched (5228 gtk2 1.0.1-beta10 \
15 /dev/pts/4 xterm localhost:10.0)
17 the used tty, its type, and the value of DISPLAY in addiion to the
18 pid, flavor, and version.
20 Signed-off-by: Werner Koch <wk@gnupg.org>
21 (cherry picked from commit 7052a0d77cf8f3a445b252a809d29be445788625)
23 agent/call-pinentry.c | 6 +++++-
24 g10/server.c | 19 ++++++++-----------
25 2 files changed, 13 insertions(+), 12 deletions(-)
27 diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
28 index fa00bf921..2bebee205 100644
29 --- a/agent/call-pinentry.c
30 +++ b/agent/call-pinentry.c
31 @@ -541,7 +541,7 @@ start_pinentry (ctrl_t ctrl)
35 - /* Ask the pinentry for its version and flavor and streo that as a
36 + /* Ask the pinentry for its version and flavor and store that as a
37 * string in MB. This information is useful for helping users to
38 * figure out Pinentry problems. */
40 @@ -555,6 +555,10 @@ start_pinentry (ctrl_t ctrl)
41 if (assuan_transact (entry_ctx, "GETINFO version",
42 put_membuf_cb, &mb, NULL, NULL, NULL, NULL))
43 put_membuf_str (&mb, "unknown");
44 + put_membuf_str (&mb, " ");
45 + if (assuan_transact (entry_ctx, "GETINFO ttyinfo",
46 + put_membuf_cb, &mb, NULL, NULL, NULL, NULL))
47 + put_membuf_str (&mb, "? ? ?");
48 put_membuf (&mb, "", 1);
49 flavor_version = get_membuf (&mb, NULL);
51 diff --git a/g10/server.c b/g10/server.c
52 index b89f0be69..e3a3bad22 100644
55 @@ -770,18 +770,15 @@ gpg_server (ctrl_t ctrl)
57 gpg_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line)
61 - char *linecopy = xtrystrdup (line);
65 - && split_fields (linecopy, fields, DIM (fields)) >= 4
66 - && !strcmp (fields[0], "PINENTRY_LAUNCHED"))
67 - log_info (_("pinentry launched (pid %s, flavor %s, version %s)\n"),
68 - fields[1], fields[2], fields[3]);
73 + && !strncmp (line, "PINENTRY_LAUNCHED", 17)
74 + && (line[17]==' '||!line[17]))
76 + for (s = line + 17; *s && spacep (s); s++)
78 + log_info (_("pinentry launched (%s)\n"), s);
81 if (!ctrl || !ctrl->server_local