#1812: pgp-hook cannot be auto accepted -------------------------------------------------------------------+-------- Reporter: Bas Wijnen <shevek@…> | Owner: mutt-dev Type: enhancement | Status: new Priority: trivial | Milestone: Component: mutt | Version: 1.3.28i Keywords: patch | -------------------------------------------------------------------+-------- Changes (by me):
* type: defect => enhancement Old description: > {{{ > Package: mutt > Version: 1.3.28-2.2 > Severity: wishlist > > -- Please type your report below this line > I send pgp encrypted mail to someone. Every time I try this, mutt shows > me a > dialog with only one entry, asking me to choose the key to use. > > I hoped to get rid of that dialog using the pgp-hook command in the > config > file. This didn't quite work, since I still have to press enter, this > time > to the question "use this key?" > > I checked the documentation and the source, and found that this question > cannot > be disabled. I wrote a patch to add it as a quadoption, with the default > the > same as it is now. I included it in the report (it is a patch against > the > source I got from apt-get source mutt in debian unstable.) > > I didn't quite understand what R_NONE does, so it may need to be a > different > value. > > I compiled the code with this patch (it gave quite a number of warnings > by the > way, not related to this patch, using gcc 3.3) and that resulted in a > valid > executable, and it seemed to behave reasonable at a little testing as > well. > However, with a nonexisting key in the hook, and the value set to "yes", > it > didn't ask me to enter a keyID at all, which surprised me. Perhaps some > more > testing is needed. > > The specifications below are not what I used to compile mutt, by the way, > but > they are what I use to run it normally (Debian stable) > > Thanks, > Bas Wijnen > > diff -rup mutt-1.5.5.1/init.h mutt-shevek/init.h > --- mutt-1.5.5.1/init.h 2003-11-05 10:41:32.000000000 +0100 > +++ mutt-shevek/init.h 2004-02-19 19:56:02.000000000 +0100 > @@ -117,6 +117,12 @@ struct option_t MuttVars[] = { > ** check only happens after the \fIfirst\fP edit of the file). When > set > ** to \fIno\fP, composition will never be aborted. > */ > + { "accept_pgphook", DT_QUAD, R_NONE, OPT_ACCEPTPGPHOOK, M_ASKYES }, > + /* > + ** .pp > + ** If set to \fIyes\fP, pgp-hook keys will be accepted without > question. > + ** Setting this to \fIno\fP effectively disables the pgp-hook command. > + */ > { "alias_file", DT_PATH, R_NONE, UL &AliasFile, UL "~/.muttrc" }, > /* > ** .pp > diff -rup mutt-1.5.5.1/mutt.h mutt-shevek/mutt.h > --- mutt-1.5.5.1/mutt.h 2003-11-05 10:41:32.000000000 +0100 > +++ mutt-shevek/mutt.h 2004-02-19 19:44:14.000000000 +0100 > @@ -289,6 +289,7 @@ enum > #endif > OPT_SUBJECT, > OPT_VERIFYSIG, /* verify PGP signatures */ > + OPT_ACCEPTPGPHOOK, /* accept a key from a pgp-hook */ > > /* THIS MUST BE THE LAST VALUE. */ > OPT_MAX > diff -rup mutt-1.5.5.1/pgp.c mutt-shevek/pgp.c > --- mutt-1.5.5.1/pgp.c 2003-11-05 10:41:33.000000000 +0100 > +++ mutt-shevek/pgp.c 2004-02-19 19:49:35.000000000 +0100 > @@ -1055,7 +1055,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS > { > int r; > snprintf (buf, sizeof (buf), _("Use keyID = \"%s\" for %s?"), > keyID, p->mailbox); > - if ((r = mutt_yesorno (buf, M_YES)) == M_YES) > + if ((r = query_quadoption (OPT_ACCEPTPGPHOOK, buf)) == M_YES) > { > if (is_numerical_keyid (keyID)) > { > > -- Build environment information > > (Note: This is the build environment installed on the system > muttbug is run on. Information may or may not match the environment > used to build mutt.) > > - gcc version information > cc > Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs > gcc version 2.95.4 20011002 (Debian prerelease) > > - CFLAGS > -Wall -pedantic -g -O2 > > -- Mutt Version Information > > Mutt 1.3.28i (2002-03-13) > Copyright (C) 1996-2001 Michael R. Elkins and others. > Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'. > Mutt is free software, and you are welcome to redistribute it > under certain conditions; type `mutt -vv' for details. > > System: Linux 2.4.20 (i586) [using ncurses 5.2] > Compile options: > -DOMAIN > -DEBUG > -HOMESPOOL +USE_SETGID +USE_DOTLOCK +DL_STANDALONE > +USE_FCNTL -USE_FLOCK > +USE_POP +USE_IMAP -USE_GSS -USE_SSL +USE_GNUTLS +USE_SASL > +HAVE_REGCOMP -USE_GNU_REGEX > +HAVE_COLOR +HAVE_START_COLOR +HAVE_TYPEAHEAD +HAVE_BKGDSET > +HAVE_CURS_SET +HAVE_META +HAVE_RESIZETERM > +HAVE_PGP -BUFFY_SIZE -EXACT_ADDRESS -SUN_ATTACHMENT > +ENABLE_NLS -LOCALES_HACK +COMPRESSED +HAVE_WC_FUNCS > +HAVE_LANGINFO_CODESET +HAVE_LANGINFO_YESEXPR > +HAVE_ICONV -ICONV_NONTRANS +HAVE_GETSID +HAVE_GETADDRINFO > ISPELL="/usr/bin/ispell" > SENDMAIL="/usr/sbin/sendmail" > MAILPATH="/var/mail" > PKGDATADIR="/usr/share/mutt" > SYSCONFDIR="/etc" > EXECSHELL="/bin/sh" > MIXMASTER="mixmaster" > To contact the developers, please mail to <mutt-dev@mutt.org>. > To report a bug, please use the flea(1) utility. > > patch-1.5.tlr.mx_open_append.2 > patch-1.3.28.cvs.indexsegfault > patch-1.3.27.bse.xtitles.1 > patch-1.3.26.appoct.3 > patch-1.3.15.sw.pgp-outlook.1 > patch-1.3.27.admcd.gnutls.19 > Md.use_editor > Md.paths_mutt.man > Md.muttbug_no_list > Md.use_etc_mailname > Md.muttbug_warning > Md.gpg_status_fd > patch-1.3.24.rr.compressed.1 > patch-1.3.25.cd.edit_threads.9.1 > patch-1.3.23.1.ametzler.pgp_good_sign > > >How-To-Repeat: > > >Fix: > }}} New description: {{{ Package: mutt Version: 1.3.28-2.2 Severity: wishlist -- Please type your report below this line I send pgp encrypted mail to someone. Every time I try this, mutt shows me a dialog with only one entry, asking me to choose the key to use. I hoped to get rid of that dialog using the pgp-hook command in the config file. This didn't quite work, since I still have to press enter, this time to the question "use this key?" I checked the documentation and the source, and found that this question cannot be disabled. I wrote a patch to add it as a quadoption, with the default the same as it is now. I included it in the report (it is a patch against the source I got from apt-get source mutt in debian unstable.) I didn't quite understand what R_NONE does, so it may need to be a different value. I compiled the code with this patch (it gave quite a number of warnings by the way, not related to this patch, using gcc 3.3) and that resulted in a valid executable, and it seemed to behave reasonable at a little testing as well. However, with a nonexisting key in the hook, and the value set to "yes", it didn't ask me to enter a keyID at all, which surprised me. Perhaps some more testing is needed. The specifications below are not what I used to compile mutt, by the way, but they are what I use to run it normally (Debian stable) Thanks, Bas Wijnen diff -rup mutt-1.5.5.1/init.h mutt-shevek/init.h --- mutt-1.5.5.1/init.h 2003-11-05 10:41:32.000000000 +0100 +++ mutt-shevek/init.h 2004-02-19 19:56:02.000000000 +0100 @@ -117,6 +117,12 @@ struct option_t MuttVars[] = { ** check only happens after the \fIfirst\fP edit of the file). When set ** to \fIno\fP, composition will never be aborted. */ + { "accept_pgphook", DT_QUAD, R_NONE, OPT_ACCEPTPGPHOOK, M_ASKYES }, + /* + ** .pp + ** If set to \fIyes\fP, pgp-hook keys will be accepted without question. + ** Setting this to \fIno\fP effectively disables the pgp-hook command. + */ { "alias_file", DT_PATH, R_NONE, UL &AliasFile, UL "~/.muttrc" }, /* ** .pp diff -rup mutt-1.5.5.1/mutt.h mutt-shevek/mutt.h --- mutt-1.5.5.1/mutt.h 2003-11-05 10:41:32.000000000 +0100 +++ mutt-shevek/mutt.h 2004-02-19 19:44:14.000000000 +0100 @@ -289,6 +289,7 @@ enum #endif OPT_SUBJECT, OPT_VERIFYSIG, /* verify PGP signatures */ + OPT_ACCEPTPGPHOOK, /* accept a key from a pgp-hook */ /* THIS MUST BE THE LAST VALUE. */ OPT_MAX diff -rup mutt-1.5.5.1/pgp.c mutt-shevek/pgp.c --- mutt-1.5.5.1/pgp.c 2003-11-05 10:41:33.000000000 +0100 +++ mutt-shevek/pgp.c 2004-02-19 19:49:35.000000000 +0100 @@ -1055,7 +1055,7 @@ char *pgp_findKeys (ADDRESS *to, ADDRESS { int r; snprintf (buf, sizeof (buf), _("Use keyID = \"%s\" for %s?"), keyID, p->mailbox); - if ((r = mutt_yesorno (buf, M_YES)) == M_YES) + if ((r = query_quadoption (OPT_ACCEPTPGPHOOK, buf)) == M_YES) { if (is_numerical_keyid (keyID)) { -- Build environment information (Note: This is the build environment installed on the system muttbug is run on. Information may or may not match the environment used to build mutt.) - gcc version information cc Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs gcc version 2.95.4 20011002 (Debian prerelease) - CFLAGS -Wall -pedantic -g -O2 -- Mutt Version Information Mutt 1.3.28i (2002-03-13) Copyright (C) 1996-2001 Michael R. Elkins and others. Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'. Mutt is free software, and you are welcome to redistribute it under certain conditions; type `mutt -vv' for details. System: Linux 2.4.20 (i586) [using ncurses 5.2] Compile options: -DOMAIN -DEBUG -HOMESPOOL +USE_SETGID +USE_DOTLOCK +DL_STANDALONE +USE_FCNTL -USE_FLOCK +USE_POP +USE_IMAP -USE_GSS -USE_SSL +USE_GNUTLS +USE_SASL +HAVE_REGCOMP -USE_GNU_REGEX +HAVE_COLOR +HAVE_START_COLOR +HAVE_TYPEAHEAD +HAVE_BKGDSET +HAVE_CURS_SET +HAVE_META +HAVE_RESIZETERM +HAVE_PGP -BUFFY_SIZE -EXACT_ADDRESS -SUN_ATTACHMENT +ENABLE_NLS -LOCALES_HACK +COMPRESSED +HAVE_WC_FUNCS +HAVE_LANGINFO_CODESET +HAVE_LANGINFO_YESEXPR +HAVE_ICONV -ICONV_NONTRANS +HAVE_GETSID +HAVE_GETADDRINFO ISPELL="/usr/bin/ispell" SENDMAIL="/usr/sbin/sendmail" MAILPATH="/var/mail" PKGDATADIR="/usr/share/mutt" SYSCONFDIR="/etc" EXECSHELL="/bin/sh" MIXMASTER="mixmaster" To contact the developers, please mail to <mutt-dev@mutt.org>. To report a bug, please use the flea(1) utility. patch-1.5.tlr.mx_open_append.2 patch-1.3.28.cvs.indexsegfault patch-1.3.27.bse.xtitles.1 patch-1.3.26.appoct.3 patch-1.3.15.sw.pgp-outlook.1 patch-1.3.27.admcd.gnutls.19 Md.use_editor Md.paths_mutt.man Md.muttbug_no_list Md.use_etc_mailname Md.muttbug_warning Md.gpg_status_fd patch-1.3.24.rr.compressed.1 patch-1.3.25.cd.edit_threads.9.1 patch-1.3.23.1.ametzler.pgp_good_sign >How-To-Repeat: >Fix: }}} -- -- Ticket URL: <http://dev.mutt.org/trac/ticket/1812#comment:3> Mutt <http://www.mutt.org/> The Mutt mail user agent