mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
Reworked passing of envars to Pinentry.
This commit is contained in:
parent
58e6e28bb1
commit
f6f5430e50
31 changed files with 1169 additions and 352 deletions
29
sm/misc.c
29
sm/misc.c
|
@ -1,5 +1,5 @@
|
|||
/* misc.c - Miscellaneous fucntions
|
||||
* Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2004, 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -40,16 +40,16 @@ setup_pinentry_env (void)
|
|||
{
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
char *lc;
|
||||
|
||||
if (opt.display)
|
||||
setenv ("DISPLAY", opt.display, 1);
|
||||
const char *name, *value;
|
||||
int iterator;
|
||||
|
||||
/* Try to make sure that GPG_TTY has been set. This is needed if we
|
||||
call for example the protect-tools with redirected stdin and thus
|
||||
it won't be able to ge a default by itself. Try to do it here
|
||||
but print a warning. */
|
||||
if (opt.ttyname)
|
||||
setenv ("GPG_TTY", opt.ttyname, 1);
|
||||
value = session_env_getenv (opt.session_env, "GPG_TTY");
|
||||
if (value)
|
||||
setenv ("GPG_TTY", value, 1);
|
||||
else if (!(lc=getenv ("GPG_TTY")) || !*lc)
|
||||
{
|
||||
log_error (_("GPG_TTY has not been set - "
|
||||
|
@ -60,9 +60,6 @@ setup_pinentry_env (void)
|
|||
setenv ("GPG_TTY", lc, 1);
|
||||
}
|
||||
|
||||
if (opt.ttytype)
|
||||
setenv ("TERM", opt.ttytype, 1);
|
||||
|
||||
if (opt.lc_ctype)
|
||||
setenv ("LC_CTYPE", opt.lc_ctype, 1);
|
||||
#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
|
||||
|
@ -77,11 +74,15 @@ setup_pinentry_env (void)
|
|||
setenv ("LC_MESSAGES", lc, 1);
|
||||
#endif
|
||||
|
||||
if (opt.xauthority)
|
||||
setenv ("XAUTHORITY", opt.xauthority, 1);
|
||||
|
||||
if (opt.pinentry_user_data)
|
||||
setenv ("PINENTRY_USER_DATA", opt.pinentry_user_data, 1);
|
||||
iterator = 0;
|
||||
while ((name = session_env_list_stdenvnames (&iterator, NULL)))
|
||||
{
|
||||
if (!strcmp (name, "GPG_TTY"))
|
||||
continue; /* Already set. */
|
||||
value = session_env_getenv (opt.session_env, name);
|
||||
if (value)
|
||||
setenv (name, value, 1);
|
||||
}
|
||||
|
||||
#endif /*!HAVE_W32_SYSTEM*/
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue