Hello community, here is the log from the commit of package talloc for openSUSE:Factory checked in at 2016-11-03 11:10:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/talloc (Old) and /work/SRC/openSUSE:Factory/.talloc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "talloc" Changes: -------- --- /work/SRC/openSUSE:Factory/talloc/talloc.changes 2016-03-20 11:48:51.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.talloc.new/talloc.changes 2016-11-03 11:10:49.000000000 +0100 @@ -1,0 +2,7 @@ +Wed Sep 14 09:49:36 UTC 2016 - jmcdono...@suse.com + +- Update to version 2.1.8. + + performance improvements + + Fix memory leak when destructors reparent children; (bso#11901). + +------------------------------------------------------------------- Old: ---- talloc-2.1.6.tar.asc talloc-2.1.6.tar.gz New: ---- talloc-2.1.8.tar.asc talloc-2.1.8.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ talloc-man.spec ++++++ --- /var/tmp/diff_new_pack.7FssmP/_old 2016-11-03 11:10:51.000000000 +0100 +++ /var/tmp/diff_new_pack.7FssmP/_new 2016-11-03 11:10:51.000000000 +0100 @@ -52,7 +52,7 @@ %endif %endif # build_man Url: http://talloc.samba.org/ -Version: 2.1.6 +Version: 2.1.8 Release: 0 PreReq: /sbin/ldconfig Summary: Samba talloc Library @@ -94,8 +94,8 @@ %package -n libtalloc-devel Summary: Libraries and Header Files to Develop Programs with talloc2 Support -Group: Development/Libraries/C and C++ # Man pages are built in a 2nd spec file in order to break a build cycle with doxygen->cmake->krb5->libtalloc +Group: Development/Libraries/C and C++ %if 0%{?suse_version} > 1030 Recommends: %{name}-man %endif ++++++ talloc.spec ++++++ --- /var/tmp/diff_new_pack.7FssmP/_old 2016-11-03 11:10:51.000000000 +0100 +++ /var/tmp/diff_new_pack.7FssmP/_new 2016-11-03 11:10:51.000000000 +0100 @@ -52,7 +52,7 @@ %endif %endif # build_man Url: http://talloc.samba.org/ -Version: 2.1.6 +Version: 2.1.8 Release: 0 PreReq: /sbin/ldconfig Summary: Samba talloc Library @@ -94,8 +94,8 @@ %package -n libtalloc-devel Summary: Libraries and Header Files to Develop Programs with talloc2 Support -Group: Development/Libraries/C and C++ # Man pages are built in a 2nd spec file in order to break a build cycle with doxygen->cmake->krb5->libtalloc +Group: Development/Libraries/C and C++ %if 0%{?suse_version} > 1030 Recommends: %{name}-man %endif @@ -210,9 +210,13 @@ %if ! %{build_man} %check %if 0%{?suse_version} != 1110 || "%{_build_arch}" == x86_64 +%if "%{qemu_user_space_build}" == "1" +echo "skipping test on qemu userspace build due to AT_RANDOM not changing" +%else # qemu_user_space_build == 1 mkdir lib/talloc ln test_magic_differs* lib/talloc/ LD_LIBRARY_PATH=bin/shared %{__make} test +%endif # qemu_user_space_build == 1 %endif # suse_version != 1110; fails for i586 and ppc64 %endif # ! build_man ++++++ talloc-2.1.6.tar.gz -> talloc-2.1.8.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/pytalloc-util-2.1.7.sigs new/talloc-2.1.8/ABI/pytalloc-util-2.1.7.sigs --- old/talloc-2.1.6/ABI/pytalloc-util-2.1.7.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/pytalloc-util-2.1.7.sigs 2016-05-06 09:57:23.000000000 +0200 @@ -0,0 +1,13 @@ +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_CObject_FromTallocPtr: PyObject *(void *) +pytalloc_Check: int (PyObject *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/pytalloc-util-2.1.8.sigs new/talloc-2.1.8/ABI/pytalloc-util-2.1.8.sigs --- old/talloc-2.1.6/ABI/pytalloc-util-2.1.8.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/pytalloc-util-2.1.8.sigs 2016-07-28 09:19:25.000000000 +0200 @@ -0,0 +1,13 @@ +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_CObject_FromTallocPtr: PyObject *(void *) +pytalloc_Check: int (PyObject *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/pytalloc-util.py3-2.1.7.sigs new/talloc-2.1.8/ABI/pytalloc-util.py3-2.1.7.sigs --- old/talloc-2.1.6/ABI/pytalloc-util.py3-2.1.7.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/pytalloc-util.py3-2.1.7.sigs 2016-05-06 09:57:23.000000000 +0200 @@ -0,0 +1,12 @@ +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/pytalloc-util.py3-2.1.8.sigs new/talloc-2.1.8/ABI/pytalloc-util.py3-2.1.8.sigs --- old/talloc-2.1.6/ABI/pytalloc-util.py3-2.1.8.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/pytalloc-util.py3-2.1.8.sigs 2016-07-28 09:19:25.000000000 +0200 @@ -0,0 +1,12 @@ +_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *) +_pytalloc_get_ptr: void *(PyObject *) +_pytalloc_get_type: void *(PyObject *, const char *) +pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *) +pytalloc_BaseObject_check: int (PyObject *) +pytalloc_BaseObject_size: size_t (void) +pytalloc_Check: int (PyObject *) +pytalloc_GetBaseObjectType: PyTypeObject *(void) +pytalloc_GetObjectType: PyTypeObject *(void) +pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) +pytalloc_steal: PyObject *(PyTypeObject *, void *) +pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/talloc-2.1.7.sigs new/talloc-2.1.8/ABI/talloc-2.1.7.sigs --- old/talloc-2.1.6/ABI/talloc-2.1.7.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/talloc-2.1.7.sigs 2016-05-06 09:57:23.000000000 +0200 @@ -0,0 +1,65 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/ABI/talloc-2.1.8.sigs new/talloc-2.1.8/ABI/talloc-2.1.8.sigs --- old/talloc-2.1.6/ABI/talloc-2.1.8.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/ABI/talloc-2.1.8.sigs 2016-07-28 09:19:25.000000000 +0200 @@ -0,0 +1,65 @@ +_talloc: void *(const void *, size_t) +_talloc_array: void *(const void *, size_t, unsigned int, const char *) +_talloc_free: int (void *, const char *) +_talloc_get_type_abort: void *(const void *, const char *, const char *) +_talloc_memdup: void *(const void *, const void *, size_t, const char *) +_talloc_move: void *(const void *, const void *) +_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t) +_talloc_realloc: void *(const void *, void *, size_t, const char *) +_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *) +_talloc_reference_loc: void *(const void *, const void *, const char *) +_talloc_set_destructor: void (const void *, int (*)(void *)) +_talloc_steal_loc: void *(const void *, const void *, const char *) +_talloc_zero: void *(const void *, size_t, const char *) +_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *) +talloc_asprintf: char *(const void *, const char *, ...) +talloc_asprintf_append: char *(char *, const char *, ...) +talloc_asprintf_append_buffer: char *(char *, const char *, ...) +talloc_autofree_context: void *(void) +talloc_check_name: void *(const void *, const char *) +talloc_disable_null_tracking: void (void) +talloc_enable_leak_report: void (void) +talloc_enable_leak_report_full: void (void) +talloc_enable_null_tracking: void (void) +talloc_enable_null_tracking_no_autofree: void (void) +talloc_find_parent_byname: void *(const void *, const char *) +talloc_free_children: void (void *) +talloc_get_name: const char *(const void *) +talloc_get_size: size_t (const void *) +talloc_increase_ref_count: int (const void *) +talloc_init: void *(const char *, ...) +talloc_is_parent: int (const void *, const void *) +talloc_named: void *(const void *, size_t, const char *, ...) +talloc_named_const: void *(const void *, size_t, const char *) +talloc_parent: void *(const void *) +talloc_parent_name: const char *(const void *) +talloc_pool: void *(const void *, size_t) +talloc_realloc_fn: void *(const void *, void *, size_t) +talloc_reference_count: size_t (const void *) +talloc_reparent: void *(const void *, const void *, const void *) +talloc_report: void (const void *, FILE *) +talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *) +talloc_report_depth_file: void (const void *, int, int, FILE *) +talloc_report_full: void (const void *, FILE *) +talloc_set_abort_fn: void (void (*)(const char *)) +talloc_set_log_fn: void (void (*)(const char *)) +talloc_set_log_stderr: void (void) +talloc_set_memlimit: int (const void *, size_t) +talloc_set_name: const char *(const void *, const char *, ...) +talloc_set_name_const: void (const void *, const char *) +talloc_show_parents: void (const void *, FILE *) +talloc_strdup: char *(const void *, const char *) +talloc_strdup_append: char *(char *, const char *) +talloc_strdup_append_buffer: char *(char *, const char *) +talloc_strndup: char *(const void *, const char *, size_t) +talloc_strndup_append: char *(char *, const char *, size_t) +talloc_strndup_append_buffer: char *(char *, const char *, size_t) +talloc_test_get_magic: int (void) +talloc_total_blocks: size_t (const void *) +talloc_total_size: size_t (const void *) +talloc_unlink: int (const void *, void *) +talloc_vasprintf: char *(const void *, const char *, va_list) +talloc_vasprintf_append: char *(char *, const char *, va_list) +talloc_vasprintf_append_buffer: char *(char *, const char *, va_list) +talloc_version_major: int (void) +talloc_version_minor: int (void) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/buildtools/wafsamba/samba_autoconf.py new/talloc-2.1.8/buildtools/wafsamba/samba_autoconf.py --- old/talloc-2.1.6/buildtools/wafsamba/samba_autoconf.py 2015-12-10 12:01:40.000000000 +0100 +++ new/talloc-2.1.8/buildtools/wafsamba/samba_autoconf.py 2016-07-28 09:17:50.000000000 +0200 @@ -725,6 +725,7 @@ if Options.options.picky_developer: conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Werror -Wno-error=deprecated-declarations', testflags=True) + conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=tautological-compare', testflags=True) if Options.options.fatal_errors: conf.ADD_CFLAGS('-Wfatal-errors', testflags=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/buildtools/wafsamba/wscript new/talloc-2.1.8/buildtools/wafsamba/wscript --- old/talloc-2.1.6/buildtools/wafsamba/wscript 2016-02-19 22:02:02.000000000 +0100 +++ new/talloc-2.1.8/buildtools/wafsamba/wscript 2016-04-11 20:30:31.000000000 +0200 @@ -402,6 +402,22 @@ addmain=False, msg='Checking for library destructor support') + conf.CHECK_CODE(''' + void test_attribute(void) __attribute__ (()); + + void test_attribute(void) + { + return; + } + + int main(void) { + return 0; + } + ''', + 'HAVE___ATTRIBUTE__', + addmain=False, + msg='Checking for __attribute__') + if sys.platform.startswith('aix'): conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True) # Might not be needed if ALL_SOURCE is defined diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/closefrom.c new/talloc-2.1.8/lib/replace/closefrom.c --- old/talloc-2.1.6/lib/replace/closefrom.c 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.8/lib/replace/closefrom.c 2016-07-28 09:17:50.000000000 +0200 @@ -0,0 +1,138 @@ +/* + * Unix SMB/CIFS implementation. + * Samba utility functions + * Copyright (C) Volker Lendecke 2016 + * + * ** NOTE! The following LGPL license applies to the replace + * ** library. This does NOT imply that all of Samba is released + * ** under the LGPL + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. + */ + +#include "replace.h" +#include <dirent.h> +#include <unistd.h> +#include <limits.h> + +static int closefrom_sysconf(int lower) +{ + long max_files, fd; + + max_files = sysconf(_SC_OPEN_MAX); + if (max_files == -1) { + max_files = 65536; + } + + for (fd=lower; fd<max_files; fd++) { + close(fd); + } + + return 0; +} + +static int closefrom_procfs(int lower) +{ + DIR *dirp; + int dir_fd; + struct dirent *dp; + int *fds = NULL; + size_t num_fds = 0; + size_t fd_array_size = 0; + size_t i; + int ret = ENOMEM; + + dirp = opendir("/proc/self/fd"); + if (dirp == 0) { + return errno; + } + + dir_fd = dirfd(dirp); + if (dir_fd == -1) { + ret = errno; + goto fail; + } + + while ((dp = readdir(dirp)) != NULL) { + char *endptr; + unsigned long long fd; + + errno = 0; + + fd = strtoull(dp->d_name, &endptr, 10); + if ((fd == 0) && (errno == EINVAL)) { + continue; + } + if ((fd == ULLONG_MAX) && (errno == ERANGE)) { + continue; + } + if (*endptr != '\0') { + continue; + } + if (fd == dir_fd) { + continue; + } + if (fd > INT_MAX) { + continue; + } + if (fd < lower) { + continue; + } + + if (num_fds >= (fd_array_size / sizeof(int))) { + void *tmp; + + if (fd_array_size == 0) { + fd_array_size = 16 * sizeof(int); + } else { + if (fd_array_size + fd_array_size < + fd_array_size) { + /* overflow */ + goto fail; + } + fd_array_size = fd_array_size + fd_array_size; + } + + tmp = realloc(fds, fd_array_size); + if (tmp == NULL) { + goto fail; + } + fds = tmp; + } + + fds[num_fds++] = fd; + } + + for (i=0; i<num_fds; i++) { + close(fds[i]); + } + + ret = 0; +fail: + closedir(dirp); + free(fds); + return ret; +} + +int rep_closefrom(int lower) +{ + int ret; + + ret = closefrom_procfs(lower); + if (ret == 0) { + return 0; + } + + return closefrom_sysconf(lower); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/replace.h new/talloc-2.1.8/lib/replace/replace.h --- old/talloc-2.1.6/lib/replace/replace.h 2015-08-04 10:58:20.000000000 +0200 +++ new/talloc-2.1.8/lib/replace/replace.h 2016-07-28 09:17:50.000000000 +0200 @@ -247,6 +247,12 @@ size_t rep_strlcat(char *d, const char *s, size_t bufsize); #endif +#ifndef HAVE_CLOSEFROM +#define closefrom rep_closefrom +int rep_closefrom(int lower); +#endif + + #if (defined(BROKEN_STRNDUP) || !defined(HAVE_STRNDUP)) #undef HAVE_STRNDUP #define strndup rep_strndup @@ -425,7 +431,7 @@ #endif #ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ /** Use gcc attribute to check printf fns. a1 is the 1-based index of * the parameter containing the format, and a2 the index of the first * argument. Note that some gcc 2.x versions don't handle this @@ -437,7 +443,7 @@ #endif #ifndef _DEPRECATED_ -#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1 ) +#ifdef HAVE___ATTRIBUTE__ #define _DEPRECATED_ __attribute__ ((deprecated)) #else #define _DEPRECATED_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/snprintf.c new/talloc-2.1.8/lib/replace/snprintf.c --- old/talloc-2.1.6/lib/replace/snprintf.c 2015-02-27 09:40:16.000000000 +0100 +++ new/talloc-2.1.8/lib/replace/snprintf.c 2016-07-28 09:17:50.000000000 +0200 @@ -804,7 +804,7 @@ { int signvalue = 0; unsigned LLONG uvalue; - char convert[20]; + char convert[22+1]; /* 64-bit value in octal: 22 digits + \0 */ int place = 0; int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ @@ -834,8 +834,8 @@ (caps? "0123456789ABCDEF":"0123456789abcdef") [uvalue % (unsigned)base ]; uvalue = (uvalue / (unsigned)base ); - } while(uvalue && (place < 20)); - if (place == 20) place--; + } while(uvalue && (place < sizeof(convert))); + if (place == sizeof(convert)) place--; convert[place] = 0; zpadlen = max - place; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/system/wait.h new/talloc-2.1.8/lib/replace/system/wait.h --- old/talloc-2.1.6/lib/replace/system/wait.h 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.8/lib/replace/system/wait.h 2016-04-11 20:30:31.000000000 +0200 @@ -49,7 +49,7 @@ #endif #if !defined(HAVE_WAITPID) && defined(HAVE_WAIT4) -int rep_waitpid(pid_t pid,int *status,int options) +int rep_waitpid(pid_t pid,int *status,int options); #endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/test/testsuite.c new/talloc-2.1.8/lib/replace/test/testsuite.c --- old/talloc-2.1.6/lib/replace/test/testsuite.c 2015-06-13 03:00:10.000000000 +0200 +++ new/talloc-2.1.8/lib/replace/test/testsuite.c 2016-07-28 09:17:50.000000000 +0200 @@ -1063,6 +1063,38 @@ return true; } +static bool test_closefrom(void) +{ + int i, fd; + + for (i=0; i<100; i++) { + fd = dup(0); + if (fd == -1) { + perror("dup failed"); + return false; + } + + /* 1000 is just an arbitrarily chosen upper bound */ + + if (fd >= 1000) { + printf("fd=%d\n", fd); + return false; + } + } + + closefrom(3); + + for (i=3; i<=fd; i++) { + off_t off; + off = lseek(i, 0, SEEK_CUR); + if ((off != (off_t)-1) || (errno != EBADF)) { + printf("fd %d not closed\n", i); + return false; + } + } + + return true; +} bool torture_local_replace(struct torture_context *ctx) { @@ -1113,6 +1145,7 @@ ret &= test_utime(); ret &= test_utimes(); ret &= test_memmem(); + ret &= test_closefrom(); return ret; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/lib/replace/wscript new/talloc-2.1.8/lib/replace/wscript --- old/talloc-2.1.6/lib/replace/wscript 2015-12-10 12:01:40.000000000 +0100 +++ new/talloc-2.1.8/lib/replace/wscript 2016-07-28 09:17:50.000000000 +0200 @@ -202,23 +202,15 @@ # Check for atomic builtins. */ conf.CHECK_CODE(''' - int main(void) { - int i; - (void)__sync_fetch_and_add(&i, 1); - return 0; - } + int i; + (void)__sync_fetch_and_add(&i, 1); ''', 'HAVE___SYNC_FETCH_AND_ADD', msg='Checking for __sync_fetch_and_add compiler builtin') conf.CHECK_CODE(''' - #include <stdint.h> - #include <sys/atomic.h> - int main(void) { - int32_t i; - atomic_add_32(&i, 1); - return 0; - } + int32_t i; + atomic_add_32(&i, 1); ''', 'HAVE_ATOMIC_ADD_32', headers='stdint.h sys/atomic.h', @@ -265,6 +257,9 @@ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') + if not conf.CHECK_FUNCS('closefrom'): + conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') + conf.CHECK_CODE(''' struct ucred cred; socklen_t cred_len; @@ -691,6 +686,9 @@ if not bld.CONFIG_SET('HAVE_GETXATTR') or bld.CONFIG_SET('XATTR_ADDITIONAL_OPTIONS'): REPLACE_SOURCE += ' xattr.c' + if not bld.CONFIG_SET('HAVE_CLOSEFROM'): + REPLACE_SOURCE += ' closefrom.c' + bld.SAMBA_LIBRARY('replace', source=REPLACE_SOURCE, group='base_libraries', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/pytalloc.c new/talloc-2.1.8/pytalloc.c --- old/talloc-2.1.6/pytalloc.c 2016-03-08 14:37:39.000000000 +0100 +++ new/talloc-2.1.8/pytalloc.c 2016-07-28 09:17:50.000000000 +0200 @@ -166,7 +166,7 @@ pytalloc_BaseObject *talloc_obj = (pytalloc_BaseObject *)obj; PyTypeObject *type = (PyTypeObject*)PyObject_Type(obj); - return PyStr_FromFormat("<%s talloc based object at 0x%p>", + return PyStr_FromFormat("<%s talloc based object at %p>", type->tp_name, talloc_obj->ptr); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/pytalloc_guide.txt new/talloc-2.1.8/pytalloc_guide.txt --- old/talloc-2.1.6/pytalloc_guide.txt 2016-03-08 14:37:39.000000000 +0100 +++ new/talloc-2.1.8/pytalloc_guide.txt 2016-07-28 09:17:50.000000000 +0200 @@ -182,6 +182,8 @@ reporting on exit. Useful for when you want to do your own leak reporting call via talloc_report_null_full(). +This must be done in the top level script, not an imported module. + =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- pytalloc_total_blocks(obj?) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/talloc.c new/talloc-2.1.8/talloc.c --- old/talloc-2.1.6/talloc.c 2015-11-06 14:25:52.000000000 +0100 +++ new/talloc-2.1.8/talloc.c 2016-07-28 09:17:50.000000000 +0200 @@ -250,9 +250,13 @@ size_t size); static inline void talloc_memlimit_shrink(struct talloc_memlimit *limit, size_t size); -static inline void talloc_memlimit_update_on_free(struct talloc_chunk *tc); +static inline void tc_memlimit_update_on_free(struct talloc_chunk *tc); -static inline void _talloc_set_name_const(const void *ptr, const char *name); +static inline void _tc_set_name_const(struct talloc_chunk *tc, + const char *name); +static struct talloc_chunk *_vasprintf_tc(const void *t, + const char *fmt, + va_list ap); typedef int (*talloc_destructor_t)(void *); @@ -572,7 +576,7 @@ Allocate from a pool */ -static inline struct talloc_chunk *talloc_alloc_pool(struct talloc_chunk *parent, +static inline struct talloc_chunk *tc_alloc_pool(struct talloc_chunk *parent, size_t size, size_t prefix_len) { struct talloc_pool_hdr *pool_hdr = NULL; @@ -625,12 +629,15 @@ /* Allocate a bit of memory as a child of an existing pointer */ -static inline void *__talloc_with_prefix(const void *context, size_t size, - size_t prefix_len) +static inline void *__talloc_with_prefix(const void *context, + size_t size, + size_t prefix_len, + struct talloc_chunk **tc_ret) { struct talloc_chunk *tc = NULL; struct talloc_memlimit *limit = NULL; size_t total_len = TC_HDR_SIZE + size + prefix_len; + struct talloc_chunk *parent = NULL; if (unlikely(context == NULL)) { context = null_context; @@ -644,14 +651,14 @@ return NULL; } - if (context != NULL) { - struct talloc_chunk *ptc = talloc_chunk_from_ptr(context); + if (likely(context != NULL)) { + parent = talloc_chunk_from_ptr(context); - if (ptc->limit != NULL) { - limit = ptc->limit; + if (parent->limit != NULL) { + limit = parent->limit; } - tc = talloc_alloc_pool(ptc, TC_HDR_SIZE+size, prefix_len); + tc = tc_alloc_pool(parent, TC_HDR_SIZE+size, prefix_len); } if (tc == NULL) { @@ -683,9 +690,7 @@ tc->name = NULL; tc->refs = NULL; - if (likely(context)) { - struct talloc_chunk *parent = talloc_chunk_from_ptr(context); - + if (likely(context != NULL)) { if (parent->child) { parent->child->parent = NULL; tc->next = parent->child; @@ -700,12 +705,15 @@ tc->next = tc->prev = tc->parent = NULL; } + *tc_ret = tc; return TC_PTR_FROM_CHUNK(tc); } -static inline void *__talloc(const void *context, size_t size) +static inline void *__talloc(const void *context, + size_t size, + struct talloc_chunk **tc) { - return __talloc_with_prefix(context, size, 0); + return __talloc_with_prefix(context, size, 0, tc); } /* @@ -718,13 +726,12 @@ struct talloc_pool_hdr *pool_hdr; void *result; - result = __talloc_with_prefix(context, size, TP_HDR_SIZE); + result = __talloc_with_prefix(context, size, TP_HDR_SIZE, &tc); if (unlikely(result == NULL)) { return NULL; } - tc = talloc_chunk_from_ptr(result); pool_hdr = talloc_pool_from_chunk(tc); tc->flags |= TALLOC_FLAG_POOL; @@ -803,7 +810,7 @@ pool_hdr->end = ((char *)pool_hdr->end + TC_ALIGN16(type_size)); - _talloc_set_name_const(ret, type_name); + _tc_set_name_const(tc, type_name); return ret; overflow: @@ -849,9 +856,9 @@ more efficient way to add a name to a pointer - the name must point to a true string constant */ -static inline void _talloc_set_name_const(const void *ptr, const char *name) +static inline void _tc_set_name_const(struct talloc_chunk *tc, + const char *name) { - struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); tc->name = name; } @@ -861,13 +868,14 @@ static inline void *_talloc_named_const(const void *context, size_t size, const char *name) { void *ptr; + struct talloc_chunk *tc; - ptr = __talloc(context, size); + ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) { return NULL; } - _talloc_set_name_const(ptr, name); + _tc_set_name_const(tc, name); return ptr; } @@ -905,7 +913,7 @@ static void *_talloc_steal_internal(const void *new_ctx, const void *ptr); -static inline void _talloc_free_poolmem(struct talloc_chunk *tc, +static inline void _tc_free_poolmem(struct talloc_chunk *tc, const char *location) { struct talloc_pool_hdr *pool; @@ -956,15 +964,15 @@ pool_tc->name = location; if (pool_tc->flags & TALLOC_FLAG_POOLMEM) { - _talloc_free_poolmem(pool_tc, location); + _tc_free_poolmem(pool_tc, location); } else { /* - * The talloc_memlimit_update_on_free() + * The tc_memlimit_update_on_free() * call takes into account the * prefix TP_HDR_SIZE allocated before * the pool talloc_chunk. */ - talloc_memlimit_update_on_free(pool_tc); + tc_memlimit_update_on_free(pool_tc); TC_INVALIDATE_FULL_CHUNK(pool_tc); free(pool); } @@ -987,33 +995,20 @@ */ } -static inline void _talloc_free_children_internal(struct talloc_chunk *tc, +static inline void _tc_free_children_internal(struct talloc_chunk *tc, void *ptr, const char *location); +static inline int _talloc_free_internal(void *ptr, const char *location); + /* - internal talloc_free call + internal free call that takes a struct talloc_chunk *. */ -static inline int _talloc_free_internal(void *ptr, const char *location) +static inline int _tc_free_internal(struct talloc_chunk *tc, + const char *location) { - struct talloc_chunk *tc; void *ptr_to_free; - - if (unlikely(ptr == NULL)) { - return -1; - } - - /* possibly initialised the talloc fill value */ - if (unlikely(!talloc_fill.initialised)) { - const char *fill = getenv(TALLOC_FILL_ENV); - if (fill != NULL) { - talloc_fill.enabled = true; - talloc_fill.fill_value = strtoul(fill, NULL, 0); - } - talloc_fill.initialised = true; - } - - tc = talloc_chunk_from_ptr(ptr); + void *ptr = TC_PTR_FROM_CHUNK(tc); if (unlikely(tc->refs)) { int is_child; @@ -1039,6 +1034,20 @@ if (unlikely(tc->destructor)) { talloc_destructor_t d = tc->destructor; + + /* + * Protect the destructor against some overwrite + * attacks, by explicitly checking it has the right + * magic here. + */ + if (talloc_chunk_from_ptr(ptr) != tc) { + /* + * This can't actually happen, the + * call itself will panic. + */ + TALLOC_ABORT("talloc_chunk_from_ptr failed!"); + } + if (d == (talloc_destructor_t)-1) { return -1; } @@ -1069,7 +1078,7 @@ tc->flags |= TALLOC_FLAG_LOOP; - _talloc_free_children_internal(tc, ptr, location); + _tc_free_children_internal(tc, ptr, location); tc->flags |= TALLOC_FLAG_FREE; @@ -1106,17 +1115,42 @@ } if (tc->flags & TALLOC_FLAG_POOLMEM) { - _talloc_free_poolmem(tc, location); + _tc_free_poolmem(tc, location); return 0; } - talloc_memlimit_update_on_free(tc); + tc_memlimit_update_on_free(tc); TC_INVALIDATE_FULL_CHUNK(tc); free(ptr_to_free); return 0; } +/* + internal talloc_free call +*/ +static inline int _talloc_free_internal(void *ptr, const char *location) +{ + struct talloc_chunk *tc; + + if (unlikely(ptr == NULL)) { + return -1; + } + + /* possibly initialised the talloc fill value */ + if (unlikely(!talloc_fill.initialised)) { + const char *fill = getenv(TALLOC_FILL_ENV); + if (fill != NULL) { + talloc_fill.enabled = true; + talloc_fill.fill_value = strtoul(fill, NULL, 0); + } + talloc_fill.initialised = true; + } + + tc = talloc_chunk_from_ptr(ptr); + return _tc_free_internal(tc, location); +} + static inline size_t _talloc_total_limit_size(const void *ptr, struct talloc_memlimit *old_limit, struct talloc_memlimit *new_limit); @@ -1359,14 +1393,22 @@ /* add a name to an existing pointer - va_list version */ -static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(2,0); - -static inline const char *talloc_set_name_v(const void *ptr, const char *fmt, va_list ap) -{ - struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); - tc->name = talloc_vasprintf(ptr, fmt, ap); - if (likely(tc->name)) { - _talloc_set_name_const(tc->name, ".name"); +static inline const char *tc_set_name_v(struct talloc_chunk *tc, + const char *fmt, + va_list ap) PRINTF_ATTRIBUTE(2,0); + +static inline const char *tc_set_name_v(struct talloc_chunk *tc, + const char *fmt, + va_list ap) +{ + struct talloc_chunk *name_tc = _vasprintf_tc(TC_PTR_FROM_CHUNK(tc), + fmt, + ap); + if (likely(name_tc)) { + tc->name = TC_PTR_FROM_CHUNK(name_tc); + _tc_set_name_const(name_tc, ".name"); + } else { + tc->name = NULL; } return tc->name; } @@ -1376,10 +1418,11 @@ */ _PUBLIC_ const char *talloc_set_name(const void *ptr, const char *fmt, ...) { + struct talloc_chunk *tc = talloc_chunk_from_ptr(ptr); const char *name; va_list ap; va_start(ap, fmt); - name = talloc_set_name_v(ptr, fmt, ap); + name = tc_set_name_v(tc, fmt, ap); va_end(ap); return name; } @@ -1395,12 +1438,13 @@ va_list ap; void *ptr; const char *name; + struct talloc_chunk *tc; - ptr = __talloc(context, size); + ptr = __talloc(context, size, &tc); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); - name = talloc_set_name_v(ptr, fmt, ap); + name = tc_set_name_v(tc, fmt, ap); va_end(ap); if (unlikely(name == NULL)) { @@ -1490,12 +1534,13 @@ va_list ap; void *ptr; const char *name; + struct talloc_chunk *tc; - ptr = __talloc(NULL, 0); + ptr = __talloc(NULL, 0, &tc); if (unlikely(ptr == NULL)) return NULL; va_start(ap, fmt); - name = talloc_set_name_v(ptr, fmt, ap); + name = tc_set_name_v(tc, fmt, ap); va_end(ap); if (unlikely(name == NULL)) { @@ -1506,7 +1551,7 @@ return ptr; } -static inline void _talloc_free_children_internal(struct talloc_chunk *tc, +static inline void _tc_free_children_internal(struct talloc_chunk *tc, void *ptr, const char *location) { @@ -1522,13 +1567,13 @@ struct talloc_chunk *p = talloc_parent_chunk(tc->child->refs); if (p) new_parent = TC_PTR_FROM_CHUNK(p); } - if (unlikely(_talloc_free_internal(child, location) == -1)) { + if (unlikely(_tc_free_internal(tc->child, location) == -1)) { if (talloc_parent_chunk(child) != tc) { /* * Destructor already reparented this child. * No further reparenting needed. */ - return; + continue; } if (new_parent == null_context) { struct talloc_chunk *p = talloc_parent_chunk(ptr); @@ -1568,7 +1613,7 @@ } } - _talloc_free_children_internal(tc, ptr, __location__); + _tc_free_children_internal(tc, ptr, __location__); /* .. so we put it back after all other children have been freed */ if (tc_name) { @@ -1585,7 +1630,8 @@ */ _PUBLIC_ void *_talloc(const void *context, size_t size) { - return __talloc(context, size); + struct talloc_chunk *tc; + return __talloc(context, size, &tc); } /* @@ -1593,7 +1639,7 @@ */ _PUBLIC_ void talloc_set_name_const(const void *ptr, const char *name) { - _talloc_set_name_const(ptr, name); + _tc_set_name_const(talloc_chunk_from_ptr(ptr), name); } /* @@ -1742,7 +1788,7 @@ #if ALWAYS_REALLOC if (pool_hdr) { - new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE, 0); + new_ptr = tc_alloc_pool(tc, size + TC_HDR_SIZE, 0); pool_hdr->object_count--; if (new_ptr == NULL) { @@ -1859,7 +1905,7 @@ } } - new_ptr = talloc_alloc_pool(tc, size + TC_HDR_SIZE, 0); + new_ptr = tc_alloc_pool(tc, size + TC_HDR_SIZE, 0); if (new_ptr == NULL) { new_ptr = malloc(TC_HDR_SIZE+size); @@ -1870,7 +1916,7 @@ if (new_ptr) { memcpy(new_ptr, tc, MIN(tc->size,size) + TC_HDR_SIZE); - _talloc_free_poolmem(tc, __location__ "_talloc_realloc"); + _tc_free_poolmem(tc, __location__ "_talloc_realloc"); } } else { @@ -1912,7 +1958,7 @@ } tc->size = size; - _talloc_set_name_const(TC_PTR_FROM_CHUNK(tc), name); + _tc_set_name_const(tc, name); return TC_PTR_FROM_CHUNK(tc); } @@ -2295,14 +2341,15 @@ static inline char *__talloc_strlendup(const void *t, const char *p, size_t len) { char *ret; + struct talloc_chunk *tc; - ret = (char *)__talloc(t, len + 1); + ret = (char *)__talloc(t, len + 1, &tc); if (unlikely(!ret)) return NULL; memcpy(ret, p, len); ret[len] = 0; - _talloc_set_name_const(ret, ret); + _tc_set_name_const(tc, ret); return ret; } @@ -2336,7 +2383,7 @@ memcpy(&ret[slen], a, alen); ret[slen+alen] = 0; - _talloc_set_name_const(ret, ret); + _tc_set_name_const(talloc_chunk_from_ptr(ret), ret); return ret; } @@ -2428,11 +2475,14 @@ #endif #endif -_PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) +static struct talloc_chunk *_vasprintf_tc(const void *t, + const char *fmt, + va_list ap) { int len; char *ret; va_list ap2; + struct talloc_chunk *tc; char buf[1024]; /* this call looks strange, but it makes it work on older solaris boxes */ @@ -2443,7 +2493,7 @@ return NULL; } - ret = (char *)__talloc(t, len+1); + ret = (char *)__talloc(t, len+1, &tc); if (unlikely(!ret)) return NULL; if (len < sizeof(buf)) { @@ -2454,8 +2504,17 @@ va_end(ap2); } - _talloc_set_name_const(ret, ret); - return ret; + _tc_set_name_const(tc, ret); + return tc; +} + +_PUBLIC_ char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) +{ + struct talloc_chunk *tc = _vasprintf_tc(t, fmt, ap); + if (tc == NULL) { + return NULL; + } + return TC_PTR_FROM_CHUNK(tc); } @@ -2506,7 +2565,7 @@ vsnprintf(s + slen, alen + 1, fmt, ap2); va_end(ap2); - _talloc_set_name_const(s, s); + _tc_set_name_const(talloc_chunk_from_ptr(s), s); return s; } @@ -2772,7 +2831,7 @@ /* Update memory limits when freeing a talloc_chunk. */ -static void talloc_memlimit_update_on_free(struct talloc_chunk *tc) +static void tc_memlimit_update_on_free(struct talloc_chunk *tc) { size_t limit_shrink_size; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/testsuite.c new/talloc-2.1.8/testsuite.c --- old/talloc-2.1.6/testsuite.c 2015-11-06 14:25:52.000000000 +0100 +++ new/talloc-2.1.8/testsuite.c 2016-07-28 09:17:50.000000000 +0200 @@ -36,16 +36,16 @@ #include "talloc_testsuite.h" -static struct timeval timeval_current(void) +static struct timeval private_timeval_current(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv; } -static double timeval_elapsed(struct timeval *tv) +static double private_timeval_elapsed(struct timeval *tv) { - struct timeval tv2 = timeval_current(); + struct timeval tv2 = private_timeval_current(); return (tv2.tv_sec - tv->tv_sec) + (tv2.tv_usec - tv->tv_usec)*1.0e-6; } @@ -835,7 +835,7 @@ printf("test: speed\n# TALLOC VS MALLOC SPEED\n"); - tv = timeval_current(); + tv = private_timeval_current(); count = 0; do { void *p1, *p2, *p3; @@ -848,15 +848,15 @@ talloc_free(p1); } count += 3 * loop; - } while (timeval_elapsed(&tv) < 5.0); + } while (private_timeval_elapsed(&tv) < 5.0); - fprintf(stderr, "talloc: %.0f ops/sec\n", count/timeval_elapsed(&tv)); + fprintf(stderr, "talloc: %.0f ops/sec\n", count/private_timeval_elapsed(&tv)); talloc_free(ctx); ctx = talloc_pool(NULL, 1024); - tv = timeval_current(); + tv = private_timeval_current(); count = 0; do { void *p1, *p2, *p3; @@ -869,13 +869,13 @@ talloc_free(p1); } count += 3 * loop; - } while (timeval_elapsed(&tv) < 5.0); + } while (private_timeval_elapsed(&tv) < 5.0); talloc_free(ctx); - fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/timeval_elapsed(&tv)); + fprintf(stderr, "talloc_pool: %.0f ops/sec\n", count/private_timeval_elapsed(&tv)); - tv = timeval_current(); + tv = private_timeval_current(); count = 0; do { void *p1, *p2, *p3; @@ -888,8 +888,8 @@ free(p3); } count += 3 * loop; - } while (timeval_elapsed(&tv) < 5.0); - fprintf(stderr, "malloc: %.0f ops/sec\n", count/timeval_elapsed(&tv)); + } while (private_timeval_elapsed(&tv) < 5.0); + fprintf(stderr, "malloc: %.0f ops/sec\n", count/private_timeval_elapsed(&tv)); printf("success: speed\n"); @@ -1795,11 +1795,11 @@ * They will use their own toplevel contexts. */ for (i = 0; i < NUM_THREADS; i++) { - (void)snprintf(str_array[i], - 20, - "thread:%d", - i); - if (str_array[i] == NULL) { + ret = snprintf(str_array[i], + 20, + "thread:%d", + i); + if (ret < 0) { printf("snprintf %d failed\n", i); return false; } @@ -1865,6 +1865,11 @@ } } +static int test_magic_protection_destructor(int *ptr) +{ + _exit(404); /* Not 42 */ +} + static bool test_magic_protection(void) { void *pool = talloc_pool(NULL, 1024); @@ -1883,6 +1888,7 @@ pid = fork(); if (pid == 0) { talloc_set_abort_fn(test_magic_protection_abort); + talloc_set_destructor(p2, test_magic_protection_destructor); /* * Simulate a security attack diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.6/wscript new/talloc-2.1.8/wscript --- old/talloc-2.1.6/wscript 2016-03-08 14:37:39.000000000 +0100 +++ new/talloc-2.1.8/wscript 2016-07-28 09:19:25.000000000 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.1.6' +VERSION = '2.1.8' blddir = 'bin'