summaryrefslogtreecommitdiff
path: root/mail/src/leap
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-02-11 03:04:04 -0400
committerKali Kaneko <kali@leap.se>2014-02-17 11:39:49 -0400
commit7cb9307ff6b45fda8979c91e803e393b135f33fb (patch)
tree3052665231315c39fb49b57721c728d8b1a434da /mail/src/leap
parentc36c3f2a58f5e6440e5b79f0265398048c7b8425 (diff)
defend against malformed fdocs during unset dirty/new
Diffstat (limited to 'mail/src/leap')
-rw-r--r--mail/src/leap/mail/imap/messageparts.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/mail/src/leap/mail/imap/messageparts.py b/mail/src/leap/mail/imap/messageparts.py
index 9b7de86..6f1376a 100644
--- a/mail/src/leap/mail/imap/messageparts.py
+++ b/mail/src/leap/mail/imap/messageparts.py
@@ -158,8 +158,11 @@ class MessageWrapper(object):
"""
self._new = value
if self.memstore:
- mbox = self.fdoc.content['mbox']
- uid = self.fdoc.content['uid']
+ mbox = self.fdoc.content.get('mbox', None)
+ uid = self.fdoc.content.get('uid', None)
+ if not mbox or not uid:
+ logger.warning("Malformed fdoc")
+ return
key = mbox, uid
fun = [self.memstore.unset_new_queued,
self.memstore.set_new_queued][int(value)]
@@ -190,8 +193,11 @@ class MessageWrapper(object):
"""
self._dirty = value
if self.memstore:
- mbox = self.fdoc.content['mbox']
- uid = self.fdoc.content['uid']
+ mbox = self.fdoc.content.get('mbox', None)
+ uid = self.fdoc.content.get('uid', None)
+ if not mbox or not uid:
+ logger.warning("Malformed fdoc")
+ return
key = mbox, uid
fun = [self.memstore.unset_dirty_queued,
self.memstore.set_dirty_queued][int(value)]
@@ -278,6 +284,7 @@ class MessageWrapper(object):
docid_dict[self.FDOC] = self.memstore.get_docid_for_fdoc(
mbox, uid)
except Exception as exc:
+ logger.debug("Error while walking message...")
logger.exception(exc)
if not empty(self.fdoc.content):