Rocco Rutte:
authorpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 24 Jul 2005 15:26:20 +0000 (15:26 +0000)
committerpdmef <pdmef@e385b8ad-14ed-0310-8656-cc95a2468c6d>
Sun, 24 Jul 2005 15:26:20 +0000 (15:26 +0000)
- merge in latest mutt changes

git-svn-id: svn://svn.berlios.de/mutt-ng/trunk@341 e385b8ad-14ed-0310-8656-cc95a2468c6d

ChangeLog.mutt
copy.c
recvattach.c
smime.c

index 876a7cb..022b03d 100644 (file)
@@ -1,3 +1,14 @@
+2005-07-24 14:23:25  Thomas Roessler  <roessler@does-not-exist.org>  (roessler)
+
+       * recvattach.c, smime.c: Fix S/MIME segmentation fault.  Bug
+       reported by Mads Martin Joergensen; part fixed by Brendan Cully.
+
+2005-07-24 08:59:44  Brendan Cully  <brendan@kublai.com>  (brendan)
+
+       * copy.c: Don't assume messages in MMDF mailboxes have From
+       separators when copying them. Spotted by William Lovas. Initial
+       patch by TAKAHASHI Tamotsu.
+
 2005-07-23 23:35:17  Byrial Jensen  <byrial@image.dk>  (brendan)
 
        * curs_main.c, doc/manual.sgml.head, globals.h, main.c, muttlib.c:
 2005-07-23 23:35:17  Byrial Jensen  <byrial@image.dk>  (brendan)
 
        * curs_main.c, doc/manual.sgml.head, globals.h, main.c, muttlib.c:
 2005-01-29 19:15:07  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
                                  
      * hcache.c: - make hcache.c conform to mutt codingstyle
 2005-01-29 19:15:07  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
                                  
      * hcache.c: - make hcache.c conform to mutt codingstyle
-     - use $Id: ChangeLog,v 3.433 2005/07/23 23:37:05 brendan Exp $ CVS keyword instead of %K% BitKeeper keyword
+     - use $Id: ChangeLog,v 3.435 2005/07/24 14:24:00 roessler Exp $ CVS keyword instead of %K% BitKeeper keyword
                                  
 2005-01-29 19:15:07  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
 
                                  
 2005-01-29 19:15:07  Thomas Glanzmann  <sithglan@stud.uni-erlangen.de>  (roessler)
 
diff --git a/copy.c b/copy.c
index e4bb6c4..b168014 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -702,17 +702,16 @@ mutt_copy_message (FILE * fpout, CONTEXT * src, HEADER * hdr, int flags,
 
 int
 _mutt_append_message (CONTEXT * dest, FILE * fpin, CONTEXT * src,
 
 int
 _mutt_append_message (CONTEXT * dest, FILE * fpin, CONTEXT * src,
-                      HEADER * hdr, BODY * body, int flags, int chflags)
-{
+                      HEADER * hdr, BODY * body, int flags, int chflags) {
+  char buf[STRING];
   MESSAGE *msg;
   int r;
 
   MESSAGE *msg;
   int r;
 
-  if ((msg =
-       mx_open_new_message (dest, hdr,
-                            (src->magic == M_MBOX
-                             || src->magic == M_MMDF) ? 0 : M_ADD_FROM)) ==
-      NULL)
-    return -1;
+  fseek(fpin, hdr->offset, 0);
+  if (fgets (buf, sizeof (buf), fpin) == NULL)
+    return (-1);
+  if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : M_ADD_FROM)) == NULL)
+    return (-1);
   if (dest->magic == M_MBOX || dest->magic == M_MMDF)
     chflags |= CH_FROM | CH_FORCE_FROM;
   chflags |= (dest->magic == M_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
   if (dest->magic == M_MBOX || dest->magic == M_MMDF)
     chflags |= CH_FROM | CH_FORCE_FROM;
   chflags |= (dest->magic == M_MAILDIR ? CH_NOSTATUS : CH_UPDATE);
index 36f4a3e..f65c4e1 100644 (file)
@@ -886,7 +886,7 @@ void mutt_view_attachments (HEADER * hdr)
 
   char helpstr[SHORT_STRING];
   MUTTMENU *menu;
 
   char helpstr[SHORT_STRING];
   MUTTMENU *menu;
-  BODY *cur;
+  BODY *cur = NULL;
   MESSAGE *msg;
   FILE *fp;
   ATTACHPTR **idx = NULL;
   MESSAGE *msg;
   FILE *fp;
   ATTACHPTR **idx = NULL;
diff --git a/smime.c b/smime.c
index aac48f4..102732f 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -1659,9 +1659,8 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     fclose (smimeout);
     smimeout = NULL;
     mutt_unlink (tmpfname);
     fclose (smimeout);
     smimeout = NULL;
     mutt_unlink (tmpfname);
-    state_attach_puts (_
-                       ("[-- Error: unable to create OpenSSL subprocess! --]\n"),
-                       s);
+    if (s->flags & M_DISPLAY)
+      state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s);
     return NULL;
   }
   else if ((type & SIGNOPAQUE) &&
     return NULL;
   }
   else if ((type & SIGNOPAQUE) &&
@@ -1672,9 +1671,8 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     fclose (smimeout);
     smimeout = NULL;
     mutt_unlink (tmpfname);
     fclose (smimeout);
     smimeout = NULL;
     mutt_unlink (tmpfname);
-    state_attach_puts (_
-                       ("[-- Error: unable to create OpenSSL subprocess! --]\n"),
-                       s);
+    if (s->flags & M_DISPLAY)
+      state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s);
     return NULL;
   }
 
     return NULL;
   }
 
@@ -1805,6 +1803,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   size_t tmplength = b->length;
   int origType = b->type;
   FILE *tmpfp = NULL;
   size_t tmplength = b->length;
   int origType = b->type;
   FILE *tmpfp = NULL;
+  int rv = 0;
 
   if (!mutt_is_application_smime (b))
     return -1;
 
   if (!mutt_is_application_smime (b))
     return -1;
@@ -1835,21 +1834,28 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   mutt_mktemp (tempfile);
   if ((*fpout = safe_fopen (tempfile, "w+")) == NULL) {
     mutt_perror (tempfile);
   mutt_mktemp (tempfile);
   if ((*fpout = safe_fopen (tempfile, "w+")) == NULL) {
     mutt_perror (tempfile);
-    return (-1);
+    rv = -1;
+    goto bail;
   }
   mutt_unlink (tempfile);
 
   }
   mutt_unlink (tempfile);
 
-  *cur = smime_handle_entity (b, &s, *fpout);
+  if (!(*cur = smime_handle_entity (b, &s, *fpout))) {
+    rv = -1;
+    goto bail;
+  }
+
   (*cur)->goodsig = b->goodsig;
   (*cur)->goodsig = b->goodsig;
-  (*cur)->badsig = b->badsig;
+  (*cur)->badsig  = b->badsig;
+
+bail:
   b->type = origType;
   b->length = tmplength;
   b->offset = tmpoffset;
   b->type = origType;
   b->length = tmplength;
   b->offset = tmpoffset;
-  fclose (tmpfp);
-
-  rewind (*fpout);
-  return (0);
 
 
+  safe_fclose (&tmpfp);
+  if (*fpout)
+    rewind (*fpout);
+  return (rv);
 }
 
 
 }