diff options
author | Kevin McCarthy <kevin@8t8.us> | 2017-06-08 13:26:35 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2017-06-08 13:26:35 -0700 |
commit | c823f8b53a0f7874abf5413e20e9856a53a0c151 (patch) | |
tree | 8170512d9ef3cb2d8933b19f9ca0f32ebb471655 /pgp.c | |
parent | f2a54fadbe8019a4cc48b37585b21833d2da17ca (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.c | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -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) |