summaryrefslogtreecommitdiffstats
path: root/pgp.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-06-08 13:26:35 -0700
committerKevin McCarthy <kevin@8t8.us>2017-06-08 13:26:35 -0700
commitc823f8b53a0f7874abf5413e20e9856a53a0c151 (patch)
tree8170512d9ef3cb2d8933b19f9ca0f32ebb471655 /pgp.c
parentf2a54fadbe8019a4cc48b37585b21833d2da17ca (diff)
Backout 02ff4277259e (see #3948)
Vincent expressed some legitimate concerns about exporting this to all programs lauched by mutt. The user can always set GPG_TTY in their .bashrc if needed for $sendmail. cf90bf5989f3 should resolve the refresh issue.
Diffstat (limited to 'pgp.c')
-rw-r--r--pgp.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/pgp.c b/pgp.c
index 5c17e94a..653905f0 100644
--- a/pgp.c
+++ b/pgp.c
@@ -105,13 +105,21 @@ void pgp_forget_passphrase (void)
mutt_message _("PGP passphrase forgotten.");
}
-/* This function used to do more: check GPG_AGENT_INFO,
- * set GPG_TTY. GPG_AGENT_INFO is no longer exported, and GPG_TTY
- * is now set in mutt_init().
- */
int pgp_use_gpg_agent (void)
{
- return option (OPTUSEGPGAGENT);
+ char *tty;
+
+ /* GnuPG 2.1 no longer exports GPG_AGENT_INFO */
+ if (!option (OPTUSEGPGAGENT))
+ return 0;
+
+ if ((tty = ttyname(0)))
+ {
+ setenv("GPG_TTY", tty, 0);
+ mutt_envlist_set ("GPG_TTY", tty, 0);
+ }
+
+ return 1;
}
static pgp_key_t _pgp_parent(pgp_key_t k)