]> granicus.if.org Git - mutt/commitdiff
Some S/MIME fixes from Oliver Ehli <elmy@acm.org>.
authorThomas Roessler <roessler@does-not-exist.org>
Mon, 4 Feb 2002 09:59:00 +0000 (09:59 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Mon, 4 Feb 2002 09:59:00 +0000 (09:59 +0000)
crypt.c
smime.c

diff --git a/crypt.c b/crypt.c
index 95122b6ea043bd85126418682de52b153eb48e71..ce5467f1e8f9eb89d3dcb09b5902c8508f3c1842 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -521,7 +521,7 @@ void crypt_extract_keys_from_messages (HEADER * h)
           mbox = tmp ? tmp->mailbox : NULL;
          if (mbox)
          {
-           mutt_message (_("Trying to extract S/MIME certificates...\n"));
+           mutt_endwin (_("Trying to extract S/MIME certificates...\n"));
            smime_invoke_import (tempfname, mbox);
            tmp = NULL;
          }
diff --git a/smime.c b/smime.c
index 2dfbaabb1bcdbe2781f657e339d144c3320213be..e1c163ba1a7812a622e05d97341c094a3a5753eb 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -861,7 +861,7 @@ static int smime_check_cert_email (char *certificate, char *mailbox)
   FILE *fpout = NULL, *fperr = NULL;
   char tmpfname[_POSIX_PATH_MAX];
   char email[STRING];
-  int ret = 0;
+  int ret = -1;
   pid_t thepid;
 
   mutt_mktemp (tmpfname);
@@ -900,19 +900,24 @@ static int smime_check_cert_email (char *certificate, char *mailbox)
   fflush (fperr);
 
 
-  if (!(fgets (email, sizeof (email), fpout)))
+  while ((fgets (email, sizeof (email), fpout)))
+  {
+    *(email+mutt_strlen(email)-1) = '\0';
+    if(mutt_strncasecmp (email, mailbox, mutt_strlen (mailbox))==0)
+    {
+      ret = 0;
+      break;
+    }
+    ret = 1;
+  }
+  if (ret == -1)
   {
     mutt_copy_stream (fperr, stdout);
-    fclose (fpout);
-    fclose (fperr);
     mutt_endwin(NULL);
     mutt_error (_("Alert: No mailbox specified in certificate.\n"));
-    return 1;
+    ret = 1;
   }
-  *(email+mutt_strlen(email)-1) = '\0';
-
-
-  if(mutt_strncasecmp (email, mailbox, mutt_strlen (mailbox)))
+  else if (ret == 1)
   {
     mutt_endwin(NULL);
     mutt_error (_("Alert: Certificate belongs to \"%s\".\n"
@@ -1087,7 +1092,9 @@ static char *smime_extract_signer_certificate (char *infile)
   empty =  (fgetc (fpout) == EOF);
   if (empty)
   {
+    mutt_endwin (NULL);
     mutt_copy_stream (fperr, stdout);
+    mutt_any_key_to_continue (NULL);
     fclose (fpout);
     fclose (fperr);
     mutt_unlink (certfile);
@@ -1131,7 +1138,7 @@ static void smime_add_certificate (char *certificate, char *mailbox, short publi
 
   /* 
      OpenSSl can create a hash value of the certificate's subject.
-     This and a concatenated integer make up the certificat's
+     This and a concatenated integer make up the certificate's
      'unique id' and also its filename.
   */
 
@@ -1875,14 +1882,14 @@ static BODY *smime_handle_entity (BODY *m, STATE *s, FILE *outFile)
 
   mutt_unlink (tmpfname);
   
+
   if (s->flags & M_DISPLAY)
+  {
+    rewind (smimeerr);
     mutt_copy_stream (smimeerr, s->fpout);
-  
-  if (s->flags & M_DISPLAY)
+
     state_attach_puts (_("\n[-- End of OpenSSL output --]\n\n"), s);
   
-  if (s->flags & M_DISPLAY)
-  {
     if (type & ENCRYPT)
       state_attach_puts (_("\n[-- The following data is S/MIME"
                            " encrypted --]\n"), s);