]> granicus.if.org Git - neomutt/commitdiff
More decryption key detection fixes.
authorThomas Roessler <roessler@does-not-exist.org>
Fri, 25 Jan 2002 00:06:03 +0000 (00:06 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Fri, 25 Jan 2002 00:06:03 +0000 (00:06 +0000)
commands.c
recvattach.c
smime.c
smime.h

index 683bae02164421ce316f4d1314cd8db82503b612..2c8f5df4778aed1dbbdb62f934935bd3c923859a 100644 (file)
@@ -89,27 +89,7 @@ int mutt_display_message (HEADER *cur)
     {
 #ifdef HAVE_SMIME
       if (cur->security & APPLICATION_SMIME)
-      {
-       ADDRESS *t;
-       int found = 0;
-       for (t = cur->env->to; !found && t; t = t->next)
-         if (mutt_addr_is_user (t))
-         {
-           found = 1;
-           smime_getkeys (t->mailbox);
-         }
-       for (t = cur->env->cc; !found && t; t = t->next)
-         if (mutt_addr_is_user (t))
-         {
-           found = 1;
-           smime_getkeys (t->mailbox);
-         }
-       if (!found && (t = mutt_default_from()))
-       {
-         smime_getkeys (t->mailbox);
-         rfc822_free_address (&t);
-       }
-      }
+       smime_getkeys (cur->env);
 #endif
       if(!crypt_valid_passphrase(cur->security))
        return 0;
index 537e09a84ee72c6cd6fb9b2e4efa048d4f92489c..ab6479edee6bb344267a43c04d7dea9acbe640de 100644 (file)
@@ -878,8 +878,8 @@ void mutt_view_attachments (HEADER *hdr)
 #ifdef HAVE_SMIME
     if (hdr->security & APPLICATION_SMIME)
     {
-      if (hdr->env->to)
-         smime_getkeys (hdr->env->to->mailbox);
+      if (hdr->env)
+         smime_getkeys (hdr->env);
 
       if (mutt_is_application_smime(hdr->content))
        secured = ! smime_decrypt_mime (msg->fp, &fp, hdr->content, &cur);
diff --git a/smime.c b/smime.c
index 27ed3665823611b528532168fd16de3d87879d38..9e8aa43c33841b09437b05f0f0eccade972fe736 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -663,7 +663,7 @@ char *smime_get_field_from_db (char *mailbox, char *query, short public, short m
 */
 
 static int SmimeFirstTime = 1;  /* sucks... */
-void smime_getkeys (char *mailbox)
+void _smime_getkeys (char *mailbox)
 {
   char *k = smime_get_field_from_db (mailbox, NULL, 0, 0);     /* XXX - or sohuld we ask? */
   char buf[STRING];
@@ -723,7 +723,29 @@ void smime_getkeys (char *mailbox)
            NONULL (SmimeCertificates), SmimeSignAs);
 }
 
+void smime_getkeys (ENVELOPE *env)
+{
+  ADDRESS *t;
+  int found = 0;
 
+  for (t = env->to; !found && t; t = t->next)
+    if (mutt_addr_is_user (t))
+    {
+      found = 1;
+      smime_getkeys (t->mailbox);
+         }
+  for (t = env->cc; !found && t; t = t->next)
+    if (mutt_addr_is_user (t))
+    {
+      found = 1;
+      smime_getkeys (t->mailbox);
+    }
+  if (!found && (t = mutt_default_from()))
+  {
+    _smime_getkeys (t->mailbox);
+    rfc822_free_address (&t);
+  }
+}
 
 /* This routine attempts to find the keyids of the recipients of a message.
  * It returns NULL if any of the keys can not be found.
diff --git a/smime.h b/smime.h
index 7a6664dc9526040bea7268dceb85baaaf69ce995..49296edd79e39d2921a3bef3d1e0f7076237bf75 100644 (file)
--- a/smime.h
+++ b/smime.h
@@ -78,8 +78,7 @@ char *smime_get_field_from_db (char *, char *, short, short);
 
 char* smime_ask_for_key (char *, char *, short);
 
-void smime_getkeys (char *);
-
+void smime_getkeys (ENVELOPE *);
 
 /* private ? */