Skip to content

Commit

Permalink
Invalidate the IMAP object if the password cannot be recreated from s…
Browse files Browse the repository at this point in the history
…ession data
  • Loading branch information
slusarz committed Dec 15, 2014
1 parent ef4a59e commit 56c03a6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion imp/lib/Imap/Password.php
Expand Up @@ -77,11 +77,23 @@ public function serialize()
}

/**
* @throws RuntimeException
*/
public function unserialize($data)
{
$this->_id = $data;
$this->_password = $GLOBALS['session']->get('imp', self::PASSWORD_KEY . '/' . $this->_id);

$password = $GLOBALS['session']->get(
'imp',
self::PASSWORD_KEY . '/' . $this->_id
);
if (!strlen($password)) {
/* Without a password, this object is invalid. */
throw new RuntimeException(
'Invalid object since password is empty.'
);
}
$this->_password = $password;
}

}

0 comments on commit 56c03a6

Please sign in to comment.