aboutsummaryrefslogtreecommitdiffstats
path: root/agent/call-pinentry.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-11-03 19:07:56 +0000
committerWerner Koch <[email protected]>2016-11-03 19:10:38 +0000
commitc1ea0b577a468030d2b006317ba27fc1746c4b14 (patch)
tree5356039c0b3e26d5b4e039fb68419c74be35fa05 /agent/call-pinentry.c
parentg10: Improve and unify key selection for -r and --locate-keys. (diff)
downloadgnupg-c1ea0b577a468030d2b006317ba27fc1746c4b14.tar.gz
gnupg-c1ea0b577a468030d2b006317ba27fc1746c4b14.zip
agent: Extend the PINENTRY_LAUNCHED inquiry and status.
* agent/call-pinentry.c (start_pinentry): Get flavor and version and pass it to agent_inq_pinentry_launched. * agent/command.c (agent_inq_pinentry_launched): Add arg EXTRA. * g10/server.c (gpg_proxy_pinentry_notify): Print a new diagnostic. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'agent/call-pinentry.c')
-rw-r--r--agent/call-pinentry.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index 813df9a05..f83778e98 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -225,6 +225,7 @@ getinfo_pid_cb (void *opaque, const void *buffer, size_t length)
return 0;
}
+
/* Fork off the pin entry if this has not already been done. Note,
that this function must always be used to acquire the lock for the
pinentry - we will serialize _all_ pinentry calls.
@@ -243,6 +244,7 @@ start_pinentry (ctrl_t ctrl)
unsigned long pinentry_pid;
const char *value;
struct timespec abstime;
+ char *flavor_version;
int err;
npth_clock_gettime (&abstime);
@@ -539,6 +541,25 @@ start_pinentry (ctrl_t ctrl)
}
+ /* Ask the pinentry for its version and flavor and streo that as a
+ * string in MB. This information is useful for helping users to
+ * figure out Pinentry problems. */
+ {
+ membuf_t mb;
+
+ init_membuf (&mb, 256);
+ if (assuan_transact (entry_ctx, "GETINFO flavor",
+ put_membuf_cb, &mb, NULL, NULL, NULL, NULL))
+ put_membuf_str (&mb, "unknown");
+ put_membuf_str (&mb, " ");
+ if (assuan_transact (entry_ctx, "GETINFO version",
+ put_membuf_cb, &mb, NULL, NULL, NULL, NULL))
+ put_membuf_str (&mb, "unknown");
+ put_membuf (&mb, "", 1);
+ flavor_version = get_membuf (&mb, NULL);
+ }
+
+
/* Now ask the Pinentry for its PID. If the Pinentry is new enough
it will send the pid back and we will use an inquire to notify
our client. The client may answer the inquiry either with END or
@@ -555,7 +576,7 @@ start_pinentry (ctrl_t ctrl)
log_error ("pinentry did not return a PID\n");
else
{
- rc = agent_inq_pinentry_launched (ctrl, pinentry_pid);
+ rc = agent_inq_pinentry_launched (ctrl, pinentry_pid, flavor_version);
if (gpg_err_code (rc) == GPG_ERR_CANCELED
|| gpg_err_code (rc) == GPG_ERR_FULLY_CANCELED)
return unlock_pinentry (gpg_err_make (GPG_ERR_SOURCE_DEFAULT,
@@ -563,6 +584,8 @@ start_pinentry (ctrl_t ctrl)
rc = 0;
}
+ xfree (flavor_version);
+
return 0;
}