From 178c356fc3b330e92bb582fee75dfd345339c267 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 19 Dec 2013 23:13:43 -0200 Subject: Only try to fetch keys for multipart signed or encrypted messages when fetching mail (#4671). --- ...ture_4671_only-try-to-fetch-keys-for-multipart-signed-or-encrypted | 1 + mail/src/leap/mail/imap/fetch.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 mail/changes/feature_4671_only-try-to-fetch-keys-for-multipart-signed-or-encrypted diff --git a/mail/changes/feature_4671_only-try-to-fetch-keys-for-multipart-signed-or-encrypted b/mail/changes/feature_4671_only-try-to-fetch-keys-for-multipart-signed-or-encrypted new file mode 100644 index 0000000..de3bb86 --- /dev/null +++ b/mail/changes/feature_4671_only-try-to-fetch-keys-for-multipart-signed-or-encrypted @@ -0,0 +1 @@ + o Only try to fetch keys for multipart signed or encrypted emails (#4671). diff --git a/mail/src/leap/mail/imap/fetch.py b/mail/src/leap/mail/imap/fetch.py index f69681a..b1c34ba 100644 --- a/mail/src/leap/mail/imap/fetch.py +++ b/mail/src/leap/mail/imap/fetch.py @@ -389,7 +389,9 @@ class LeapIncomingMail(object): # try to obtain sender public key senderPubkey = None fromHeader = msg.get('from', None) - if fromHeader is not None: + if fromHeader is not None \ + and (msg.get_content_type() == 'multipart/encrypted' \ + or msg.get_content_type() == 'multipart/signed'): _, senderAddress = parseaddr(fromHeader) try: senderPubkey = self._keymanager.get_key_from_cache( -- cgit v1.2.3