commit 8264eb55f786fe918537dc1baa5dc6e38df5d61f
parent 9aeeaa45d2acaeb4a2e7b63ae052b38044a349af
Author: Lars Fischer <fischer@wiwi.uni-siegen.de>
Date: Sat, 28 Dec 2013 15:37:11 +0100
Small fix to "correctly" parse PGP inline signed mails by
(presumingly) GPGMail 1.4.1
Content-Type: application/pgp; format=text; x-action=sign
and inline separators as:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
former version only tried to decrypt body, which in this case obviously
fails.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/sup/message.rb b/lib/sup/message.rb
@@ -498,11 +498,15 @@ private
## application/pgp. this handles that.
##
## TODO: unduplicate code between here and multipart_encrypted_to_chunks
+ ## lf TODO: this only tries to decrypt. it cannot handle inline PGP
notice, sig, decryptedm = CryptoManager.decrypt m.body
if decryptedm # managed to decrypt
children = message_to_chunks decryptedm, true
[notice, sig].compact + children
else
+## try inline pgp signed
+ chunks = inline_gpg_to_chunks m.body, $encoding, (m.charset || $encoding)
+ return chunks if chunks
[notice]
end
else
@@ -579,6 +583,7 @@ private
# -----END PGP SIGNED MESSAGE-----
#
# In some cases, END PGP SIGNED MESSAGE doesn't appear
+ # lf: leaves strange -----BEGIN PGP SIGNATURE----- in that case?
gpg = lines.between(GPG_SIGNED_START, GPG_SIGNED_END)
# between does not check if GPG_END actually exists
# Reference: http://permalink.gmane.org/gmane.mail.sup.devel/641