Mon Feb 22 12:13:26 2016 UTC ()
mutt{,-kz}: add upstream patch for better S/MIME support, bump PKGREVISION.

# HG changeset patch
# User Kevin McCarthy <kevin@8t8.us>
# Date 1449022827 28800
#      Tue Dec 01 18:20:27 2015 -0800
# Node ID 5e5aff1782dc62044197c2230d346bd492706fbf
# Parent  428a92464d5bccccda818bed598610db212fcf7c
Loosen mutt_signed_handler() protocol value consistency check.  (closes #3639)

Apparently, for S/MIME, some MUAs mismatch the protocol value of
the multipart/signed and the content-type of the signature: putting
"pkcs7-signature" in one and "x-pkcs7-signature" in the other.

Change mutt_signed_handler() to independently verify the values of the
protocol and the content-type.  This still checks for correct values but
doesn't ensure they match between the two (for S/MIME).


(wiz)
diff -r1.174 -r1.175 pkgsrc/mail/mutt/Makefile
diff -r1.39 -r1.40 pkgsrc/mail/mutt/distinfo
diff -r1.10 -r1.11 pkgsrc/mail/mutt-kz/Makefile
diff -r1.3 -r1.4 pkgsrc/mail/mutt-kz/distinfo
diff -r0 -r1.1 pkgsrc/mail/mutt-kz/patches/patch-crypt.c
diff -r0 -r1.1 pkgsrc/mail/mutt/patches/patch-crypt.c

cvs diff -r1.174 -r1.175 pkgsrc/mail/mutt/Makefile (expand / switch to unified diff)

--- pkgsrc/mail/mutt/Makefile 2016/01/07 15:19:41 1.174
+++ pkgsrc/mail/mutt/Makefile 2016/02/22 12:13:26 1.175
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1# $NetBSD: Makefile,v 1.174 2016/01/07 15:19:41 wiz Exp $ 1# $NetBSD: Makefile,v 1.175 2016/02/22 12:13:26 wiz Exp $
2 2
3DISTNAME= mutt-1.5.24 3DISTNAME= mutt-1.5.24
4PKGREVISION= 1 4PKGREVISION= 2
5CATEGORIES= mail 5CATEGORIES= mail
6MASTER_SITES= ftp://ftp.mutt.org/pub/mutt/ 6MASTER_SITES= ftp://ftp.mutt.org/pub/mutt/
7 7
8MAINTAINER= tonio@NetBSD.org 8MAINTAINER= tonio@NetBSD.org
9HOMEPAGE= http://www.mutt.org/ 9HOMEPAGE= http://www.mutt.org/
10COMMENT= Text-based MIME mail client with PGP & S/MIME support 10COMMENT= Text-based MIME mail client with PGP & S/MIME support
11LICENSE= gnu-gpl-v2 OR gnu-gpl-v3 # or newer 11LICENSE= gnu-gpl-v2 OR gnu-gpl-v3 # or newer
12 12
13.include "Makefile.common" 13.include "Makefile.common"
14 14
15.include "../../mk/bsd.pkg.mk" 15.include "../../mk/bsd.pkg.mk"

cvs diff -r1.39 -r1.40 pkgsrc/mail/mutt/distinfo (expand / switch to unified diff)

--- pkgsrc/mail/mutt/distinfo 2015/11/03 23:27:10 1.39
+++ pkgsrc/mail/mutt/distinfo 2016/02/22 12:13:26 1.40
@@ -1,23 +1,24 @@ @@ -1,23 +1,24 @@
1$NetBSD: distinfo,v 1.39 2015/11/03 23:27:10 agc Exp $ 1$NetBSD: distinfo,v 1.40 2016/02/22 12:13:26 wiz Exp $
2 2
3SHA1 (mutt-1.5.24.tar.gz) = 38a2da5eb01ff83a90a2caee28fa2e95dbfe6898 3SHA1 (mutt-1.5.24.tar.gz) = 38a2da5eb01ff83a90a2caee28fa2e95dbfe6898
4RMD160 (mutt-1.5.24.tar.gz) = 7fe7e653c27c9b580f958493638c1248d0ad5591 4RMD160 (mutt-1.5.24.tar.gz) = 7fe7e653c27c9b580f958493638c1248d0ad5591
5SHA512 (mutt-1.5.24.tar.gz) = f7fe7edf9d1701a8e92761b1f5e6ef2e3a3b513af7898872cbe36a8800714cb76945788a60d2008820c57bc5344a4147e2686f690da42cfc8a912e3a432452b1 5SHA512 (mutt-1.5.24.tar.gz) = f7fe7edf9d1701a8e92761b1f5e6ef2e3a3b513af7898872cbe36a8800714cb76945788a60d2008820c57bc5344a4147e2686f690da42cfc8a912e3a432452b1
6Size (mutt-1.5.24.tar.gz) = 3897115 bytes 6Size (mutt-1.5.24.tar.gz) = 3897115 bytes
7SHA1 (patch-1.5.24.rr.compressed.gz) = 8da54323dfc9c1049bf0411db2f552593793e99f 7SHA1 (patch-1.5.24.rr.compressed.gz) = 8da54323dfc9c1049bf0411db2f552593793e99f
8RMD160 (patch-1.5.24.rr.compressed.gz) = 2bf71a26de195ce11ed4ffa25403363cab7c9b72 8RMD160 (patch-1.5.24.rr.compressed.gz) = 2bf71a26de195ce11ed4ffa25403363cab7c9b72
9Size (patch-1.5.24.rr.compressed.gz) = 10019 bytes 9Size (patch-1.5.24.rr.compressed.gz) = 10019 bytes
10SHA1 (patch-aa) = 59d89dce24110be2927c8a1ea1fa5b780d644372 10SHA1 (patch-aa) = 59d89dce24110be2927c8a1ea1fa5b780d644372
11SHA1 (patch-ab) = 7c307068e129eb71ba251d175186dc9c5b171681 11SHA1 (patch-ab) = 7c307068e129eb71ba251d175186dc9c5b171681
12SHA1 (patch-ac) = 40d119b7efed1a4622c42badc9ee97349b504044 12SHA1 (patch-ac) = 40d119b7efed1a4622c42badc9ee97349b504044
13SHA1 (patch-ad) = 6db5792162a0752ee533f5cd4cb3896e0ca92344 13SHA1 (patch-ad) = 6db5792162a0752ee533f5cd4cb3896e0ca92344
14SHA1 (patch-ae) = 6534848a4c27d4a3830edd8d4e19d1181fe396d6 14SHA1 (patch-ae) = 6534848a4c27d4a3830edd8d4e19d1181fe396d6
15SHA1 (patch-af) = edc107c535789919ba2cda5f81a4b640b6100b91 15SHA1 (patch-af) = edc107c535789919ba2cda5f81a4b640b6100b91
16SHA1 (patch-ag) = b7902d2412538f15bc25b123ca742c03a3dd3a12 16SHA1 (patch-ag) = b7902d2412538f15bc25b123ca742c03a3dd3a12
17SHA1 (patch-ah) = dfe747c30a44bb309cccaca1bd5174fccc3c2bed 17SHA1 (patch-ah) = dfe747c30a44bb309cccaca1bd5174fccc3c2bed
18SHA1 (patch-al) = 49542905cde263b8d4c79f71cce3759024c804a3 18SHA1 (patch-al) = 49542905cde263b8d4c79f71cce3759024c804a3
19SHA1 (patch-am) = f7f20860bccb63ed5464e3a1225719ffc3fa504f 19SHA1 (patch-am) = f7f20860bccb63ed5464e3a1225719ffc3fa504f
20SHA1 (patch-an) = b9cc3e957bb1650c8e22c0edf0ce112f769664a1 20SHA1 (patch-an) = b9cc3e957bb1650c8e22c0edf0ce112f769664a1
21SHA1 (patch-ao) = a5dddb01d30f28337ca825c6461139c2d9f288d5 21SHA1 (patch-ao) = a5dddb01d30f28337ca825c6461139c2d9f288d5
22SHA1 (patch-ap) = c6f79d5c4e19efdc15e9d5a59934da52b16b7a62 22SHA1 (patch-ap) = c6f79d5c4e19efdc15e9d5a59934da52b16b7a62
23SHA1 (patch-aq) = e363d8929ced9731a31af1137b111d3476a3d05d 23SHA1 (patch-aq) = e363d8929ced9731a31af1137b111d3476a3d05d
 24SHA1 (patch-crypt.c) = 05cc74fe4ff2543029d82cbeedc27302db9ec4a7

cvs diff -r1.10 -r1.11 pkgsrc/mail/mutt-kz/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/mail/mutt-kz/Attic/Makefile 2016/01/07 15:19:41 1.10
+++ pkgsrc/mail/mutt-kz/Attic/Makefile 2016/02/22 12:13:26 1.11
@@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
1# $NetBSD: Makefile,v 1.10 2016/01/07 15:19:41 wiz Exp $ 1# $NetBSD: Makefile,v 1.11 2016/02/22 12:13:26 wiz Exp $
2 2
3DISTNAME= mutt-kz-1.5.23.1-rc1 3DISTNAME= mutt-kz-1.5.23.1-rc1
4PKGREVISION= 2 4PKGREVISION= 3
5PKGNAME= ${DISTNAME:S/-rc/rc/} 5PKGNAME= ${DISTNAME:S/-rc/rc/}
6CATEGORIES= mail 6CATEGORIES= mail
7MASTER_SITES= ftp://redcrew.org/pub/mutt-kz/v1.5.23.1/ 7MASTER_SITES= ftp://redcrew.org/pub/mutt-kz/v1.5.23.1/
8EXTRACT_SUFX= .tar.xz 8EXTRACT_SUFX= .tar.xz
9 9
10MAINTAINER= wiz@NetBSD.org 10MAINTAINER= wiz@NetBSD.org
11HOMEPAGE= https://kzak.redcrew.org/doku.php?id=mutt:start 11HOMEPAGE= https://kzak.redcrew.org/doku.php?id=mutt:start
12COMMENT= Text-based MIME mail client with notmuch, PGP & S/MIME support 12COMMENT= Text-based MIME mail client with notmuch, PGP & S/MIME support
13LICENSE= gnu-gpl-v2 OR gnu-gpl-v3 # or newer 13LICENSE= gnu-gpl-v2 OR gnu-gpl-v3 # or newer
14 14
15CONFIGURE_ARGS+= --enable-notmuch 15CONFIGURE_ARGS+= --enable-notmuch
16 16
17# On case-insensitive file systems like on OS X, version.sh is used 17# On case-insensitive file systems like on OS X, version.sh is used
18# to re-create VERSION, and fails. Make sure VERSION is newer than 18# to re-create VERSION, and fails. Make sure VERSION is newer than
19# version.sh to avoid this. 19# version.sh to avoid this.
20pre-build: 20pre-build:

cvs diff -r1.3 -r1.4 pkgsrc/mail/mutt-kz/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/mail/mutt-kz/Attic/distinfo 2015/04/02 22:38:42 1.3
+++ pkgsrc/mail/mutt-kz/Attic/distinfo 2016/02/22 12:13:26 1.4
@@ -1,19 +1,20 @@ @@ -1,19 +1,20 @@
1$NetBSD: distinfo,v 1.3 2015/04/02 22:38:42 wiz Exp $ 1$NetBSD: distinfo,v 1.4 2016/02/22 12:13:26 wiz Exp $
2 2
3SHA1 (mutt-kz-1.5.23.1-rc1.tar.xz) = a2ac1d76708a9c5e1546b406110ce180ffcb738b 3SHA1 (mutt-kz-1.5.23.1-rc1.tar.xz) = a2ac1d76708a9c5e1546b406110ce180ffcb738b
4RMD160 (mutt-kz-1.5.23.1-rc1.tar.xz) = fb7e2a5715ab3e016311e7fd9b457e6a5bd7c7a6 4RMD160 (mutt-kz-1.5.23.1-rc1.tar.xz) = fb7e2a5715ab3e016311e7fd9b457e6a5bd7c7a6
5Size (mutt-kz-1.5.23.1-rc1.tar.xz) = 1885100 bytes 5Size (mutt-kz-1.5.23.1-rc1.tar.xz) = 1885100 bytes
6SHA1 (patch-aa) = 59d89dce24110be2927c8a1ea1fa5b780d644372 6SHA1 (patch-aa) = 59d89dce24110be2927c8a1ea1fa5b780d644372
7SHA1 (patch-ab) = 731f5c207f9cf7dc05fc806665db14300d4647be 7SHA1 (patch-ab) = 731f5c207f9cf7dc05fc806665db14300d4647be
8SHA1 (patch-ac) = 40d119b7efed1a4622c42badc9ee97349b504044 8SHA1 (patch-ac) = 40d119b7efed1a4622c42badc9ee97349b504044
9SHA1 (patch-ad) = ecfa994c7c5e494b6eb7356327b96de6559146fc 9SHA1 (patch-ad) = ecfa994c7c5e494b6eb7356327b96de6559146fc
10SHA1 (patch-ae) = 6534848a4c27d4a3830edd8d4e19d1181fe396d6 10SHA1 (patch-ae) = 6534848a4c27d4a3830edd8d4e19d1181fe396d6
11SHA1 (patch-af) = 36ca7b54d42537b1d23d87e58d6e31dbad032c0e 11SHA1 (patch-af) = 36ca7b54d42537b1d23d87e58d6e31dbad032c0e
12SHA1 (patch-ag) = 6633e7485c948433f9122a649fdf3a548197eced 12SHA1 (patch-ag) = 6633e7485c948433f9122a649fdf3a548197eced
13SHA1 (patch-ah) = dfe747c30a44bb309cccaca1bd5174fccc3c2bed 13SHA1 (patch-ah) = dfe747c30a44bb309cccaca1bd5174fccc3c2bed
14SHA1 (patch-al) = 49542905cde263b8d4c79f71cce3759024c804a3 14SHA1 (patch-al) = 49542905cde263b8d4c79f71cce3759024c804a3
15SHA1 (patch-am) = f7f20860bccb63ed5464e3a1225719ffc3fa504f 15SHA1 (patch-am) = f7f20860bccb63ed5464e3a1225719ffc3fa504f
16SHA1 (patch-an) = b9cc3e957bb1650c8e22c0edf0ce112f769664a1 16SHA1 (patch-an) = b9cc3e957bb1650c8e22c0edf0ce112f769664a1
17SHA1 (patch-ao) = ddd3157233c481a89f2f3896192fef7121e16276 17SHA1 (patch-ao) = ddd3157233c481a89f2f3896192fef7121e16276
18SHA1 (patch-ap) = 810715ebe1c931cf19059261d614dcc9d5cfe82a 18SHA1 (patch-ap) = 810715ebe1c931cf19059261d614dcc9d5cfe82a
19SHA1 (patch-aq) = e363d8929ced9731a31af1137b111d3476a3d05d 19SHA1 (patch-aq) = e363d8929ced9731a31af1137b111d3476a3d05d
 20SHA1 (patch-crypt.c) = 05cc74fe4ff2543029d82cbeedc27302db9ec4a7

File Added: pkgsrc/mail/mutt-kz/patches/Attic/patch-crypt.c
$NetBSD: patch-crypt.c,v 1.1 2016/02/22 12:13:26 wiz Exp $

# HG changeset patch
# User Kevin McCarthy <kevin@8t8.us>
# Date 1449022827 28800
#      Tue Dec 01 18:20:27 2015 -0800
# Node ID 5e5aff1782dc62044197c2230d346bd492706fbf
# Parent  428a92464d5bccccda818bed598610db212fcf7c
Loosen mutt_signed_handler() protocol value consistency check.  (closes #3639)

Apparently, for S/MIME, some MUAs mismatch the protocol value of
the multipart/signed and the content-type of the signature: putting
"pkcs7-signature" in one and "x-pkcs7-signature" in the other.

Change mutt_signed_handler() to independently verify the values of the
protocol and the content-type.  This still checks for correct values but
doesn't ensure they match between the two (for S/MIME).

--- crypt.c.orig	2013-02-06 13:22:15.000000000 +0000
+++ crypt.c
@@ -772,9 +772,8 @@ static void crypt_fetch_signatures (BODY
 int mutt_signed_handler (BODY *a, STATE *s)
 {
   char tempfile[_POSIX_PATH_MAX];
-  char *protocol;
-  int protocol_major = TYPEOTHER;
-  char *protocol_minor = NULL;
+  int signed_type;
+  int inconsistent = 0;
   
   BODY *b = a;
   BODY **signatures = NULL;
@@ -786,29 +785,44 @@ int mutt_signed_handler (BODY *a, STATE 
   if (!WithCrypto)
     return -1;
 
-  protocol = mutt_get_parameter ("protocol", a->parameter);
   a = a->parts;
-
-  /* extract the protocol information */
-  
-  if (protocol)
+  signed_type = mutt_is_multipart_signed (b);
+  if (!signed_type)
   {
-    char major[STRING];
-    char *t;
-
-    if ((protocol_minor = strchr (protocol, '/'))) protocol_minor++;
-    
-    strfcpy (major, protocol, sizeof(major));
-    if((t = strchr(major, '/')))
-      *t = '\0';
-    
-    protocol_major = mutt_check_mime_type (major);
+    /* A null protocol value is already checked for in mutt_body_handler() */
+    state_printf (s, _("[-- Error: "
+                       "Unknown multipart/signed protocol %s! --]\n\n"),
+                  mutt_get_parameter ("protocol", b->parameter));
+    return mutt_body_handler (a, s);
   }
 
-  /* consistency check */
-
-  if (!(a && a->next && a->next->type == protocol_major && 
-      !mutt_strcasecmp (a->next->subtype, protocol_minor)))
+  if (!(a && a->next))
+    inconsistent = 1;
+  else
+  {
+    switch (signed_type)
+    {
+      case SIGN:
+        if (a->next->type != TYPEMULTIPART ||
+            ascii_strcasecmp (a->next->subtype, "mixed"))
+          inconsistent = 1;
+        break;
+      case PGPSIGN:
+        if (a->next->type != TYPEAPPLICATION ||
+            ascii_strcasecmp (a->next->subtype, "pgp-signature"))
+          inconsistent = 1;
+        break;
+      case SMIMESIGN:
+        if (a->next->type != TYPEAPPLICATION ||
+            (ascii_strcasecmp (a->next->subtype, "x-pkcs7-signature") &&
+             ascii_strcasecmp (a->next->subtype, "pkcs7-signature")))
+          inconsistent = 1;
+        break;
+      default:
+        inconsistent = 1;
+    }
+  }
+  if (inconsistent)
   {
     state_attach_puts (_("[-- Error: "
                          "Inconsistent multipart/signed structure! --]\n\n"),
@@ -816,27 +830,6 @@ int mutt_signed_handler (BODY *a, STATE 
     return mutt_body_handler (a, s);
   }
 
-  
-  if ((WithCrypto & APPLICATION_PGP)
-      && protocol_major == TYPEAPPLICATION
-      && !ascii_strcasecmp (protocol_minor, "pgp-signature"))
-    ;
-  else if ((WithCrypto & APPLICATION_SMIME)
-           && protocol_major == TYPEAPPLICATION
-	   && !(ascii_strcasecmp (protocol_minor, "x-pkcs7-signature")
-	       && ascii_strcasecmp (protocol_minor, "pkcs7-signature")))
-    ;
-  else if (protocol_major == TYPEMULTIPART
-	   && !ascii_strcasecmp (protocol_minor, "mixed"))
-    ;
-  else
-  {
-    state_printf (s, _("[-- Error: "
-                       "Unknown multipart/signed protocol %s! --]\n\n"),
-                  protocol);
-    return mutt_body_handler (a, s);
-  }
-  
   if (s->flags & M_DISPLAY)
   {
     

File Added: pkgsrc/mail/mutt/patches/Attic/patch-crypt.c
$NetBSD: patch-crypt.c,v 1.1 2016/02/22 12:13:26 wiz Exp $

# HG changeset patch
# User Kevin McCarthy <kevin@8t8.us>
# Date 1449022827 28800
#      Tue Dec 01 18:20:27 2015 -0800
# Node ID 5e5aff1782dc62044197c2230d346bd492706fbf
# Parent  428a92464d5bccccda818bed598610db212fcf7c
Loosen mutt_signed_handler() protocol value consistency check.  (closes #3639)

Apparently, for S/MIME, some MUAs mismatch the protocol value of
the multipart/signed and the content-type of the signature: putting
"pkcs7-signature" in one and "x-pkcs7-signature" in the other.

Change mutt_signed_handler() to independently verify the values of the
protocol and the content-type.  This still checks for correct values but
doesn't ensure they match between the two (for S/MIME).

--- crypt.c.orig	2013-02-06 13:22:15.000000000 +0000
+++ crypt.c
@@ -772,9 +772,8 @@ static void crypt_fetch_signatures (BODY
 int mutt_signed_handler (BODY *a, STATE *s)
 {
   char tempfile[_POSIX_PATH_MAX];
-  char *protocol;
-  int protocol_major = TYPEOTHER;
-  char *protocol_minor = NULL;
+  int signed_type;
+  int inconsistent = 0;
   
   BODY *b = a;
   BODY **signatures = NULL;
@@ -786,29 +785,44 @@ int mutt_signed_handler (BODY *a, STATE 
   if (!WithCrypto)
     return -1;
 
-  protocol = mutt_get_parameter ("protocol", a->parameter);
   a = a->parts;
-
-  /* extract the protocol information */
-  
-  if (protocol)
+  signed_type = mutt_is_multipart_signed (b);
+  if (!signed_type)
   {
-    char major[STRING];
-    char *t;
-
-    if ((protocol_minor = strchr (protocol, '/'))) protocol_minor++;
-    
-    strfcpy (major, protocol, sizeof(major));
-    if((t = strchr(major, '/')))
-      *t = '\0';
-    
-    protocol_major = mutt_check_mime_type (major);
+    /* A null protocol value is already checked for in mutt_body_handler() */
+    state_printf (s, _("[-- Error: "
+                       "Unknown multipart/signed protocol %s! --]\n\n"),
+                  mutt_get_parameter ("protocol", b->parameter));
+    return mutt_body_handler (a, s);
   }
 
-  /* consistency check */
-
-  if (!(a && a->next && a->next->type == protocol_major && 
-      !mutt_strcasecmp (a->next->subtype, protocol_minor)))
+  if (!(a && a->next))
+    inconsistent = 1;
+  else
+  {
+    switch (signed_type)
+    {
+      case SIGN:
+        if (a->next->type != TYPEMULTIPART ||
+            ascii_strcasecmp (a->next->subtype, "mixed"))
+          inconsistent = 1;
+        break;
+      case PGPSIGN:
+        if (a->next->type != TYPEAPPLICATION ||
+            ascii_strcasecmp (a->next->subtype, "pgp-signature"))
+          inconsistent = 1;
+        break;
+      case SMIMESIGN:
+        if (a->next->type != TYPEAPPLICATION ||
+            (ascii_strcasecmp (a->next->subtype, "x-pkcs7-signature") &&
+             ascii_strcasecmp (a->next->subtype, "pkcs7-signature")))
+          inconsistent = 1;
+        break;
+      default:
+        inconsistent = 1;
+    }
+  }
+  if (inconsistent)
   {
     state_attach_puts (_("[-- Error: "
                          "Inconsistent multipart/signed structure! --]\n\n"),
@@ -816,27 +830,6 @@ int mutt_signed_handler (BODY *a, STATE 
     return mutt_body_handler (a, s);
   }
 
-  
-  if ((WithCrypto & APPLICATION_PGP)
-      && protocol_major == TYPEAPPLICATION
-      && !ascii_strcasecmp (protocol_minor, "pgp-signature"))
-    ;
-  else if ((WithCrypto & APPLICATION_SMIME)
-           && protocol_major == TYPEAPPLICATION
-	   && !(ascii_strcasecmp (protocol_minor, "x-pkcs7-signature")
-	       && ascii_strcasecmp (protocol_minor, "pkcs7-signature")))
-    ;
-  else if (protocol_major == TYPEMULTIPART
-	   && !ascii_strcasecmp (protocol_minor, "mixed"))
-    ;
-  else
-  {
-    state_printf (s, _("[-- Error: "
-                       "Unknown multipart/signed protocol %s! --]\n\n"),
-                  protocol);
-    return mutt_body_handler (a, s);
-  }
-  
   if (s->flags & M_DISPLAY)
   {