From 874b10fd9b323509a14ac0a598788fdc68e1dae7 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Wed, 18 Jul 2018 05:45:54 +0200 Subject: [PATCH] Applied updates --- .travis.yml | 2 +- common/types.h.in | 67 +++++++++++++++++++++++--------- configure.ac | 2 +- evtxtools/evtxtools_libcerror.h | 2 +- evtxtools/evtxtools_libclocale.h | 2 +- evtxtools/evtxtools_libcnotify.h | 2 +- evtxtools/evtxtools_libcpath.h | 2 +- evtxtools/evtxtools_libevtx.h | 2 +- evtxtools/evtxtools_libfcache.h | 2 +- libevtx/libevtx_extern.h | 5 ++- libevtx/libevtx_i18n.c | 2 +- libevtx/libevtx_libcdata.h | 2 +- libevtx/libevtx_libcerror.h | 2 +- libevtx/libevtx_libclocale.h | 2 +- libevtx/libevtx_libcnotify.h | 2 +- libevtx/libevtx_libfcache.h | 2 +- m4/libcpath.m4 | 20 +++++----- pyevtx/pyevtx.c | 12 +++--- pyevtx/pyevtx_libcerror.h | 2 +- pyevtx/pyevtx_libclocale.h | 2 +- tests/evtx_test_io_handle.c | 34 +++++++++++++++- tests/evtx_test_libcerror.h | 2 +- tests/evtx_test_libclocale.h | 2 +- tests/evtx_test_libcnotify.h | 2 +- tests/evtx_test_libevtx.h | 2 +- 25 files changed, 121 insertions(+), 57 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55bf6b4a..934e50da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ matrix: sudo: required group: edge before_install: - - if test ${TRAVIS_OS_NAME} = "linux"; then sudo apt-get update && sudo apt-mark hold oracle-java9-installer postgresql-9.2 postgresql-9.3 postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-client postgresql-client-common postgresql-common postgresql-contrib-9.2 postgresql-contrib-9.3 postgresql-contrib-9.4 postgresql-contrib-9.5 postgresql-contrib-9.6 postgresql-doc && sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y && sudo apt-get install -y autopoint; fi + - if test ${TRAVIS_OS_NAME} = "linux"; then sudo apt-get update && sudo apt-mark hold oracle-java8-installer oracle-java9-installer postgresql-9.2 postgresql-9.3 postgresql-9.4 postgresql-9.5 postgresql-9.6 postgresql-client postgresql-client-common postgresql-common postgresql-contrib-9.2 postgresql-contrib-9.3 postgresql-contrib-9.4 postgresql-contrib-9.5 postgresql-contrib-9.6 postgresql-doc && sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y --allow-unauthenticated && sudo apt-get install -y autopoint; fi - if test ${TRAVIS_OS_NAME} = "osx"; then brew update && brew install gettext gnu-sed && brew link --force gettext; fi - if test ${TARGET} = "coverity"; then echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-; fi install: diff --git a/common/types.h.in b/common/types.h.in index 327d6643..6fa6bf03 100644 --- a/common/types.h.in +++ b/common/types.h.in @@ -59,7 +59,7 @@ typedef int system_integer_t; #endif /* defined( WINAPI ) && ( defined( _UNICODE ) || defined( UNICODE ) ) */ -/* Fix for systems without PRI definitions +/* Fallback for systems without PRI definitions */ #if !defined( PRId8 ) #define PRId8 "d" @@ -77,7 +77,7 @@ typedef int system_integer_t; #define PRId32 "d" #endif -#endif +#endif /* !defined( PRId32 ) */ #if !defined( PRId64 ) #if defined( WINAPI ) @@ -90,7 +90,7 @@ typedef int system_integer_t; #define PRId64 "lld" #endif -#endif +#endif /* !defined( PRId64 ) */ #if !defined( PRIi8 ) #define PRIi8 "i" @@ -108,7 +108,7 @@ typedef int system_integer_t; #define PRIi32 "i" #endif -#endif +#endif /* !defined( PRIi32 ) */ #if !defined( PRIi64 ) #if defined( WINAPI ) @@ -121,7 +121,7 @@ typedef int system_integer_t; #define PRIi64 "lli" #endif -#endif +#endif /* !defined( PRIi64 ) */ #if !defined( PRIu8 ) #define PRIu8 "u" @@ -139,7 +139,7 @@ typedef int system_integer_t; #define PRIu32 "u" #endif -#endif +#endif /* !defined( PRIu32 ) */ #if !defined( PRIu64 ) #if defined( WINAPI ) @@ -152,7 +152,38 @@ typedef int system_integer_t; #define PRIu64 "llu" #endif +#endif /* !defined( PRIu64 ) */ + +#if !defined( PRIo8 ) +#define PRIo8 "o" +#endif + +#if !defined( PRIo16 ) +#define PRIo16 "o" +#endif + +#if !defined( PRIo32 ) +#if defined( WINAPI ) +#define PRIo32 "I32o" + +#else +#define PRIo32 "o" + +#endif +#endif /* !defined( PRIo32 ) */ + +#if !defined( PRIo64 ) +#if defined( WINAPI ) +#define PRIo64 "I64o" + +#elif __WORDSIZE == 64 +#define PRIo64 "lo" + +#else +#define PRIo64 "llo" + #endif +#endif /* !defined( PRIo64 ) */ #if !defined( PRIx8 ) #define PRIx8 "x" @@ -170,7 +201,7 @@ typedef int system_integer_t; #define PRIx32 "x" #endif -#endif +#endif /* !defined( PRIx32 ) */ #if !defined( PRIx64 ) #if defined( WINAPI ) @@ -183,9 +214,9 @@ typedef int system_integer_t; #define PRIx64 "llx" #endif -#endif +#endif /*!defined( PRIx64 ) */ -/* Fix for systems without printf %jd definition +/* Fallback for systems without printf %jd definition */ #if defined( HAVE_PRINTF_JD ) #define PRIjd "jd" @@ -205,9 +236,9 @@ typedef int system_integer_t; #define PRIju PRIu32 #define PRIjx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_JD ) */ -/* Fix for systems without printf %zd definition +/* Fallback for systems without printf %zd definition */ #if defined( HAVE_PRINTF_ZD ) #define PRIzd "zd" @@ -233,9 +264,9 @@ typedef int system_integer_t; #define PRIzu PRIu32 #define PRIzx PRIx32 -#endif +#endif /* defined( HAVE_PRINTF_ZD ) */ -/* Fix for systems without (U)INTx_MAX definitions +/* Fallback for systems without (U)INTx_MAX definitions */ /* The maximum signed 8-bit integer is 127 (0x7f) @@ -250,7 +281,7 @@ typedef int system_integer_t; #define UINT8_MAX (0xff) #endif -/* The maximum signed 16-bit integer is 32767 (0xr7ffff) +/* The maximum signed 16-bit integer is 32767 (0x7ffff) */ #if !defined( INT16_MAX ) #define INT16_MAX (0x7fff) @@ -282,7 +313,7 @@ typedef int system_integer_t; #else #define INT64_MAX (0x7fffffffffffffffULL) #endif -#endif +#endif /* !defined( INT64_MAX ) */ /* The maximum unsigned 64-bit integer is 18446744073709551615 (0xffffffffffffffff) */ @@ -292,7 +323,7 @@ typedef int system_integer_t; #else #define UINT64_MAX (0xffffffffffffffffULL) #endif -#endif +#endif /* !defined( UINT64_MAX ) */ /* The maximum signed integer */ @@ -316,7 +347,7 @@ typedef int system_integer_t; #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* _WIN64 */ +#endif #else @@ -324,7 +355,7 @@ typedef int system_integer_t; #define SSIZE_MAX INT64_MAX #else #define SSIZE_MAX INT32_MAX -#endif /* __WORDSIZE == 64 */ +#endif #endif /* WINAPI */ diff --git a/configure.ac b/configure.ac index c2eec1cf..0c7984d1 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 ) AC_INIT( [libevtx], - [20180413], + [20180718], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff --git a/evtxtools/evtxtools_libcerror.h b/evtxtools/evtxtools_libcerror.h index 00381f29..a6542ff1 100644 --- a/evtxtools/evtxtools_libcerror.h +++ b/evtxtools/evtxtools_libcerror.h @@ -1,5 +1,5 @@ /* - * The internal libcerror header + * The libcerror header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/evtxtools/evtxtools_libclocale.h b/evtxtools/evtxtools_libclocale.h index 5ebc3e6a..772d2ec9 100644 --- a/evtxtools/evtxtools_libclocale.h +++ b/evtxtools/evtxtools_libclocale.h @@ -1,5 +1,5 @@ /* - * The internal libclocale header + * The libclocale header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/evtxtools/evtxtools_libcnotify.h b/evtxtools/evtxtools_libcnotify.h index a26c5341..c92e4759 100644 --- a/evtxtools/evtxtools_libcnotify.h +++ b/evtxtools/evtxtools_libcnotify.h @@ -1,5 +1,5 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/evtxtools/evtxtools_libcpath.h b/evtxtools/evtxtools_libcpath.h index ccf4d71d..0c510b3e 100644 --- a/evtxtools/evtxtools_libcpath.h +++ b/evtxtools/evtxtools_libcpath.h @@ -1,5 +1,5 @@ /* - * The internal libcpath header + * The libcpath header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/evtxtools/evtxtools_libevtx.h b/evtxtools/evtxtools_libevtx.h index 30712629..b7a0a184 100644 --- a/evtxtools/evtxtools_libevtx.h +++ b/evtxtools/evtxtools_libevtx.h @@ -1,5 +1,5 @@ /* - * The internal libevtx header + * The libevtx header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/evtxtools/evtxtools_libfcache.h b/evtxtools/evtxtools_libfcache.h index 8a61a18a..5a5c6868 100644 --- a/evtxtools/evtxtools_libfcache.h +++ b/evtxtools/evtxtools_libfcache.h @@ -1,5 +1,5 @@ /* - * The internal libfcache header + * The libfcache header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/libevtx/libevtx_extern.h b/libevtx/libevtx_extern.h index f671b91c..5bd2b25c 100644 --- a/libevtx/libevtx_extern.h +++ b/libevtx/libevtx_extern.h @@ -37,8 +37,11 @@ #include +#define LIBEVTX_EXTERN_VARIABLE LIBEVTX_EXTERN + #else -#define LIBEVTX_EXTERN /* extern */ +#define LIBEVTX_EXTERN /* extern */ +#define LIBEVTX_EXTERN_VARIABLE extern #endif /* !defined( HAVE_LOCAL_LIBEVTX ) */ diff --git a/libevtx/libevtx_i18n.c b/libevtx/libevtx_i18n.c index a4097766..1b1fa27c 100644 --- a/libevtx/libevtx_i18n.c +++ b/libevtx/libevtx_i18n.c @@ -1,7 +1,7 @@ /* * Internationalization (i18n) functions * - * Copyright (C) 2012-2018, Joachim Metz + * Copyright (C) 2011-2018, Joachim Metz * * Refer to AUTHORS for acknowledgements. * diff --git a/libevtx/libevtx_libcdata.h b/libevtx/libevtx_libcdata.h index 07fc8f70..cd326b86 100644 --- a/libevtx/libevtx_libcdata.h +++ b/libevtx/libevtx_libcdata.h @@ -1,5 +1,5 @@ /* - * The internal libcdata header + * The libcdata header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/libevtx/libevtx_libcerror.h b/libevtx/libevtx_libcerror.h index 876fad89..e7c772d2 100644 --- a/libevtx/libevtx_libcerror.h +++ b/libevtx/libevtx_libcerror.h @@ -1,5 +1,5 @@ /* - * The internal libcerror header + * The libcerror header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/libevtx/libevtx_libclocale.h b/libevtx/libevtx_libclocale.h index 02bed426..52e63526 100644 --- a/libevtx/libevtx_libclocale.h +++ b/libevtx/libevtx_libclocale.h @@ -1,5 +1,5 @@ /* - * The internal libclocale header + * The libclocale header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/libevtx/libevtx_libcnotify.h b/libevtx/libevtx_libcnotify.h index ff0d0793..9f947e56 100644 --- a/libevtx/libevtx_libcnotify.h +++ b/libevtx/libevtx_libcnotify.h @@ -1,5 +1,5 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/libevtx/libevtx_libfcache.h b/libevtx/libevtx_libfcache.h index 9c809702..328d81de 100644 --- a/libevtx/libevtx_libfcache.h +++ b/libevtx/libevtx_libfcache.h @@ -1,5 +1,5 @@ /* - * The internal libfcache header + * The libfcache header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/m4/libcpath.m4 b/m4/libcpath.m4 index 01d7e916..eb453069 100644 --- a/m4/libcpath.m4 +++ b/m4/libcpath.m4 @@ -1,6 +1,6 @@ dnl Checks for libcpath or required headers and functions dnl -dnl Version: 20180407 +dnl Version: 20180716 dnl Function to detect if libcpath is available dnl ac_libcpath_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -24,7 +24,7 @@ AC_DEFUN([AX_LIBCPATH_CHECK_LIB], [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libcpath], - [libcpath >= 20120701], + [libcpath >= 20180716], [ac_cv_libcpath=yes], [ac_cv_libcpath=check]) ]) @@ -91,22 +91,22 @@ AC_DEFUN([AX_LIBCPATH_CHECK_LIB], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_join, + libcpath_path_get_sanitized_filename, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_make_directory, + libcpath_path_get_sanitized_path, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_sanitize, + libcpath_path_join, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_sanitize_filename, + libcpath_path_make_directory, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) @@ -129,22 +129,22 @@ AC_DEFUN([AX_LIBCPATH_CHECK_LIB], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_join_wide, + libcpath_path_get_sanitized_filename_wide, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_make_directory_wide, + libcpath_path_get_sanitized_path_wide, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_sanitize_wide, + libcpath_path_join_wide, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) AC_CHECK_LIB( cpath, - libcpath_path_sanitize_filename_wide, + libcpath_path_make_directory_wide, [ac_cv_libcpath_dummy=yes], [ac_cv_libcpath=no]) ]) diff --git a/pyevtx/pyevtx.c b/pyevtx/pyevtx.c index 9b73aa3f..d9604215 100644 --- a/pyevtx/pyevtx.c +++ b/pyevtx/pyevtx.c @@ -550,7 +550,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_event_levels_type_object ); + (PyObject *) &pyevtx_event_levels_type_object ); PyModule_AddObject( module, @@ -567,7 +567,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_file_type_object ); + (PyObject *) &pyevtx_file_type_object ); PyModule_AddObject( module, @@ -584,7 +584,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_file_flags_type_object ); + (PyObject *) &pyevtx_file_flags_type_object ); PyModule_AddObject( module, @@ -601,7 +601,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_record_type_object ); + (PyObject *) &pyevtx_record_type_object ); PyModule_AddObject( module, @@ -618,7 +618,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_records_type_object ); + (PyObject *) &pyevtx_records_type_object ); PyModule_AddObject( module, @@ -635,7 +635,7 @@ PyMODINIT_FUNC initpyevtx( goto on_error; } Py_IncRef( - (PyObject * ) &pyevtx_strings_type_object ); + (PyObject *) &pyevtx_strings_type_object ); PyModule_AddObject( module, diff --git a/pyevtx/pyevtx_libcerror.h b/pyevtx/pyevtx_libcerror.h index 330a12a4..ce575e65 100644 --- a/pyevtx/pyevtx_libcerror.h +++ b/pyevtx/pyevtx_libcerror.h @@ -1,5 +1,5 @@ /* - * The internal libcerror header + * The libcerror header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/pyevtx/pyevtx_libclocale.h b/pyevtx/pyevtx_libclocale.h index 6e17c2ad..f681d771 100644 --- a/pyevtx/pyevtx_libclocale.h +++ b/pyevtx/pyevtx_libclocale.h @@ -1,5 +1,5 @@ /* - * The internal libclocale header + * The libclocale header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/tests/evtx_test_io_handle.c b/tests/evtx_test_io_handle.c index e21b0a6e..544a5f2f 100644 --- a/tests/evtx_test_io_handle.c +++ b/tests/evtx_test_io_handle.c @@ -113,6 +113,8 @@ int evtx_test_io_handle_initialize( &io_handle, &error ); + io_handle = NULL; + EVTX_TEST_ASSERT_EQUAL_INT( "result", result, @@ -125,8 +127,6 @@ int evtx_test_io_handle_initialize( libcerror_error_free( &error ); - io_handle = NULL; - #if defined( HAVE_EVTX_TEST_MEMORY ) for( test_number = 0; @@ -332,6 +332,36 @@ int evtx_test_io_handle_clear( libcerror_error_free( &error ); +#if defined( HAVE_EVTX_TEST_MEMORY ) + + /* Test libevtx_io_handle_clear with memset failing + */ + evtx_test_memset_attempts_before_fail = 0; + + result = libevtx_io_handle_clear( + io_handle, + &error ); + + if( evtx_test_memset_attempts_before_fail != -1 ) + { + evtx_test_memset_attempts_before_fail = -1; + } + else + { + EVTX_TEST_ASSERT_EQUAL_INT( + "result", + result, + -1 ); + + EVTX_TEST_ASSERT_IS_NOT_NULL( + "error", + error ); + + libcerror_error_free( + &error ); + } +#endif /* defined( HAVE_EVTX_TEST_MEMORY ) */ + /* Clean up */ result = libevtx_io_handle_free( diff --git a/tests/evtx_test_libcerror.h b/tests/evtx_test_libcerror.h index 7b7d734e..31fd9a3b 100644 --- a/tests/evtx_test_libcerror.h +++ b/tests/evtx_test_libcerror.h @@ -1,5 +1,5 @@ /* - * The internal libcerror header + * The libcerror header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/tests/evtx_test_libclocale.h b/tests/evtx_test_libclocale.h index 76cec4b0..b5e0468b 100644 --- a/tests/evtx_test_libclocale.h +++ b/tests/evtx_test_libclocale.h @@ -1,5 +1,5 @@ /* - * The internal libclocale header + * The libclocale header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/tests/evtx_test_libcnotify.h b/tests/evtx_test_libcnotify.h index 6267259b..f4bcf951 100644 --- a/tests/evtx_test_libcnotify.h +++ b/tests/evtx_test_libcnotify.h @@ -1,5 +1,5 @@ /* - * The internal libcnotify header + * The libcnotify header wrapper * * Copyright (C) 2011-2018, Joachim Metz * diff --git a/tests/evtx_test_libevtx.h b/tests/evtx_test_libevtx.h index 7868370b..3483e975 100644 --- a/tests/evtx_test_libevtx.h +++ b/tests/evtx_test_libevtx.h @@ -1,5 +1,5 @@ /* - * The internal libevtx header + * The libevtx header wrapper * * Copyright (C) 2011-2018, Joachim Metz *