Re: [Mutt] #2901: wrong parameter micalg with mutt 1.5.15 and gpgme
#2901: wrong parameter micalg with mutt 1.5.15 and gpgme
Changes (by MrTux):
* status: new => closed
* resolution: => fixed
Comment:
The following patch solves the problem:
{{{
Index: crypt-gpgme.c
===================================================================
RCS file: /home/roessler/cvs/mutt/crypt-gpgme.c,v
retrieving revision 3.11
diff -u -r3.11 crypt-gpgme.c
--- crypt-gpgme.c 24 Feb 2007 06:12:20 -0000 3.11
+++ crypt-gpgme.c 5 Jun 2007 15:26:55 -0000
@@ -802,6 +802,7 @@
char *sigfile;
int err = 0;
char buf[100];
+ int i;
gpgme_ctx_t ctx;
gpgme_data_t message, signature;
@@ -868,8 +869,18 @@
&t->parameter);
/* Get the micalg from gpgme. Old gpgme versions don't support this
for S/MIME so we assume sha-1 in this case. */
- if (!get_micalg (ctx, buf, sizeof buf))
- mutt_set_parameter ("micalg", buf, &t->parameter);
+ if (!get_micalg (ctx, buf+4, sizeof buf - 4))
+ {
+ /*
+ * Convert result according to RFC3156
+ */
+ for (i = 4; buf[i] && i < sizeof buf; i++)
+ buf[i] = tolower(buf[i]);
+
+ strncpy(buf, "pgp-", 4);
+
+ mutt_set_parameter ("micalg", buf, &t->parameter);
+ }
else if (use_smime)
mutt_set_parameter ("micalg", "sha1", &t->parameter);
gpgme_release (ctx);
}}}
--
Ticket URL: <http://dev.mutt.org/trac/ticket/2901#comment:3>