From: dato@net.com.org.es (Adeodato Simó)
Subject: [sup-talk] [PATCH] Fix parsing of encrypted messages that contain further multipart elements
Date: Thu, 23 Jul 2009 19:19:51 +0200 [thread overview]
Message-ID: <6fd87965a2e243b190678edb6c4b9cefbde9ae66.1248369563.git.dato@net.com.org.es> (raw)
In-Reply-To: <ff7df0405d003a8f4e88f0dd191d8bf4875f73f3.1248368899.git.dato@net.com.org.es>
---
Amended patch follows, with a better wording that I had seemingly not
committed. Sorry for the noise.
lib/sup/crypto.rb | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
index 8ec277b..acbc1d8 100644
--- a/lib/sup/crypto.rb
+++ b/lib/sup/crypto.rb
@@ -132,8 +132,26 @@ class CryptoManager
end
end
+ # This is gross. This decrypted payload could very well be a multipart
+ # element itself, as opposed to a simple payload. For example, a
+ # multipart/signed element, like those generated by Mutt when encrypting
+ # and signing a message (instead of just clearsigning the body).
+ # Supposedly, decrypted_payload being a multipart element ought to work
+ # out nicely because Message::multipart_encrypted_to_chunks() runs the
+ # decrypted message through message_to_chunks() again to get any
+ # children. However, it does not work as intended because these inner
+ # payloads need not carry a MIME-Version header, yet they are fed to
+ # RMail as a top-level message, for which the MIME-Version header is
+ # required. This causes for the part not to be detected as multipart,
+ # hence being shown as an attachment. If we detect this is happening,
+ # we force the decrypted payload to be interpreted as MIME.
+ msg = RMail::Parser.read(decrypted_payload)
+ if msg.header.content_type =~ %r{^multipart/} and not msg.multipart?
+ decrypted_payload = "MIME-Version: 1.0\n" + decrypted_payload
+ msg = RMail::Parser.read(decrypted_payload)
+ end
notice = Chunk::CryptoNotice.new :valid, "This message has been decrypted for display"
- [RMail::Parser.read(decrypted_payload), sig, notice]
+ [msg, sig, notice]
else
notice = Chunk::CryptoNotice.new :invalid, "This message could not be decrypted", output.split("\n")
[nil, nil, notice]
--
1.6.3.3
next prev parent reply other threads:[~2009-07-23 17:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-23 17:12 [sup-talk] [RFC] " Adeodato Simó
2009-07-23 17:19 ` Adeodato Simó [this message]
2009-09-12 17:08 ` [sup-talk] [PATCH] " William Morgan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6fd87965a2e243b190678edb6c4b9cefbde9ae66.1248369563.git.dato@net.com.org.es \
--to=dato@net.com.org.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox