diff options
author | Kali Kaneko <kali@leap.se> | 2014-02-11 03:04:04 -0400 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2014-02-17 11:39:49 -0400 |
commit | 484c5fc316c0f95ebccc4a2c2a04c1cda96a34f8 (patch) | |
tree | 1828e3f5d2444c14704d14d0e61d6138adce82d7 /src/leap | |
parent | fd9c8c2e3c88476b90805b689f6914fe5eac16df (diff) |
defend against malformed fdocs during unset dirty/new
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/mail/imap/messageparts.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/leap/mail/imap/messageparts.py b/src/leap/mail/imap/messageparts.py index 9b7de86..6f1376a 100644 --- a/src/leap/mail/imap/messageparts.py +++ b/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): |