*
* This file is part of GnuPG.
*
- * GnuPG is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of either
*
- * GnuPG is distributed in the hope that it will be useful,
+ * - the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * or
+ *
+ * - the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * or both in parallel, as here.
+ *
+ * This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
};
-/* A list of environment vribales we pass from the acual user
+/* A list of environment variables we pass from the actual user
(e.g. gpgme) down to the pinentry. We do not handle the locale
settings because they do not only depend on envvars. */
-static struct
-{
+static struct
+{
const char *name;
const char *assname; /* Name used by Assuan or NULL. */
} stdenvnames[] = {
modules (eg "@im=SCIM"). */
{ "GTK_IM_MODULE" }, /* Used by gtk to select gtk input
modules (eg "scim-bridge"). */
+ { "DBUS_SESSION_BUS_ADDRESS" },/* Used by GNOME3 to talk to gcr over
+ dbus */
{ "QT_IM_MODULE" }, /* Used by Qt to select qt input
modules (eg "xim"). */
- { "PINENTRY_USER_DATA", "pinentry-user-data"}
+ { "INSIDE_EMACS" }, /* Set by Emacs before running a
+ process. */
+ { "PINENTRY_USER_DATA", "pinentry-user-data"}
/* Used for communication with
non-standard Pinentries. */
};
se = xtrycalloc (1, sizeof *se);
if (se)
{
- se->arraysize = (lastallocatedarraysize?
+ se->arraysize = (lastallocatedarraysize?
lastallocatedarraysize : INITIAL_ARRAYSIZE);
se->array = xtrycalloc (se->arraysize, sizeof *se->array);
if (!se->array)
if (!se)
return;
- if (se->arraysize > INITIAL_ARRAYSIZE
+ if (se->arraysize > INITIAL_ARRAYSIZE
&& se->arraysize <= MAXDEFAULT_ARRAYSIZE
&& se->arraysize > lastallocatedarraysize)
lastallocatedarraysize = se->arraysize;
session_env_putenv (session_env_t se, const char *string)
{
const char *s;
-
+
if (!string || !*string)
return gpg_error (GPG_ERR_INV_VALUE);
s = strchr (string, '=');
*r_default = 1;
return se->array[idx]->value;
}
-
+
/* Get the default value with an additional fallback for GPG_TTY. */
defvalue = getenv (name);
- if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY") && ttyname (0))
- defvalue = ttyname (0);
+ if ((!defvalue || !*defvalue) && !strcmp (name, "GPG_TTY")
+ && gnupg_ttyname (0))
+ {
+ defvalue = gnupg_ttyname (0);
+ }
if (defvalue)
{
/* Record the default value for later use so that we are safe
explicit error anyway and the following scan would then fail
anyway. */
update_var (se, name, strlen (name), defvalue, 1);
-
+
for (idx=0; idx < se->arrayused; idx++)
if (se->array[idx] && !strcmp (se->array[idx]->name, name))
{
R_DEFAULT is not NULL, the default flag is stored on return. The
default flag indicates that the value has been taken from the
process' environment. The caller must not change the returned
- name or value. */
+ name or value. */
char *
session_env_listenv (session_env_t se, int *iterator,
const char **r_value, int *r_default)
}
return NULL;
}
-
-