aboutsummaryrefslogblamecommitdiff
path: root/mail/mutt-devel/files/patch-pgp
blob: b7d0f36bf4996a8f6a5c620a3a86e74e5e776bf3 (plain) (tree)





































































































































                                                                                     
--- crypt-gpgme.c~	2010-09-10 07:41:33.584316201 +1000
+++ crypt-gpgme.c	2010-09-10 08:22:32.948976728 +1000
@@ -2003,12 +2003,14 @@
   {
     if (!mutt_strncmp ("-----BEGIN PGP ", buf, 15))
     {
-      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+      if (!mutt_strcmp ("MESSAGE-----\n", buf + 15) ||
+	  !mutt_strcmp ("MESSAGE-----\r\n", buf + 15))
       {
 	enc = 1;
 	break;
       }
-      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+      else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) ||
+	       !mutt_strcmp ("SIGNED MESSAGE-----\r\n", buf + 15))
       {
 	sgn = 1;
 	break;
@@ -2128,7 +2130,8 @@
       continue;
     }
 
-    if (!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n"))
+    if (!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") ||
+	!mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\r\n"))
       break;
     
     if (armor_header)
@@ -2196,14 +2199,17 @@
           clearsign = 0;
           start_pos = last_pos;
           
-          if (!mutt_strcmp ("MESSAGE-----\n", buf + 15))
+          if (!mutt_strcmp ("MESSAGE-----\n", buf + 15) ||
+	      !mutt_strcmp ("MESSAGE-----\r\n", buf + 15))
             needpass = 1;
-          else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15))
+          else if (!mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) ||
+		   !mutt_strcmp ("SIGNED MESSAGE-----\r\n", buf + 15))
             {
               clearsign = 1;
               needpass = 0;
             }
-          else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
+          else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) ||
+		   !mutt_strcmp ("PUBLIC KEY BLOCK-----\r\n", buf + 15))
           {
             needpass = 0;
             pgp_keyblock = 1;
--- pgp.c~	2009-05-31 03:20:08.000000000 +1000
+++ pgp.c	2010-09-10 08:27:40.317064142 +1000
@@ -219,7 +219,8 @@
       continue;
     }
 
-    if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
+    if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0 ||
+	mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\r\n") == 0)
       break;
     
     if (armor_header)
@@ -287,14 +288,17 @@
       clearsign = 0;
       start_pos = last_pos;
 
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0 ||
+	  mutt_strcmp ("MESSAGE-----\r\n", buf + 15) == 0)
         needpass = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0 ||
+	       mutt_strcmp ("SIGNED MESSAGE-----\r\n", buf + 15) == 0)
       {
 	clearsign = 1;
         needpass = 0;
       }
-      else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
+      else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) ||
+	       !mutt_strcmp ("PUBLIC KEY BLOCK-----\r\n", buf + 15))
       {
         needpass = 0;
         pgp_keyblock = 1;
@@ -327,10 +331,14 @@
 	
 	fputs (buf, tmpfp);
 
-	if ((needpass && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
-	    (!needpass 
-             && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
-                 || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
+	if ((needpass &&
+	     (mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0 ||
+	      mutt_strcmp ("-----END PGP MESSAGE-----\r\n", buf) == 0)) ||
+	    (!needpass &&
+	     (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0 ||
+	      mutt_strcmp ("-----END PGP SIGNATURE-----\r\n", buf) == 0 ||
+	      mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0 ||
+	      mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\r\n",buf) == 0)))
 	  break;
 	/* remember optional Charset: armor header as defined by RfC4880 */
 	if (mutt_strncmp ("Charset: ", buf, 9) == 0)
@@ -554,11 +562,14 @@
   {
     if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
     {
-      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
+      if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0 ||
+	  mutt_strcmp ("MESSAGE-----\r\n", buf + 15) == 0)
 	enc = 1;
-      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
+      else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0 ||
+	       mutt_strcmp ("SIGNED MESSAGE-----\r\n", buf + 15) == 0)
 	sgn = 1;
-      else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
+      else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0 ||
+	       mutt_strcmp ("PUBLIC KEY BLOCK-----\r\n", buf + 15) == 0)
 	key = 1;
     }
   }
@@ -1067,9 +1078,11 @@
    */
   while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL)
   {
-    if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
+    if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0 ||
+	mutt_strcmp ("-----BEGIN PGP MESSAGE-----\r\n", buffer) == 0)
       fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
-    else if (mutt_strcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
+    else if (mutt_strcmp("-----END PGP MESSAGE-----\n", buffer) == 0 ||
+	     mutt_strcmp("-----END PGP MESSAGE-----\r\n", buffer) == 0)
       fputs ("-----END PGP SIGNATURE-----\n", fp);
     else
       fputs (buffer, fp);