Bug #8228: Fix MIME parsing of PGP message.
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 19 May 2009 14:09:11 +0000 (08:09 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 19 May 2009 14:09:11 +0000 (08:09 -0600)
imp/lib/Mime/Viewer/Pgp.php

index 29aa124..5da2bbf 100644 (file)
@@ -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;