]> granicus.if.org Git - neomutt/commitdiff
More fiddling with PGP results. When rerunning PGP on a message, clear
authorBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 05:58:18 +0000 (05:58 +0000)
committerBrendan Cully <brendan@kublai.com>
Tue, 2 Aug 2005 05:58:18 +0000 (05:58 +0000)
old security result bits to avoid confusing messages like 'decrypt failed;
PGP signature successfully verified'.

commands.c
pgp.c

index 472796411167c9bc72fc01c125c3fa9c0f909cbd..141512bef3aa209c2434563f7ed851106dc646b8 100644 (file)
@@ -166,6 +166,7 @@ int mutt_display_message (HEADER *cur)
   if (WithCrypto)
   {
     /* update crypto information for this message */
+    cur->security &= ~(GOODSIGN|BADSIGN);
     cur->security |= crypt_query (cur->content);
   
     /* Remove color cache for this message, in case there
diff --git a/pgp.c b/pgp.c
index 895a9e4314e298175af6af8bd1138f6a655eddab..515c3e596152738f52528147e49d8672cf649c27 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -375,7 +375,6 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
  */
            if (rc == -1 || rv) maybe_goodsig = 0;
 
-           state_putc ('\n', s);
            state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
          }
        }
@@ -387,11 +386,7 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
         mutt_error _("Could not decrypt PGP message");
         pgp_void_passphrase ();
 
-       safe_fclose (&tmpfp);
-       mutt_unlink (tmpfname);
-        safe_fclose (&pgpout);
-       mutt_unlink (outfile);
-        return;
+        goto out;
       }
       /*
        * Now, copy cleartext to the screen.  NOTE - we expect that PGP
@@ -440,17 +435,6 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
        else
          state_attach_puts (_("[-- END PGP SIGNED MESSAGE --]\n"), s);
       }
-
-      if (tmpfp)
-      {
-       safe_fclose (&tmpfp);
-       mutt_unlink (tmpfname);
-      }
-      if (pgpout)
-      {
-       safe_fclose (&pgpout);
-       mutt_unlink (outfile);
-      }
     }
     else
     {
@@ -461,8 +445,20 @@ void pgp_application_pgp_handler (BODY *m, STATE *s)
     }
   }
 
+out:
   m->goodsig = (maybe_goodsig && have_any_sigs);
 
+  if (tmpfp)
+  {
+    safe_fclose (&tmpfp);
+    mutt_unlink (tmpfname);
+  }
+  if (pgpout)
+  {
+    safe_fclose (&pgpout);
+    mutt_unlink (outfile);
+  }
+  
   if (needpass == -1)
   {
     state_attach_puts (_("[-- Error: could not find beginning of PGP message! --]\n\n"), s);
@@ -744,6 +740,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p)
   char pgperrfile[_POSIX_PATH_MAX];
   char pgptmpfile[_POSIX_PATH_MAX];
   pid_t thepid;
+  int rv;
   
   mutt_mktemp (pgperrfile);
   if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL)
@@ -799,15 +796,17 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p)
   }
 
   fclose (pgpout);
-  mutt_wait_filter (thepid);
+  rv = mutt_wait_filter (thepid);
   mutt_unlink(pgptmpfile);
   
   if (s->flags & M_DISPLAY)
   {
     fflush (pgperr);
     rewind (pgperr);
-    if (pgp_copy_checksig (pgperr, s->fpout) == 0 && p)
+    if (pgp_copy_checksig (pgperr, s->fpout) == 0 && !rv && p)
       p->goodsig = 1;
+    else
+      p->goodsig = 0;
     state_attach_puts (_("[-- End of PGP output --]\n\n"), s);
   }
   fclose (pgperr);