From: Michael M Slusarz Date: Tue, 19 May 2009 14:09:11 +0000 (-0600) Subject: Bug #8228: Fix MIME parsing of PGP message. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=6fc25df732187c4baf10dd95016f66a5b54fd4b1;p=horde.git Bug #8228: Fix MIME parsing of PGP message. --- diff --git a/imp/lib/Mime/Viewer/Pgp.php b/imp/lib/Mime/Viewer/Pgp.php index 29aa124da..5da2bbfab 100644 --- a/imp/lib/Mime/Viewer/Pgp.php +++ b/imp/lib/Mime/Viewer/Pgp.php @@ -337,16 +337,21 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver if ($GLOBALS['prefs']->getValue('pgp_verify') || Util::getFormData('pgp_verify_msg')) { - $signed_data = $GLOBALS['imp_imap']->ob->utils->removeBareNewlines($this->_params['contents']->getBodyPart($signed_id, array('mimeheaders' => true))); + $graphicsdir = $GLOBALS['registry']->getImageDir('horde'); $sig_part = $this->_params['contents']->getMIMEPart($sig_id); - /* Check for 'x-imp-pgp-signature' type. This is set by the - * 'plain' driver when parsing PGP armor text. */ - $graphicsdir = $GLOBALS['registry']->getImageDir('horde'); try { - $sig_result = ($sig_part->getType() == 'x-imp-pgp-signature') - ? $this->_imppgp->verifySignature($signed_data, $this->_address) - : $this->_imppgp->verifySignature($signed_data, $this->_address, $sig_part->getContents()); + /* Check for 'x-imp-pgp-signature' type. This is set by the + * 'plain' driver when parsing PGP armor text. */ + switch ($sig_part->getType()) { + case 'application/x-imp-pgp-signature': + $sig_result = $this->_imppgp->verifySignature($GLOBALS['imp_imap']->ob->utils->removeBareNewlines($sig_part->getContents()), $this->_address); + break; + + default: + $sig_result = $this->_imppgp->verifySignature($GLOBALS['imp_imap']->ob->utils->removeBareNewlines($this->_params['contents']->getBodyPart($signed_id, array('mimeheaders' => true))), $this->_address, $sig_part->getContents()); + break; + } $icon = Horde::img('alerts/success.png', _("Success"), null, $graphicsdir); $sig_text = $sig_result->message;