summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-10-25 17:07:08 +0200
committerJustus Winter <justus@g10code.com>2016-10-25 17:07:08 +0200
commit852b8f0b89d447536dfdf6cd4ea91615c75491ce (patch)
tree6aab32c1f5e502e6dbf56864b05af90f2e770fd5 /agent
parenttests: Do not autostart gpg-agents on teardown. (diff)
downloadgnupg2-852b8f0b89d447536dfdf6cd4ea91615c75491ce.tar.xz
gnupg2-852b8f0b89d447536dfdf6cd4ea91615c75491ce.zip
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 <justus@g10code.com>
Diffstat (limited to 'agent')
-rw-r--r--agent/call-pinentry.c13
1 files changed, 13 insertions, 0 deletions
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);