[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:16291] [PATCH] Message text canonicalization fix
From:       Sergey Vlasov <vsu () altlinux ! ru>
Date:       2002-09-28 11:52:24
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hello!

While trying to get PGP/MIME signatures working between Sylpheed and
Evolution, I noticed a problem: a signed message with 8-bit characters
sent by a recent Sylpheed version (where base64 encoding for such
messages is forced) shows up with bad signature in Evolution 1.0.3.

Looking at the message contents, I noticed that the message text
(encoded in base64) did not have the proper canonical line endings - it
had only \n. Seems that Evolution is confused by this, and anyway it
does not conform to the RFC2045.

I have added some code to compose.c to convert the message text line
endings to the proper CRLF form before (possibly) encoding in with
base64. Now Evolution 1.0.3 can verify the signature made by Sylpheed
(at least in some cases - looks like it has too many bugs in this area).

-- 
Sergey Vlasov
["sylpheed-0.8.3cvs8-canon.patch" (application/octet-stream)]

--- sylpheed/src/compose.c.canon	Fri Sep 27 19:07:30 2002
+++ sylpheed/src/compose.c	Fri Sep 27 20:50:50 2002
@@ -2493,6 +2493,34 @@
 	}
 	g_free(chars);
 
+	/* Canonicalize line endings in the message text */
+	{
+		gchar *canon_buf, *out;
+		const gchar *p;
+		guint new_len = 0;
+
+		for (p = buf ; *p; ++p) {
+			if (*p != '\r') {
+				++new_len;
+				if (*p == '\n')
+					++new_len;
+			}
+		}
+
+		out = canon_buf = g_new(gchar, new_len + 1);
+		for (p = buf; *p; ++p) {
+			if (*p != '\r') {
+				if (*p == '\n')
+					*out++ = '\r';
+				*out++ = *p;
+			}
+		}
+		*out = '\0';
+
+		free(buf);
+		buf = canon_buf;
+	}
+
 #if USE_GPGME
 	if (!is_draft && compose->use_signing && compose->account->clearsign) {
 		if (compose_clearsign_text(compose, &buf) < 0) {

[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic