1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-07 23:27:48 +02:00

agent: Fix envvars for UPDATESTARTUPTTY.

agent/command.c (cmd_updatestartuptty): Use session_env_list_stdenvnames
to get the list.

--

Debian-bug-id: 801247
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2016-07-13 09:24:26 +09:00
parent acb27915f8
commit 7be2181777

View File

@ -2663,14 +2663,13 @@ static const char hlp_updatestartuptty[] =
static gpg_error_t static gpg_error_t
cmd_updatestartuptty (assuan_context_t ctx, char *line) cmd_updatestartuptty (assuan_context_t ctx, char *line)
{ {
static const char *names[] =
{ "GPG_TTY", "DISPLAY", "TERM", "XAUTHORITY", "PINENTRY_USER_DATA", NULL };
ctrl_t ctrl = assuan_get_pointer (ctx); ctrl_t ctrl = assuan_get_pointer (ctx);
gpg_error_t err = 0; gpg_error_t err = 0;
session_env_t se; session_env_t se;
int idx;
char *lc_ctype = NULL; char *lc_ctype = NULL;
char *lc_messages = NULL; char *lc_messages = NULL;
int iterator;
const char *name;
(void)line; (void)line;
@ -2681,11 +2680,12 @@ cmd_updatestartuptty (assuan_context_t ctx, char *line)
if (!se) if (!se)
err = gpg_error_from_syserror (); err = gpg_error_from_syserror ();
for (idx=0; !err && names[idx]; idx++) iterator = 0;
while (!err && (name = session_env_list_stdenvnames (&iterator, NULL)))
{ {
const char *value = session_env_getenv (ctrl->session_env, names[idx]); const char *value = session_env_getenv (ctrl->session_env, name);
if (value) if (value)
err = session_env_setenv (se, names[idx], value); err = session_env_setenv (se, name, value);
} }
if (!err && ctrl->lc_ctype) if (!err && ctrl->lc_ctype)