After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674032 - application/x-pkcs7-signature not handled correctly
application/x-pkcs7-signature not handled correctly
Status: RESOLVED FIXED
Product: gmime
Classification: Other
Component: general
2.6.x
Other Linux
: Normal major
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2012-04-13 06:07 UTC by Eric Craven
Modified: 2012-08-05 17:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
674032.patch (1.69 KB, patch)
2012-04-22 12:27 UTC, Jeffrey Stedfast
none Details | Review

Description Eric Craven 2012-04-13 06:07:24 UTC
In method pkcs7_get_signature_protocol in gmime-pkcs7-context.c (line 249), only application/pkcs7-signature is mentioned. These two content types should be treated identically (See RFC 2311, appendix C.1). Many MUAs actually use application/x-pkcs7-signature instead of (the better suited) application/pkcs7-signature.
If there is any way to work around this bug client-side, please inform us :)
Comment 1 Jeffrey Stedfast 2012-04-22 12:12:56 UTC
Just to confirm:

is the protocol value in the multipart/signed part's Content-Type header application/x-pkcs7-signature?

And the Content-Type of the signature part is also application/x-pkcs7-signature?


I suspect that both are the same, but I just want to confirm that they match.
Comment 2 Jeffrey Stedfast 2012-04-22 12:27:31 UTC
Created attachment 212536 [details] [review]
674032.patch

This patch should fix it. Can you verify?
Comment 3 Dan Bryant 2012-07-09 17:49:27 UTC
This patch does not fix the issue for me.

This appears to be due to at least a typo: the variable "supported" is compared with protocol twice, when the second call should compare to "xsupported".

For the mail in my corpus, both the content-type of the signature part and multipart/signed protocol have the "x-" prefix.

I'm currently working around this with the following preprocessing callback passed to g_mime_message_foreach():

void
smime_fix_part(GMimeObject *parent, GMimeObject *part, gpointer user_data) {

    GMimeContentType *content_type = g_mime_object_get_content_type (part);

    const char *subtype = g_mime_content_type_get_media_subtype (content_type);
    const char *protocol = g_mime_content_type_get_parameter (content_type, "protocol");

    if (!strcmp(subtype, "x-pkcs7-signature")) {
	g_mime_content_type_set_media_subtype (content_type, "pkcs7-signature");
    }

    if (protocol && !strcmp(protocol, "application/x-pkcs7-signature")) {
	g_mime_content_type_set_parameter (content_type, "protocol","application/pkcs7-signature");
    }    

}
Comment 4 Jeffrey Stedfast 2012-08-05 17:14:21 UTC
fixed in git master by comparing against xsupported