Re: [Patch] fix broken decryption of s/mime messages loaded from imap

Albrecht Dreß <[email protected]>
Newsgroups gmane.comp.gnome.apps.balsa
Message-ID <[email protected]>
Am 08.02.19 18:52 schrieb(en) Albrecht Dreß:
> After digging through the code, I /think/ the problem is in libbalsa_mailbox_imap_fetch_structure() which loads only text/* and short messages completely (to be honest, I don't understand why multipart/* is working, though…).  At least, the attached trivial patch, just loading single-part S/MIME messages just as text/*, solves the issue for me.

Thinking again about this issue, I guess this approach is not completely correct.  If all multipart/* messages are handled at some other place (are they?), shouldn't *all* other top-level content types be loaded here?  The vast majority will (explicitly or implicitly) be text/*, and application/pkcs7-mime is already somewhat special.  But a message containing only a, say image/* or application/pdf as the only payload is absolutely legal (although I saw the latter with malspam attacks only…).

Thus, the more appropriate approach would be

--8<--------------------------------------------------------------------------------------
diff --git a/libbalsa/mailbox_imap.c b/libbalsa/mailbox_imap.c
index d85e377c1..2ba010b43 100644
--- a/libbalsa/mailbox_imap.c
+++ b/libbalsa/mailbox_imap.c
@@ -2247,7 +2247,7 @@ libbalsa_mailbox_imap_fetch_structure(LibBalsaMailbox *mailbox,
         LIBBALSA_MESSAGE_GET_LENGTH(message)<8192 ||
         (message->headers &&
          (!message->headers->content_type ||
-         g_mime_content_type_is_type(message->headers->content_type, "text", "*"))) ){
+         !g_mime_content_type_is_type(message->headers->content_type, "multipart", "*")))) {
          /* we could optimize this part a little bit: we do not need to
           * keep reopening the stream. */
          GMimeStream *stream =
--8<--------------------------------------------------------------------------------------

wouldn't it?

Cheers,
Albrecht.

_______________________________________________
balsa-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/balsa-list
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCgAdFiEEcCEPemLFTtyGf4zATKlvDmfn2fgFAlxev4IACgkQTKlvDmfn
2fgJNAf/bDzJNm9BVzcc8x7Oq39l+bV1oPbY6KKx3H0Iuiak1ky/fjxZFu9B2non
pqu2cScUpsvzIApc4lEon7/BvgnyNVmrMOeEjop4vuNOA+xuINzKlnPpByc4CYBP
XMkRzwVdgaX/5OpVJVmQ79SxaGJZpqkFi4VV6rx3EIDyA6bLG9jJbtRpHwCrEAAH
o8gFBP6M8LrOrz+kGhj49ba70mWGV949Nd3xsEaP0ifGPe91xr1Lsyz/kOeQ2g8y
AUqaxhHKdZr424v5YBPqWuuan6NFBvW03inmRzMBQvBlohHhHA2WciJQ71uns9S0
U1SzJ/sOnTmVqV69vYRkwfBRqfGGWg==
=0yRp
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.