1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Reworked passing of envars to Pinentry.

This commit is contained in:
Werner Koch 2009-07-07 10:02:41 +00:00
parent 58e6e28bb1
commit f6f5430e50
31 changed files with 1169 additions and 352 deletions

View file

@ -1,6 +1,18 @@
2009-07-07 Werner Koch <wk@g10code.com>
* gpg.c (set_opt_session_env): New.
(main): Allocate opt.session_env. Use it for oDisplay, oTTYname,
oTTYtype and oXauthority.
* options.h: Include session_env.h.
(opt): Add field SESSION_ENV, remove obsolete fields.
* call-agent.c (start_agent): Adjust start_new_gpg_agent for
changed args.
2009-06-24 Werner Koch <wk@g10code.com>
* keyedit.c (menu_select_key): Renmove dead assign to I.
* keyedit.c (menu_select_key): Remove dead assign to I.
(menu_select_uid): Ditto.
* keyring.c (keyring_search): Remove dead assign to NAME.
* card-util.c (card_edit): Remove useless DID_CHECKPIN.

View file

@ -91,9 +91,8 @@ start_agent (void)
GPG_ERR_SOURCE_DEFAULT,
opt.homedir,
opt.agent_program,
opt.display, opt.ttyname, opt.ttytype,
opt.lc_ctype, opt.lc_messages,
opt.xauthority, opt.pinentry_user_data,
opt.session_env,
opt.verbose, DBG_ASSUAN,
NULL, NULL);
if (!rc)

View file

@ -955,6 +955,17 @@ make_username( const char *string )
}
static void
set_opt_session_env (const char *name, const char *value)
{
gpg_error_t err;
err = session_env_setenv (opt.session_env, name, value);
if (err)
log_fatal ("error setting session environment: %s\n",
gpg_strerror (err));
}
/* Setup the debugging. With a LEVEL of NULL only the active debug
flags are propagated to the subsystems. With LEVEL set, a specific
set of debug flags is set; thus overriding all flags already
@ -1935,6 +1946,10 @@ main (int argc, char **argv)
create_dotlock(NULL); /* Register locking cleanup. */
opt.session_env = session_env_new ();
if (!opt.session_env)
log_fatal ("error allocating session environment block: %s\n",
strerror (errno));
opt.command_fd = -1; /* no command fd */
opt.compress_level = -1; /* defaults to standard compress level */
@ -2820,12 +2835,23 @@ main (int argc, char **argv)
pers_compress_list=pargs.r.ret_str;
break;
case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
case oDisplay: opt.display = pargs.r.ret_str; break;
case oTTYname: opt.ttyname = pargs.r.ret_str; break;
case oTTYtype: opt.ttytype = pargs.r.ret_str; break;
case oDisplay:
set_opt_session_env ("DISPLAY", pargs.r.ret_str);
break;
case oTTYname:
set_opt_session_env ("GPG_TTY", pargs.r.ret_str);
break;
case oTTYtype:
set_opt_session_env ("TERM", pargs.r.ret_str);
break;
case oXauthority:
set_opt_session_env ("XAUTHORITY", pargs.r.ret_str);
break;
case oLCctype: opt.lc_ctype = pargs.r.ret_str; break;
case oLCmessages: opt.lc_messages = pargs.r.ret_str; break;
case oXauthority: opt.xauthority = pargs.r.ret_str; break;
case oGroup: add_group(pargs.r.ret_str); break;
case oUnGroup: rm_group(pargs.r.ret_str); break;
case oNoGroups:

View file

@ -24,6 +24,7 @@
#include <types.h>
#include "main.h"
#include "packet.h"
#include "../common/session-env.h"
#ifndef EXTERN_UNLESS_MAIN_MODULE
/* Norcraft can't cope with common symbols */
@ -85,13 +86,11 @@ struct
int max_cert_depth;
const char *homedir;
const char *agent_program;
char *display; /* 5 options to be passed to the gpg-agent */
char *ttyname;
char *ttytype;
/* Options to be passed to the gpg-agent */
session_env_t session_env;
char *lc_ctype;
char *lc_messages;
char *xauthority;
char *pinentry_user_data;
int skip_verify;
int compress_keys;