aboutsummaryrefslogtreecommitdiffstats
path: root/agent/query.c
diff options
context:
space:
mode:
authorMarcus Brinkmann <[email protected]>2002-04-24 21:52:47 +0000
committerMarcus Brinkmann <[email protected]>2002-04-24 21:52:47 +0000
commitee6bb32a8bf9adb3d0a48b0d527cda594e49355a (patch)
treeff9c1c7939f01bd1cc8b0116b87c07235956200f /agent/query.c
parent* certreqgen.c (gpgsm_genkey): Write status output on success. (diff)
downloadgnupg-ee6bb32a8bf9adb3d0a48b0d527cda594e49355a.tar.gz
gnupg-ee6bb32a8bf9adb3d0a48b0d527cda594e49355a.zip
2002-04-24 Marcus Brinkmann <[email protected]>
* configure.ac: Check for locale.h. agent/ 2002-04-24 Marcus Brinkmann <[email protected]> * agent.h (struct opt): Add members display, ttyname, ttytype, lc_ctype, and lc_messages. * gpg-agent.c (enum cmd_and_opt_values): Add oDisplay, oTTYname, oTTYtype, oLCctype, and LCmessages. (main): Handle these options. * command.c (option_handler): New function. (register_commands): Register option handler. * query.c (start_pinentry): Pass the various display and tty options to the pinentry. sm/ 2002-04-24 Marcus Brinkmann <[email protected]> * gpgsm.h (struct opt): New members display, ttyname, ttytype, lc_ctype, lc_messages. * gpgsm.c (enum cmd_and_opt_values): New members oDisplay, oTTYname, oTTYtype, oLCctype, oLCmessages. (opts): New entries for these options. (main): Handle these new options. * call-agent.c (start_agent): Set the various display and tty parameter after resetting.
Diffstat (limited to '')
-rw-r--r--agent/query.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/agent/query.c b/agent/query.c
index 09aada0fd..4243f0026 100644
--- a/agent/query.c
+++ b/agent/query.c
@@ -56,7 +56,7 @@ start_pinentry (void)
int rc;
const char *pgmname;
ASSUAN_CONTEXT ctx;
- const char *argv[3];
+ const char *argv[5];
if (entry_ctx)
return 0; /* No need to serialize things becuase the agent is
@@ -81,7 +81,14 @@ start_pinentry (void)
pgmname++;
argv[0] = pgmname;
- argv[1] = NULL;
+ if (opt.display)
+ {
+ argv[1] = "--display";
+ argv[2] = opt.display;
+ argv[3] = NULL;
+ }
+ else
+ argv[1] = NULL;
/* connect to the pinentry and perform initial handshaking */
rc = assuan_pipe_connect (&ctx, opt.pinentry_program, (char**)argv, 0);
@@ -100,7 +107,47 @@ start_pinentry (void)
NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
return map_assuan_err (rc);
-
+ if (opt.ttyname)
+ {
+ char *optstr;
+ if (asprintf (&optstr, "OPTION ttyname=%s", opt.ttyname) < 0 )
+ return GNUPG_Out_Of_Core;
+ rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ free (optstr);
+ if (rc)
+ return map_assuan_err (rc);
+ }
+ if (opt.ttytype)
+ {
+ char *optstr;
+ if (asprintf (&optstr, "OPTION ttytype=%s", opt.ttytype) < 0 )
+ return GNUPG_Out_Of_Core;
+ rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ if (rc)
+ return map_assuan_err (rc);
+ }
+ if (opt.lc_ctype)
+ {
+ char *optstr;
+ if (asprintf (&optstr, "OPTION lc-ctype=%s", opt.lc_ctype) < 0 )
+ return GNUPG_Out_Of_Core;
+ rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ if (rc)
+ return map_assuan_err (rc);
+ }
+ if (opt.lc_messages)
+ {
+ char *optstr;
+ if (asprintf (&optstr, "OPTION lc-messages=%s", opt.lc_messages) < 0 )
+ return GNUPG_Out_Of_Core;
+ rc = assuan_transact (entry_ctx, optstr, NULL, NULL, NULL, NULL, NULL,
+ NULL);
+ if (rc)
+ return map_assuan_err (rc);
+ }
return 0;
}