]> granicus.if.org Git - neomutt/commitdiff
contrib/smime.rc: $smime_verify_opaque_command fallback to -noverify
authorAlain Bench <veronatif@free.fr>
Mon, 30 Apr 2007 02:10:20 +0000 (19:10 -0700)
committerAlain Bench <veronatif@free.fr>
Mon, 30 Apr 2007 02:10:20 +0000 (19:10 -0700)
to get signed text despite a failed -verify (but send only this first
failure notice to stderr).
smime.c: fflush() before rewind().
Closes #2428. Helps Debian Bug 420014

contrib/smime.rc
smime.c

index 635496b8c1b7768109a50b8b4a4be7b2bac06279..53760899bbf71100676828912728fd025cfb4ca1 100644 (file)
@@ -79,7 +79,9 @@ set smime_decrypt_command="openssl smime -decrypt  -passin stdin -inform DER -in
 set smime_verify_command="openssl smime -verify -inform DER -in %s %C -content %f"
 
 # Verify a signature of type application/x-pkcs7-mime
-set smime_verify_opaque_command="openssl smime -verify -inform DER -in %s %C"
+set smime_verify_opaque_command="\
+openssl smime -verify -inform DER -in %s %C || \
+openssl smime -verify -inform DER -in %s -noverify 2>/dev/null"
 
 
 
diff --git a/smime.c b/smime.c
index 77f7fd824f3e613ac5df1d775e473164fb1e8855..437b62fb8ba0a4e69eeb5cba7049c034203f5959 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -859,8 +859,8 @@ static int smime_handle_cert_email (char *certificate, char *mailbox,
 
   fflush (fpout);
   rewind (fpout);
-  rewind (fperr);
   fflush (fperr);
+  rewind (fperr);
 
 
   while ((fgets (email, sizeof (email), fpout)))
@@ -954,8 +954,8 @@ static char *smime_extract_certificate (char *infile)
 
   fflush (fpout);
   rewind (fpout);
-  rewind (fperr);
   fflush (fperr);
+  rewind (fperr);
   empty = (fgetc (fpout) == EOF);
   if (empty)
   {
@@ -1000,8 +1000,8 @@ static char *smime_extract_certificate (char *infile)
 
   fflush (fpout);
   rewind (fpout);
-  rewind (fperr);
   fflush (fperr);
+  rewind (fperr);
   empty =  (fgetc (fpout) == EOF);
   if (empty)
   {
@@ -1063,8 +1063,8 @@ static char *smime_extract_signer_certificate (char *infile)
 
   fflush (fpout);
   rewind (fpout);
-  rewind (fperr);
   fflush (fperr);
+  rewind (fperr);
   empty =  (fgetc (fpout) == EOF);
   if (empty)
   {
@@ -1750,6 +1750,7 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile)
 
   if (s->flags & M_DISPLAY)
   {
+    fflush (smimeerr);
     rewind (smimeerr);
     
     if ((c = fgetc (smimeerr)) != EOF)