From 309f464a5952c7d7504b875bf4853914b1242346 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 3 Feb 2017 17:13:08 +0100 Subject: agent: Tell the Pinentry the client's pid. * configure.ac: Check for SO_PEERCRED et al. * agent/agent.h (server_control_s): Add field 'client_pid'. * agent/command.c (start_command_handler): Set CLIENT_PID. * agent/command-ssh.c (get_client_pid): New. (start_command_handler_ssh): Set CLIENT_PID. * agent/call-pinentry.c (start_pinentry): Tell Pinentry the client-pid. Signed-off-by: Werner Koch --- agent/call-pinentry.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'agent/call-pinentry.c') diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 2bebee205..384b23a64 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -540,6 +540,20 @@ start_pinentry (ctrl_t ctrl) } } + /* Tell Pinentry about our client. */ + if (ctrl->client_pid) + { + char *optstr; + if ((optstr = xtryasprintf ("OPTION owner=%lu", ctrl->client_pid))) + { + assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL, + NULL); + /* We ignore errors because this is just a fancy thing and + older pinentries do not support this feature. */ + xfree (optstr); + } + } + /* Ask the pinentry for its version and flavor and store that as a * string in MB. This information is useful for helping users to -- cgit v1.2.3