From 852b8f0b89d447536dfdf6cd4ea91615c75491ce Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Tue, 25 Oct 2016 17:07:08 +0200 Subject: agent,tests,w32: Fix relaying pinentry user data, fix fake-pinentry. * agent/call-pinentry.c (start_pinentry): Also send the user data using an Assuan 'OPTION' command. * tests/openpgp/fake-pinentry.c (get_passphrase): Fix updating passphrase file. (spacep): Include newline characters. (rstrip): New function. (main): Handle Windows line endings. Handle the userdata option, and restart with the new options. Signed-off-by: Justus Winter --- agent/call-pinentry.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'agent') diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 46db9e85e..813df9a05 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -354,6 +354,19 @@ start_pinentry (ctrl_t ctrl) if (DBG_IPC) log_debug ("connection to PIN entry established\n"); + value = session_env_getenv (ctrl->session_env, "PINENTRY_USER_DATA"); + if (value != NULL) + { + char *optstr; + if (asprintf (&optstr, "OPTION pinentry-user-data=%s", value) < 0 ) + return unlock_pinentry (out_of_core ()); + rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL, + NULL); + xfree (optstr); + if (rc && gpg_err_code (rc) != GPG_ERR_UNKNOWN_OPTION) + return unlock_pinentry (rc); + } + rc = assuan_transact (entry_ctx, opt.no_grab? "OPTION no-grab":"OPTION grab", NULL, NULL, NULL, NULL, NULL, NULL); -- cgit v1.2.3