]> granicus.if.org Git - mutt/commitdiff
A belated fix for #1808 (Debian #233106): Make sure
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 12 Apr 2004 20:33:33 +0000 (20:33 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 12 Apr 2004 20:33:33 +0000 (20:33 +0000)
check-traditional-pgp doesn't leave the pager context unnecessarily.
This makes message-hooks like this one safe:

  message-hook '!(~g|~G) ~b"^-----BEGIN\ PGP\ (SIGNED\ )?MESSAGE"' \
   "exec check-traditional-pgp"

commands.c
curs_main.c
mutt.h
mutt_crypt.h
pager.c
recvattach.c

index a4859aebcec86e54253fa0f0c288e69025c6f0d6..2f2b3b9c439024b164fe6719458a486644f8e514 100644 (file)
@@ -941,6 +941,8 @@ static int _mutt_check_traditional_pgp (HEADER *h, int *redraw)
   MESSAGE *msg;
   int rv = 0;
   
+  h->security |= PGP_TRADITIONAL_CHECKED;
+  
   mutt_parse_mime_message (Context, h);
   if ((msg = mx_open_message (Context, h->msgno)) == NULL)
     return 0;
@@ -959,12 +961,12 @@ int mutt_check_traditional_pgp (HEADER *h, int *redraw)
 {
   int i;
   int rv = 0;
-  if (h)
+  if (h && !(h->security & PGP_TRADITIONAL_CHECKED))
     rv = _mutt_check_traditional_pgp (h, redraw);
   else
   {
     for (i = 0; i < Context->vcount; i++)
-      if (Context->hdrs[Context->v2r[i]]->tagged)
+      if (Context->hdrs[Context->v2r[i]]->tagged && !(h->security & PGP_TRADITIONAL_CHECKED))
        rv = _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw)
          || rv;
   }
index 1c200969291b1348901c85e43b0fbafc9e994ef9..9695a2eacb663b24f73ce6678c613fb54ee55d1a 100644 (file)
@@ -1876,7 +1876,9 @@ CHECK_IMAP_ACL(IMAP_ACL_INSERT);
           break;
         CHECK_MSGCOUNT; 
         CHECK_VISIBLE;
-        mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
+        if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED)) 
+         mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
+      
         if (menu->menu == MENU_PAGER)
         {
          op = OP_DISPLAY_MESSAGE;
diff --git a/mutt.h b/mutt.h
index d477ea26ecc403b3643b7e7b9c45988b2e90e99a..05cc0316079cdc87d879d07cb7ac757feaf70d5e 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -641,7 +641,7 @@ typedef struct body
 
 typedef struct header
 {
-  unsigned int security : 9;  /* bit 0-6: flags, bit 7,8: application.
+  unsigned int security : 10;  /* bit 0-6: flags, bit 7,8: application.
                                 see: crypt.h pgplib.h, smime.h */
 
   unsigned int mime : 1;               /* has a Mime-Version header? */
index bd3c8c5e5db37d5baff904fe06eb183f60001a5c..0ddbc28cb2659944f2d802734c721f581db130a0 100644 (file)
@@ -41,6 +41,8 @@
 #define APPLICATION_PGP    (1 << 7) 
 #define APPLICATION_SMIME  (1 << 8)
 
+#define PGP_TRADITIONAL_CHECKED (1 << 9)
+
 #define PGPENCRYPT  (APPLICATION_PGP | ENCRYPT)
 #define PGPSIGN     (APPLICATION_PGP | SIGN)
 #define PGPGOODSIGN (APPLICATION_PGP | GOODSIGN)
diff --git a/pager.c b/pager.c
index 0c2d9626c1676d8a15040c9070a1942feab03737..5345795845d6d12f96d91f0889a3eb2289d732c3 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -2173,6 +2173,17 @@ search_next:
          mutt_resend_message (NULL, extra->ctx, extra->hdr);
         redraw = REDRAW_FULL;
         break;
+
+      case OP_CHECK_TRADITIONAL:
+        CHECK_MODE (IsHeader (extra));
+        if (!(WithCrypto & APPLICATION_PGP))
+         break;
+        if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED)) 
+        {
+         ch = -1;
+         rc = OP_CHECK_TRADITIONAL;
+       }
+        break;
       
       case OP_CREATE_ALIAS:
        CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
index aa1ce2740e2eee5881d1f473dcc39404a8057239..89ae956acdaf255f1c00dfd30c07de4e1cd23645 100644 (file)
@@ -816,7 +816,7 @@ mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, HEADER *hdr,
        break;
       /* functions which are passed through from the pager */
       case OP_CHECK_TRADITIONAL:
-        if (!(WithCrypto & APPLICATION_PGP))
+        if (!(WithCrypto & APPLICATION_PGP) || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED))
         {
           op = OP_NULL;
           break;