changeset 110:7133b39975f7 stable-0-6-22

patch from David Cuadrado to process emails with type PST_TYPE_OTHER base64_encode_multiple() may insert newline, needs larger malloc subject lines shorter than 2 bytes could segfault
author Carl Byington <carl@five-ten-sg.com>
date Fri, 28 Nov 2008 11:36:53 -0800
parents 7947334d53ad
children cddceda66e9e
files AUTHORS ChangeLog Doxyfile NEWS configure.in libpst.spec.in regression/regression-tests.bash src/libpst.c src/libstrfunc.c src/lspst.c src/pst2dii.cpp.in src/readpst.c
diffstat 12 files changed, 30 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Tue Oct 21 14:45:39 2008 -0700
+++ b/AUTHORS	Fri Nov 28 11:36:53 2008 -0800
@@ -22,3 +22,4 @@
     Justin Greer <jgreer@nextpoint.com>
     Bharath Acharya <abharath@novell.com>
     Robert Harris <robert.f.harris@blueyonder.co.uk>
+    David Cuadrado <krawek@gmail.com>
--- a/ChangeLog	Tue Oct 21 14:45:39 2008 -0700
+++ b/ChangeLog	Fri Nov 28 11:36:53 2008 -0800
@@ -1,3 +1,9 @@
+LibPST 0.6.22 (2008-11-28)
+===============================
+        * patch from David Cuadrado to process emails with type PST_TYPE_OTHER
+        * base64_encode_multiple() may insert newline, needs larger malloc
+	* subject lines shorter than 2 bytes could segfault
+
 LibPST 0.6.21 (2008-10-21)
 ===============================
         * fix title bug with old schema in pst2ldif.
--- a/Doxyfile	Tue Oct 21 14:45:39 2008 -0700
+++ b/Doxyfile	Fri Nov 28 11:36:53 2008 -0800
@@ -1041,7 +1041,7 @@
 # toolkit from AT&T and Lucent Bell Labs. The other options in this section
 # have no effect if this option is set to NO (the default)
 
-HAVE_DOT               = NO
+HAVE_DOT               = YES
 
 # If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
 # will generate a graph for each documented class showing the direct and
@@ -1088,7 +1088,7 @@
 # So in most cases it will be better to enable call graphs for selected
 # functions only using the \callgraph command.
 
-CALL_GRAPH             = NO
+CALL_GRAPH             = YES
 
 # If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
 # will graphical hierarchy of all classes instead of a textual one.
--- a/NEWS	Tue Oct 21 14:45:39 2008 -0700
+++ b/NEWS	Fri Nov 28 11:36:53 2008 -0800
@@ -1,3 +1,4 @@
+0.6.22  2008-11-28 process emails with type PST_TYPE_OTHER, fix malloc error and possible segfault
 0.6.21  2008-10-21 fix title bug with old schema in pst2ldif, also escape commas in distinguished names per rfc4514.
 0.6.20  2008-10-09 add configure option --enable-dii=no, fixes from Robert Harris for pst2ldif.
 0.6.19  2008-09-14 Initial work on a .so shared library from Bharath Acharya.
--- a/configure.in	Tue Oct 21 14:45:39 2008 -0700
+++ b/configure.in	Fri Nov 28 11:36:53 2008 -0800
@@ -1,5 +1,5 @@
 AC_PREREQ(2.59)
-AC_INIT(libpst,0.6.21,carl@five-ten-sg.com)
+AC_INIT(libpst,0.6.22,carl@five-ten-sg.com)
 AC_CONFIG_SRCDIR([config.h.in])
 AC_CONFIG_HEADER([config.h])
 
--- a/libpst.spec.in	Tue Oct 21 14:45:39 2008 -0700
+++ b/libpst.spec.in	Fri Nov 28 11:36:53 2008 -0800
@@ -47,6 +47,11 @@
 
 
 %changelog
+* Fri Nov 28 2008 Carl Byington <carl@five-ten-sg.com> - 0.6.22-1
+- patch from David Cuadrado to process emails with type PST_TYPE_OTHER
+- base64_encode_multiple() may insert newline, needs larger malloc
+- subject lines shorter than 2 bytes could segfault
+
 * Tue Oct 21 2008 Carl Byington <carl@five-ten-sg.com> - 0.6.21-1
 - fix title bug with old schema in pst2ldif.
 - also escape commas in distinguished names per rfc4514.
--- a/regression/regression-tests.bash	Tue Oct 21 14:45:39 2008 -0700
+++ b/regression/regression-tests.bash	Fri Nov 28 11:36:53 2008 -0800
@@ -21,15 +21,15 @@
     mkdir output$n
     $val ../src/readpst -cv -o output$n -d dumper $fn >$fn.pst.err 2>&1
          ../src/readpstlog -f I dumper >$fn.log
-    $val ../src/pst2ldif -b 'o=ams-cc.com, c=US' -c 'newPerson' -o $fn >$fn.ldif.err 2>&1
-    $val ../src/pst2ldif -b 'o=ams-cc.com, c=US' -c 'inetOrgPerson' $fn >$fn.ldif2.err 2>&1
+    #$val ../src/pst2ldif -b 'o=ams-cc.com, c=US' -c 'newPerson' -o $fn >$fn.ldif.err 2>&1
+    #$val ../src/pst2ldif -b 'o=ams-cc.com, c=US' -c 'inetOrgPerson' $fn >$fn.ldif2.err 2>&1
     rm -f dumper
 }
 
 
 
 val="valgrind --leak-check=full"
-val=''
+#val=''
 
 pushd ..
 make || exit
@@ -40,6 +40,8 @@
     dodii 2 sample_64.pst
     dodii 3 test.pst
     dodii 4 big_mail.pst
+elif [ "$1" == "flow" ]; then
+    dopst 11 flow.pst
 else
     dopst  1 ams.pst
    #dopst  2 sample_64.pst
@@ -51,5 +53,6 @@
    #dopst  8 ol2k3high.pst
    #dopst  9 ol97high.pst
    #dopst 10 returned_message.pst
+   #dopst 11 flow.pst
 fi
 
--- a/src/libpst.c	Tue Oct 21 14:45:39 2008 -0700
+++ b/src/libpst.c	Fri Nov 28 11:36:53 2008 -0800
@@ -1875,7 +1875,7 @@
                     memset(item->email->subject, 0, sizeof(pst_item_email_subject));
                     DEBUG_EMAIL((" [size = %i] ", list->items[x]->size));
                     if (list->items[x]->size > 0) {
-                        if (isprint(list->items[x]->data[0])) {
+                        if (isprint(list->items[x]->data[0]) || (list->items[x]->size < 2)) {
                             // then there are no control bytes at the front
                             item->email->subject->off1 = 0;
                             item->email->subject->off2 = 0;
--- a/src/libstrfunc.c	Tue Oct 21 14:45:39 2008 -0700
+++ b/src/libstrfunc.c	Fri Nov 28 11:36:53 2008 -0800
@@ -36,7 +36,7 @@
 
     if (data == NULL || size == 0) return NULL;
 
-    ou = output = (char *)malloc(size / 3 * 4 + (size / 57) + 5);
+    ou = output = (char *)malloc(size / 3 * 4 + (size / 57) + 6);
     if (!output) return NULL;
 
     while((dte-p) >= 3) {
--- a/src/lspst.c	Tue Oct 21 14:45:39 2008 -0700
+++ b/src/lspst.c	Fri Nov 28 11:36:53 2008 -0800
@@ -95,9 +95,9 @@
                         printf("\t%s", pst_rfc2426_escape(item->contact->fullname));
                     printf("\n");
 
-                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT)) {
+                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT || item->type == PST_TYPE_OTHER)) {
                     // Process Email item
-                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT)) {
+                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT) && (ff.type != PST_TYPE_OTHER)) {
                         DEBUG_MAIN(("main: I have an email, but the folder isn't an email folder. Processing anyway\n"));
                     }
                     printf("Email");
--- a/src/pst2dii.cpp.in	Tue Oct 21 14:45:39 2008 -0700
+++ b/src/pst2dii.cpp.in	Fri Nov 28 11:36:53 2008 -0800
@@ -624,10 +624,10 @@
                     //if this is a non-empty folder, we want to recurse into it
                     fprintf(stderr, "entering folder %s\n", item->file_as);
                     process(item, &ff, d_ptr->child);
-                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT)) {
+                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT || item->type == PST_TYPE_OTHER)) {
                     ff.email_count++;
                     DEBUG_MAIN(("main: Processing Email\n"));
-                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT)) {
+                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT) && (ff.type != PST_TYPE_OTHER)) {
                         DEBUG_MAIN(("main: I have an email, but the folder isn't an email folder. Processing anyway\n"));
                     }
                     write_normal_email(ff, item, &pstfile);
--- a/src/readpst.c	Tue Oct 21 14:45:39 2008 -0700
+++ b/src/readpst.c	Fri Nov 28 11:36:53 2008 -0800
@@ -158,11 +158,11 @@
                     else
                         fprintf(ff.output, "%s <%s>\n", item->contact->fullname, item->contact->address1);
 
-                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT)) {
+                } else if (item->email && (item->type == PST_TYPE_NOTE || item->type == PST_TYPE_REPORT || item->type == PST_TYPE_OTHER)) {
                     if (mode == MODE_SEPARATE) mk_separate_file(&ff);
                     ff.email_count++;
                     DEBUG_MAIN(("main: Processing Email\n"));
-                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT)) {
+                    if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_REPORT) && (ff.type != PST_TYPE_OTHER)) {
                         DEBUG_MAIN(("main: I have an email, but the folder isn't an email folder. Processing anyway\n"));
                     }
                     write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body);