changeset 323:2474d01043cd stable-0-6-58

fix From quoting on embedded rfc/822 messages
author Carl Byington <carl@five-ten-sg.com>
date Fri, 28 Dec 2012 14:45:27 -0800
parents dda88a4e70dd
children 6b1399ab2d46
files ChangeLog NEWS configure.in libpst.spec.in regression/regression-tests.bash src/readpst.c
diffstat 6 files changed, 24 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Dec 27 13:26:29 2012 -0800
+++ b/ChangeLog	Fri Dec 28 14:45:27 2012 -0800
@@ -1,3 +1,7 @@
+LibPST 0.6.58 (2012-12-28)
+===============================
+    * fix From quoting on embedded rfc/822 messages
+
 LibPST 0.6.57 (2012-12-27)
 ===============================
     * remove useless dependencies
--- a/NEWS	Thu Dec 27 13:26:29 2012 -0800
+++ b/NEWS	Fri Dec 28 14:45:27 2012 -0800
@@ -1,3 +1,4 @@
+0.6.58  2012-12-28 fix From quoting on embedded rfc/822 messages
 0.6.57  2012-12-27 remove useless dependencies
 0.6.56  2012-12-24 merge -m .msg files code into main branch
 0.6.55  2012-05-08 preserve bcc headers, space after colon is not required in header fields
--- a/configure.in	Thu Dec 27 13:26:29 2012 -0800
+++ b/configure.in	Fri Dec 28 14:45:27 2012 -0800
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
-AC_INIT(libpst,0.6.57,carl@five-ten-sg.com)
+AC_INIT(libpst,0.6.58,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([src/libpst.c])
 AC_CONFIG_HEADER([config.h])
 AM_INIT_AUTOMAKE
@@ -19,7 +19,7 @@
 #  6. libtool will build libpst.so.x.y.z where the SONAME is libpst.so.x
 #     and x=current-age, y=age, z=revision
 
-libpst_version_info='5:6:1'
+libpst_version_info='5:7:1'
 AC_SUBST(LIBPST_VERSION_INFO, [$libpst_version_info])
 libpst_so_major='4'
 AC_SUBST(LIBPST_SO_MAJOR, [$libpst_so_major])
@@ -42,6 +42,7 @@
 # 0.6.55    libpst.so.4     libpst.so.4.1.5
 # 0.6.56    libpst.so.4     libpst.so.4.1.6
 # 0.6.57    libpst.so.4     libpst.so.4.1.6
+# 0.6.58    libpst.so.4     libpst.so.4.1.7
 
 
 
--- a/libpst.spec.in	Thu Dec 27 13:26:29 2012 -0800
+++ b/libpst.spec.in	Fri Dec 28 14:45:27 2012 -0800
@@ -152,6 +152,9 @@
 
 
 %changelog
+* Wed Dec 28 2012 Carl Byington <carl@five-ten-sg.com> - 0.6.58-1
+- fix From quoting on embedded rfc/822 messages
+
 * Wed Dec 26 2012 Carl Byington <carl@five-ten-sg.com> - 0.6.57-1
 - bugzilla 852414, remove unnecessary dependencies
 
--- a/regression/regression-tests.bash	Thu Dec 27 13:26:29 2012 -0800
+++ b/regression/regression-tests.bash	Fri Dec 28 14:45:27 2012 -0800
@@ -65,14 +65,14 @@
             #$val ../src/readpst $jobs -te -r -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1
 
             ## normal recursive dump
-            #char='us-ascii'
+            char='us-ascii'
             #char='BIG-5'
-            #echo $val ../src/readpst -C $char -j 0 -r -cv -o output$n -d $ba.log $fn
-            #     $val ../src/readpst -C $char -j 0 -r -cv -o output$n -d $ba.log $fn >$ba.err 2>&1
+            echo $val ../src/readpst -C $char -j 0 -r -cv -o output$n -d $ba.log $fn
+                 $val ../src/readpst -C $char -j 0 -r -cv -o output$n -d $ba.log $fn >$ba.err 2>&1
 
             ## separate mode with filename extensions and .msg files
-            echo $val ../src/readpst $jobs     -r -m -D -cv -o output$n -d $ba.log $fn
-                 $val ../src/readpst $jobs     -r -m -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1
+            #echo $val ../src/readpst $jobs     -r -m -D -cv -o output$n -d $ba.log $fn
+            #     $val ../src/readpst $jobs     -r -m -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1
 
             ## separate mode where we decode all attachments to binary files
             #echo $val ../src/readpst $jobs      -r -S -D -cv -o output$n -d $ba.log $fn
@@ -128,7 +128,7 @@
 #$func  21 rendgen3.pst          # mime signed email
 #$func  22 rendgen4.pst          # appointment test cases
 #$func  23 rendgen5.pst          # appointment test cases
-#$func  24 paul.sheer.pst        # embedded rfc822 attachment
+$func  24 paul.sheer.pst        # embedded rfc822 attachment
 #$func  25 jerry.pst             # non ascii subject lines
 #$func  26 phill.bertolus.pst    # possible segfault in forked process, cannot reproduce
 #$func  27 kaiser.pst            # appointments with other character sets
--- a/src/readpst.c	Thu Dec 27 13:26:29 2012 -0800
+++ b/src/readpst.c	Fri Dec 28 14:45:27 2012 -0800
@@ -59,7 +59,7 @@
 void      write_body_part(FILE* f_output, pst_string *body, char *mime, char *charset, char *boundary, pst_file* pst);
 void      write_schedule_part_data(FILE* f_output, pst_item* item, const char* sender, const char* method);
 void      write_schedule_part(FILE* f_output, pst_item* item, const char* sender, const char* boundary);
-void      write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, char** extra_mime_headers);
+void      write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, int embedding, char** extra_mime_headers);
 void      write_vcard(FILE* f_output, pst_item *item, pst_item_contact* contact, char comment[]);
 int       write_extra_categories(FILE* f_output, pst_item* item);
 void      write_journal(FILE* f_output, pst_item* item);
@@ -345,7 +345,7 @@
                             // we are the child process, or the original parent if no children were available
                             pid_t me = getpid();
                             mk_separate_file(&ff, (mode_EX) ? ".eml" : "", 1);
-                            write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers);
+                            write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, 0, &extra_mime_headers);
                             close_separate_file(&ff);
                             if (mode_MSG) {
                                 mk_separate_file(&ff, ".msg", 0);
@@ -367,7 +367,7 @@
                     }
                     else {
                         // process this single email message, cannot fork since not separate mode
-                        write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers);
+                        write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, 0, &extra_mime_headers);
                     }
                 }
             }
@@ -1101,7 +1101,7 @@
         } else {
             fprintf(f_output, "\n--%s\n", boundary);
             fprintf(f_output, "Content-Type: %s\n\n", attach->mimetype.str);
-            write_normal_email(f_output, "", item, MODE_NORMAL, 0, pf, save_rtf, extra_mime_headers);
+            write_normal_email(f_output, "", item, MODE_NORMAL, 0, pf, save_rtf, 1, extra_mime_headers);
         }
         pst_freeItem(item);
     }
@@ -1439,7 +1439,7 @@
 }
 
 
-void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, char** extra_mime_headers)
+void write_normal_email(FILE* f_output, char f_name[], pst_item* item, int mode, int mode_MH, pst_file* pst, int save_rtf, int embedding, char** extra_mime_headers)
 {
     char boundary[60];
     char altboundary[66];
@@ -1564,7 +1564,8 @@
         // procmail produces this separator without the quotes around the
         // sender email address, but apparently some Mac email client needs
         // those quotes, and they don't seem to cause problems for anyone else.
-        fprintf(f_output, "From \"%s\" %s\n", sender, c_time);
+        char *quo = (embedding) ? ">" : "";
+        fprintf(f_output, "%sFrom \"%s\" %s\n", quo, sender, c_time);
     }
 
     // print the supplied email headers