changeset: 7081:966f08249216 user: Kevin McCarthy <ke...@8t8.us> date: Thu Jun 08 13:26:35 2017 -0700 link: http://dev.mutt.org/hg/mutt/rev/966f08249216
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. diffs (62 lines): diff -r cf90bf5989f3 -r 966f08249216 init.c --- a/init.c Tue Jun 06 18:38:47 2017 -0700 +++ b/init.c Thu Jun 08 13:26:35 2017 -0700 @@ -3317,7 +3317,6 @@ char *domain = NULL; int i, need_pause = 0; BUFFER err; - char *tty; mutt_buffer_init (&err); err.dsize = STRING; @@ -3511,20 +3510,6 @@ unset_option (OPTSUSPEND); #endif - /* GPG_TTY is used by the ncurses pinentry program for GPG. GPG is - * sometimes also used to decrypt passwords in programs launched by - * mutt, such as using msmtp as $sendmail, so we set it here as - * opposed to inside pgp.c - * - * We also call setenv() because send_msg() is not converted to use - * the mutt envlist. - */ - if ((tty = ttyname(0))) - { - setenv("GPG_TTY", tty, 0); - mutt_envlist_set ("GPG_TTY", tty, 0); - } - mutt_init_history (); /* RFC2368, "4. Unsafe headers" diff -r cf90bf5989f3 -r 966f08249216 pgp.c --- a/pgp.c Tue Jun 06 18:38:47 2017 -0700 +++ b/pgp.c Thu Jun 08 13:26:35 2017 -0700 @@ -105,13 +105,21 @@ 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)