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

List:       sylpheed
Subject:    [sylpheed:22793] Patch for application/mixed GPG signatures
From:       Michael Schwendt <fedora () wir-sind-cool ! org>
Date:       2004-04-27 15:18:17
Message-ID: 20040427171817.35ad4256.fedora () wir-sind-cool ! org
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi everyone!

Over time I've encountered several PGP/GPG detached signatures which
Sylpheed was unable to recognize. In particular signatures which are
stored as an attachment in application/mixed MIME encoded messages,
(e.g. messages created by KMail).

I've patched Sylpheed 0.9.10 to make it recognize and verify these
signatures, too. Attached is the revision of the patch which I've been
using for some time without problems.

Regards,
Michael

-- 
Fedora Core release 1 (Yarrow) - Linux 2.4.22-1.2188.nptl


["sylpheed-0.9.10-signed.patch" (application/octet-stream)]

diff -Nur sylpheed-0.9.10-orig/src/rfc2015.c sylpheed-0.9.10/src/rfc2015.c
--- sylpheed-0.9.10-orig/src/rfc2015.c	2003-09-23 09:31:25.000000000 +0200
+++ sylpheed-0.9.10/src/rfc2015.c	2004-04-15 03:08:59.000000000 +0200
@@ -288,6 +288,10 @@
 	goto leave;
     }
 
+    if ( !g_strcasecmp(mimeinfo->content_type, "multipart/mixed") &&
+	 mimeinfo->children )
+        mimeinfo = mimeinfo->children;
+
     /* don't include the last empty line.
        It does not belong to the signed text */
     if (mimeinfo->children->size > 0) {
@@ -466,14 +470,26 @@
 
     if (!mimeinfo)
         return NULL;
-    if (g_strcasecmp (mimeinfo->content_type, "multipart/signed"))
+    if ( !g_strcasecmp (mimeinfo->content_type, "multipart/signed") ) {
+        debug_print ("** multipart/signed encountered\n");
+        partinfo = mimeinfo->children;
+    }
+    else if ( !g_strcasecmp (mimeinfo->content_type, "multipart/mixed") ) {
+        debug_print ("** multipart/mixed encountered\n");
+        for (partinfo = mimeinfo->children;
+        partinfo != NULL; partinfo = partinfo->next) {
+            if ( !g_strcasecmp(partinfo->content_type, "multipart/signed") ) {
+                debug_print ("** multipart/signed encountered\n");
+                partinfo = partinfo->children;
+                break;
+            }
+        }
+    }
+    else
         return NULL;
 
-    debug_print ("** multipart/signed encountered\n");
-
     /* check that we have at least 2 parts of the correct type */
-    for (partinfo = mimeinfo->children;
-         partinfo != NULL; partinfo = partinfo->next) {
+    for ( ; partinfo != NULL; partinfo = partinfo->next) {
         if (++n > 1  && !g_strcasecmp (partinfo->content_type,
 				       "application/pgp-signature"))
             break;

[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