summaryrefslogtreecommitdiffstats
path: root/mail/mutt/files/patch-pgp
blob: b7d0f36bf4996a8f6a5c620a3a86e74e5e776bf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
--- 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);
OpenPOWER on IntegriCloud