diff --git a/AUTHORS b/AUTHORS index 84f64d3..e28a39b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,48 +1,50 @@ Original version by: Dave Smith Dave Smith Current maintainer: Carl Byington With contributions by: Joseph Nahmias -- bounces Joseph Nahmias Arne Ahrend Nigel Horne Chris Halls Stevens Miller Brad Hards Alexander Grau Antonio Palama Sean Loaring James Woodcock Joachim Metz Robert Simpson Justin Greer Bharath Acharya Robert Harris David Cuadrado Chris Eagle Fridrich Strba Emmanuel Andry hggdh bharder Chris White Roberto Polli Lee Ayres Hugo DesRosiers Kenneth Berland Leo 'costela' Antunes Svante Signell Dominique Leuenberger a.k.a. Dimstar Daniel Gryniewicz AJ Shankar Jeffrey Morlan Hans Liss Igor Stroh + Zachary Travis + Vitaliy Didik Testing team: Mac OSX - Michael Watson Cygwin/Mingw - Fridrich Strba Cygwin - Chris Eagle diff --git a/regression/regression-tests.bash b/regression/regression-tests.bash index 41728d8..4f27cad 100644 --- a/regression/regression-tests.bash +++ b/regression/regression-tests.bash @@ -1,166 +1,166 @@ #!/bin/bash function consistency() { # check source and xml documentation for consistency ( cd .. # back to top level of project f1=/tmp/f1$$ f2=/tmp/f2$$ grep 'case 0x' src/libpst.c | awk '{print $2}' | tr A-Z a-z | sed -e 's/://g' | sort >$f1 grep '^0x' xml/libpst.in | awk '{print $1}' | (for i in {1..19}; do read a; done; cat) | sort >$f2 diff $f1 $f2 less $f1 #rm -f $f1 $f2 ls -al $f1 $f2 ) } function dodii() { n="$1" fn="$2" ba=$(basename "$fn" .pst) size=$(stat -c %s $fn) rm -rf output$n if [ -z "$val" ] || [ $size -lt 10000000 ]; then echo $fn mkdir output$n $val ../src/pst2dii -f /usr/share/fonts/liberation/LiberationMono-Regular.ttf -B "bates-" -o output$n -O $ba.mydii -d $fn.log $fn >$fn.dii.err 2>&1 fi } function doldif() { n="$1" fn="$2" ba=$(basename "$fn" .pst) size=$(stat -c %s $fn) rm -rf output$n if [ -z "$val" ] || [ $size -lt 10000000 ]; then echo $fn mkdir output$n $val ../src/pst2ldif -d $ba.ldif.log -b 'o=ams-cc.com, c=US' -c 'inetOrgPerson' $fn >$ba.ldif.err 2>&1 fi } function dopst() { n="$1" fn="$2" ba=$(basename "$fn" .pst) size=$(stat -c %s $fn) jobs="" [ -n "$val" ] && jobs="-j 0" rm -rf output$n if [ -z "$val" ] || [ $size -lt 100000000 ]; then echo $fn mkdir output$n if [ "$regression" == "yes" ]; then $val ../src/readpst $jobs -te -r -cv -o output$n $fn >$ba.err 2>&1 else ## only email and include deleted items, have a deleted items folder with multiple item types #$val ../src/readpst $jobs -te -r -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 ## normal recursive dump char='BIG-5' char='us-ascii' acc="-a '.xls,.doc'" acc='' utf='-8' ## normal mode #echo $val ../src/readpst $utf $acc -C $char -j 0 -cv -o output$n -d $ba.log $fn # $val ../src/readpst $utf $acc -C $char -j 0 -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 ## kmail mode #echo $val ../src/readpst $utf $acc -C $char -j 0 -k -cv -o output$n -d $ba.log $fn # $val ../src/readpst $utf $acc -C $char -j 0 -k -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 ## recursive mode - #echo $val ../src/readpst $utf $acc -C $char -j 0 -r -cv -o output$n -d $ba.log $fn - # $val ../src/readpst $utf $acc -C $char -j 0 -r -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 + echo $val ../src/readpst $utf $acc -C $char -j 0 -r -cv -o output$n -d $ba.log $fn + $val ../src/readpst $utf $acc -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 ## 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 - $val ../src/readpst $jobs -r -S -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 + #echo $val ../src/readpst $jobs -r -S -D -cv -o output$n -d $ba.log $fn + # $val ../src/readpst $jobs -r -S -D -cv -o output$n -d $ba.log $fn >$ba.err 2>&1 ## testing idblock #../src/getidblock -p $fn 0 >$ba.fulldump fi fi } #consistency #exit pushd .. make || exit popd rm -rf output* *.err *.log v="valgrind --leak-check=full" val="" func="dopst" [ "$1" == "pst" ] && func="dopst" [ "$1" == "pstv" ] && func="dopst" && val=$v [ "$1" == "ldif" ] && func="doldif" [ "$1" == "dii" ] && func="dodii" regression="" [ "$2" == "reg" ] && regression="yes" [ "$regression" == "yes" ] && val="" -# $func 1 ams.pst -# $func 2 sample_64.pst -# $func 3 test.pst -# $func 4 big_mail.pst -# $func 5 mbmg.archive.pst -# $func 6 Single2003-read.pst -# $func 7 Single2003-unread.pst -# $func 8 ol2k3high.pst -# $func 9 ol97high.pst -# $func 10 returned_message.pst -# $func 11 flow.pst -# $func 12 test-html.pst -# $func 13 test-text.pst -# $func 14 joe.romanowski.pst -# $func 15 hourig1.pst -# $func 16 test-mac.pst -# $func 17 backup.pst -# $func 18 spam.pst -# $func 19 rendgen.pst # single email appointment -# $func 20 rendgen2.pst # email appointment with no termination date -# $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 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 -# $func 28 pstsample.pst # character set issue -# $func 29 pstsample2.pst # embedded image in rtf data -# $func 30 pstsample3.pst # exports of rtf and html -# $func 31 Journal_Archives_08_29_2010.pst +$func 1 ams.pst +$func 2 sample_64.pst +$func 3 test.pst +$func 4 big_mail.pst +$func 5 mbmg.archive.pst +$func 6 Single2003-read.pst +$func 7 Single2003-unread.pst +$func 8 ol2k3high.pst +$func 9 ol97high.pst +$func 10 returned_message.pst +$func 11 flow.pst +$func 12 test-html.pst +$func 13 test-text.pst +$func 14 joe.romanowski.pst +$func 15 hourig1.pst +$func 16 test-mac.pst +$func 17 backup.pst +$func 18 spam.pst +$func 19 rendgen.pst # single email appointment +$func 20 rendgen2.pst # email appointment with no termination date +$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 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 +$func 28 pstsample.pst # character set issue +$func 29 pstsample2.pst # embedded image in rtf data +$func 30 pstsample3.pst # exports of rtf and html +$func 31 Journal_Archives_08_29_2010.pst [ -n "$val" ] && grep 'lost:' *err | grep -v 'lost: 0 ' if [ "$regression" == "yes" ]; then ( (for i in output*; do find $i -type f; done) | while read a; do grep -v iamunique "$a" rm -f "$a" done ) >regression.txt fi diff --git a/src/common.h b/src/common.h index b84c14b..a128b19 100644 --- a/src/common.h +++ b/src/common.h @@ -1,54 +1,54 @@ #ifndef __PST_COMMON_H #define __PST_COMMON_H #include #include #include #include -#ifndef _MSC_VER +#if !defined(_MSC_VER) || (_MSC_VER >= 1800) #include #include #else typedef signed char int8_t; typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef short int16_t; + typedef unsigned short uint16_t; + typedef short int16_t; typedef unsigned int uint32_t; - typedef int int32_t; - typedef unsigned long long uint64_t; - typedef long long int64_t; + typedef int int32_t; + typedef unsigned long long uint64_t; + typedef long long int64_t; #endif #ifndef _WIN32 typedef struct { uint32_t dwLowDateTime; uint32_t dwHighDateTime; } FILETIME; // According to Jan Wolter, sys/param.h is the most portable source of endian // information on UNIX systems. see http://www.unixpapa.com/incnote/byteorder.html #include #else #include #endif #if defined(_WIN32) || defined(__DJGPP__) #ifndef LITTLE_ENDIAN #define LITTLE_ENDIAN 1234 #endif #ifndef BIG_ENDIAN #define BIG_ENDIAN 4321 #endif #define BYTE_ORDER LITTLE_ENDIAN #endif #endif #if defined (__SVR4) && defined (__sun) #define LITTLE_ENDIAN 1234 #define BYTE_ORDER LITTLE_ENDIAN #endif diff --git a/src/define.h b/src/define.h index 11d634b..44f2c6f 100644 --- a/src/define.h +++ b/src/define.h @@ -1,261 +1,260 @@ /*** * define.h * Part of the LibPST project * Written by David Smith * dave.s@earthcorp.com */ #ifndef DEFINEH_H #define DEFINEH_H #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "libpst.h" #include "timeconv.h" #include "libstrfunc.h" #include "vbuf.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_CTYPE_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_WCHAR_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif #ifdef HAVE_ERRNO_H #include #endif #ifdef HAVE_ICONV #include #endif #ifdef HAVE_REGEX_H #include #endif #ifdef HAVE_GD_H #include #endif #define PERM_DIRS 0777 #ifdef _WIN32 #include #define D_MKDIR(x) mkdir(x) #define chdir _chdir #define strcasecmp _stricmp #define vsnprintf _vsnprintf #define snprintf _snprintf #ifdef _MSC_VER #define ftello _ftelli64 #define fseeko _fseeki64 #elif defined (__MINGW32__) #define ftello ftello64 #define fseeko fseeko64 #else #error Only MSC and mingw supported for Windows #endif - #ifndef __MINGW32__ - #define size_t __int64 - #endif #ifndef UINT64_MAX #define UINT64_MAX ((uint64_t)0xffffffffffffffff) #endif - #define PRIx64 "I64x" + #ifndef PRIx64 + #define PRIx64 "I64x" + #endif int __cdecl _fseeki64(FILE *, __int64, int); __int64 __cdecl _ftelli64(FILE *); #ifdef __MINGW32__ #include #else #include "XGetopt.h" #endif #include #undef gmtime_r #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) #else #ifdef __DJGPP__ #define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0) #define ctime_r(tp,tmp) (ctime(tp)?(strcpy((tmp),ctime((tp))),(tmp)):0) - #define fseeko(stream, offset, whence) fseek(stream, (long)offset, whence) + #define fseeko(stream, offset, whence) fseek(stream, (long)offset, whence) #define ftello ftell #endif #ifdef HAVE_UNISTD_H #include #else #include "XGetopt.h" #endif #define D_MKDIR(x) mkdir(x, PERM_DIRS) #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SYS_SHM_H #include #endif #ifdef HAVE_SYS_WAIT_H #include #endif #ifdef HAVE_DIRENT_H #include #endif #ifdef HAVE_SEMAPHORE_H #include #endif void pst_debug_lock(); void pst_debug_unlock(); void pst_debug_setlevel(int level); void pst_debug_init(const char* fname, void* output_mutex); void pst_debug_func(int level, const char* function); void pst_debug_func_ret(int level); void pst_debug(int level, int line, const char *file, const char *fmt, ...); void pst_debug_hexdump(int level, int line, const char *file, const char* buf, size_t size, int cols, int delta); void pst_debug_hexdumper(FILE* out, const char* buf, size_t size, int cols, int delta); void pst_debug_close(); void* pst_malloc(size_t size); void *pst_realloc(void *ptr, size_t size); #define MESSAGEPRINT1(...) pst_debug(1, __LINE__, __FILE__, __VA_ARGS__) #define MESSAGEPRINT2(...) pst_debug(2, __LINE__, __FILE__, __VA_ARGS__) #define MESSAGEPRINT3(...) pst_debug(3, __LINE__, __FILE__, __VA_ARGS__) #define WARN(x) { \ - MESSAGEPRINT3 x; \ + MESSAGEPRINT3 x; \ pst_debug_lock(); \ printf x; \ fflush(stdout); \ pst_debug_unlock(); \ } #define DIE(x) { \ WARN(x); \ exit(EXIT_FAILURE); \ } #define DEBUG_WARN(x) MESSAGEPRINT3 x #define DEBUG_INFO(x) MESSAGEPRINT2 x #define DEBUG_HEXDUMP(x, s) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, 0x10, 0) #define DEBUG_HEXDUMPC(x, s, c) pst_debug_hexdump(1, __LINE__, __FILE__, (char*)x, s, c, 0) #define DEBUG_ENT(x) \ { \ pst_debug_func(1, x); \ - pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ + pst_debug(1, __LINE__, __FILE__, "Entering function\n"); \ } #define DEBUG_RET() \ { \ pst_debug(1, __LINE__, __FILE__, "Leaving function\n"); \ - pst_debug_func_ret(1); \ + pst_debug_func_ret(1); \ } #define DEBUG_INIT(fname,mutex) {pst_debug_init(fname,mutex);} #define DEBUG_CLOSE() {pst_debug_close();} #define RET_DERROR(res, ret_val, x) if (res) { DIE(x);} #if BYTE_ORDER == BIG_ENDIAN # define LE64_CPU(x) \ x = ((((x) & UINT64_C(0xff00000000000000)) >> 56) | \ (((x) & UINT64_C(0x00ff000000000000)) >> 40) | \ (((x) & UINT64_C(0x0000ff0000000000)) >> 24) | \ (((x) & UINT64_C(0x000000ff00000000)) >> 8 ) | \ (((x) & UINT64_C(0x00000000ff000000)) << 8 ) | \ (((x) & UINT64_C(0x0000000000ff0000)) << 24) | \ (((x) & UINT64_C(0x000000000000ff00)) << 40) | \ (((x) & UINT64_C(0x00000000000000ff)) << 56)); # define LE32_CPU(x) \ x = ((((x) & 0xff000000) >> 24) | \ (((x) & 0x00ff0000) >> 8 ) | \ (((x) & 0x0000ff00) << 8 ) | \ (((x) & 0x000000ff) << 24)); # define LE16_CPU(x) \ x = ((((x) & 0xff00) >> 8) | \ (((x) & 0x00ff) << 8)); #elif BYTE_ORDER == LITTLE_ENDIAN # define LE64_CPU(x) {} # define LE32_CPU(x) {} # define LE16_CPU(x) {} #else # error "Byte order not supported by this library" #endif // BYTE_ORDER #define PST_LE_GET_UINT64(p) \ (uint64_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24) | \ (((uint8_t const *)(p))[4] << 32) | \ (((uint8_t const *)(p))[5] << 40) | \ (((uint8_t const *)(p))[6] << 48) | \ (((uint8_t const *)(p))[7] << 56)) #define PST_LE_GET_INT64(p) \ (int64_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24) | \ (((uint8_t const *)(p))[4] << 32) | \ (((uint8_t const *)(p))[5] << 40) | \ (((uint8_t const *)(p))[6] << 48) | \ (((uint8_t const *)(p))[7] << 56)) #define PST_LE_GET_UINT32(p) \ (uint32_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24)) #define PST_LE_GET_INT32(p) \ (int32_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8) | \ (((uint8_t const *)(p))[2] << 16) | \ (((uint8_t const *)(p))[3] << 24)) -#define PST_LE_GET_UINT16(p) \ +#define PST_LE_GET_UINT16(p) \ (uint16_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8)) -#define PST_LE_GET_INT16(p) \ +#define PST_LE_GET_INT16(p) \ (int16_t)((((uint8_t const *)(p))[0] << 0) | \ (((uint8_t const *)(p))[1] << 8)) #define PST_LE_GET_UINT8(p) (*(uint8_t const *)(p)) #define PST_LE_GET_INT8(p) (*(int8_t const *)(p)) #endif //DEFINEH_H