Hello community, here is the log from the commit of package talloc for openSUSE:Factory checked in at 2017-04-17 10:22:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/talloc (Old) and /work/SRC/openSUSE:Factory/.talloc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "talloc" Mon Apr 17 10:22:00 2017 rev:28 rq:487099 version:2.1.9 Changes: -------- --- /work/SRC/openSUSE:Factory/talloc/talloc-man.changes 2016-03-20 11:48:51.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.talloc.new/talloc-man.changes 2017-04-17 10:22:06.413939604 +0200 @@ -1,0 +2,17 @@ +Wed Mar 22 16:51:46 UTC 2017 - jmcdono...@suse.com + +- Update to version 2.1.9; (bsc#1032915). + + fix some coverity defects + + fix TALLOC_VERSION_MINOR and talloc_version_minor() + + add new tests + + add pytalloc_get_type() + + add pytalloc_GenericObject_{steal,reference}[_ex]() + +------------------------------------------------------------------- +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). + +------------------------------------------------------------------- --- /work/SRC/openSUSE:Factory/talloc/talloc.changes 2016-11-03 11:10:49.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.talloc.new/talloc.changes 2017-04-17 10:22:06.473931107 +0200 @@ -1,0 +2,16 @@ +Thu Mar 23 20:45:20 UTC 2017 - jmcdono...@suse.com + +- sle11-remove-unknown-compiler-options.patch: build SLE11 and earlier + without -Wno-format-length. + +------------------------------------------------------------------- +Wed Mar 22 16:51:46 UTC 2017 - jmcdono...@suse.com + +- Update to version 2.1.9; (bsc#1032915). + + fix some coverity defects + + fix TALLOC_VERSION_MINOR and talloc_version_minor() + + add new tests + + add pytalloc_get_type() + + add pytalloc_GenericObject_{steal,reference}[_ex]() + +------------------------------------------------------------------- @@ -29,0 +46,5 @@ + +------------------------------------------------------------------- +Fri Feb 12 17:03:57 UTC 2016 - lmue...@suse.com + +- Provide python-talloc and python-talloc-devel; (bsc#966523). Old: ---- talloc-2.1.8.tar.asc talloc-2.1.8.tar.gz New: ---- sle11-remove-unknown-compiler-options.patch talloc-2.1.9.tar.asc talloc-2.1.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ talloc-man.spec ++++++ --- /var/tmp/diff_new_pack.f4G1IT/_old 2017-04-17 10:22:07.289815560 +0200 +++ /var/tmp/diff_new_pack.f4G1IT/_new 2017-04-17 10:22:07.289815560 +0200 @@ -1,7 +1,7 @@ # # spec file for package talloc-man # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -52,14 +52,14 @@ %endif %endif # build_man Url: http://talloc.samba.org/ -Version: 2.1.8 +Version: 2.1.9 Release: 0 PreReq: /sbin/ldconfig Summary: Samba talloc Library License: LGPL-3.0+ Group: System/Libraries -Source: http://download.samba.org/pub/talloc/talloc-%{version}.tar.gz -Source1: http://download.samba.org/pub/talloc/talloc-%{version}.tar.asc +Source: https://download.samba.org/pub/talloc/talloc-%{version}.tar.gz +Source1: https://download.samba.org/pub/talloc/talloc-%{version}.tar.asc Source4: baselibs.conf Patch0: talloc-python3.5-fix-soabi_name.patch Source50: talloc.keyring @@ -94,8 +94,8 @@ %package -n libtalloc-devel Summary: Libraries and Header Files to Develop Programs with talloc2 Support -# 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++ +# Man pages are built in a 2nd spec file in order to break a build cycle with doxygen->cmake->krb5->libtalloc %if 0%{?suse_version} > 1030 Recommends: %{name}-man %endif ++++++ talloc.spec ++++++ --- /var/tmp/diff_new_pack.f4G1IT/_old 2017-04-17 10:22:07.313812162 +0200 +++ /var/tmp/diff_new_pack.f4G1IT/_new 2017-04-17 10:22:07.317811595 +0200 @@ -1,7 +1,7 @@ # # spec file for package talloc-man # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -52,7 +52,7 @@ %endif %endif # build_man Url: http://talloc.samba.org/ -Version: 2.1.8 +Version: 2.1.9 Release: 0 PreReq: /sbin/ldconfig Summary: Samba talloc Library @@ -62,6 +62,7 @@ Source1: http://download.samba.org/pub/talloc/talloc-%{version}.tar.asc Source4: baselibs.conf Patch0: talloc-python3.5-fix-soabi_name.patch +Patch1: sle11-remove-unknown-compiler-options.patch Source50: talloc.keyring BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -94,8 +95,8 @@ %package -n libtalloc-devel Summary: Libraries and Header Files to Develop Programs with talloc2 Support -# 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++ +# Man pages are built in a 2nd spec file in order to break a build cycle with doxygen->cmake->krb5->libtalloc %if 0%{?suse_version} > 1030 Recommends: %{name}-man %endif @@ -175,6 +176,9 @@ %prep %setup -n talloc-%{version} -q %patch0 -p1 +%if 0%{?suse_version} < 1200 +%patch1 -p1 +%endif %build %if ! %{build_man} ++++++ sle11-remove-unknown-compiler-options.patch ++++++ Index: talloc-2.1.9/lib/replace/wscript =================================================================== --- talloc-2.1.9.orig/lib/replace/wscript +++ talloc-2.1.9/lib/replace/wscript @@ -706,8 +706,7 @@ def build(bld): bld.SAMBA_SUBSYSTEM('replace-test', source='''test/testsuite.c test/strptime.c test/os2_delete.c test/getifaddrs.c''', - deps='replace', - cflags="-Wno-format-length") + deps='replace') if bld.env.standalone_replace: bld.SAMBA_BINARY('replace_testsuite', ++++++ talloc-2.1.8.tar.gz -> talloc-2.1.9.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/ABI/pytalloc-util-2.1.9.sigs new/talloc-2.1.9/ABI/pytalloc-util-2.1.9.sigs --- old/talloc-2.1.8/ABI/pytalloc-util-2.1.9.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.9/ABI/pytalloc-util-2.1.9.sigs 2017-02-27 20:23:11.000000000 +0100 @@ -0,0 +1,16 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_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_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +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.8/ABI/pytalloc-util.py3-2.1.9.sigs new/talloc-2.1.9/ABI/pytalloc-util.py3-2.1.9.sigs --- old/talloc-2.1.8/ABI/pytalloc-util.py3-2.1.9.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.9/ABI/pytalloc-util.py3-2.1.9.sigs 2017-02-27 20:23:11.000000000 +0100 @@ -0,0 +1,15 @@ +_pytalloc_check_type: int (PyObject *, const char *) +_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_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *) +pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *) +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.8/ABI/talloc-2.1.9.sigs new/talloc-2.1.9/ABI/talloc-2.1.9.sigs --- old/talloc-2.1.8/ABI/talloc-2.1.9.sigs 1970-01-01 01:00:00.000000000 +0100 +++ new/talloc-2.1.9/ABI/talloc-2.1.9.sigs 2017-02-27 20:23:11.000000000 +0100 @@ -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.8/buildtools/wafsamba/samba3.py new/talloc-2.1.9/buildtools/wafsamba/samba3.py --- old/talloc-2.1.8/buildtools/wafsamba/samba3.py 2015-04-29 11:20:16.000000000 +0200 +++ new/talloc-2.1.9/buildtools/wafsamba/samba3.py 2017-02-27 20:23:11.000000000 +0100 @@ -2,37 +2,10 @@ # and for SAMBA_ macros for building libraries, binaries etc import Options, Build, os -from optparse import SUPPRESS_HELP -from samba_utils import os_path_relpath, TO_LIST +from samba_utils import os_path_relpath, TO_LIST, samba_add_onoff_option from samba_autoconf import library_flags - -def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True, - with_name="with", without_name="without"): - if default is None: - default_str = "auto" - elif default is True: - default_str = "yes" - elif default is False: - default_str = "no" - else: - default_str = str(default) - - if help == (): - help = ("Build with %s support (default=%s)" % (option, default_str)) - if dest is None: - dest = "with_%s" % option.replace('-', '_') - - with_val = "--%s-%s" % (with_name, option) - without_val = "--%s-%s" % (without_name, option) - - #FIXME: This is broken and will always default to "default" no matter if - # --with or --without is chosen. - opt.add_option(with_val, help=help, action="store_true", dest=dest, - default=default) - opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false", - dest=dest) -Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION +Options.Handler.SAMBA3_ADD_OPTION = samba_add_onoff_option def SAMBA3_IS_STATIC_MODULE(bld, module): '''Check whether module is in static list''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/buildtools/wafsamba/samba_autoconf.py new/talloc-2.1.9/buildtools/wafsamba/samba_autoconf.py --- old/talloc-2.1.8/buildtools/wafsamba/samba_autoconf.py 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/buildtools/wafsamba/samba_autoconf.py 2016-10-07 06:45:35.000000000 +0200 @@ -708,6 +708,7 @@ testflags=True) conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True) + conf.ADD_CFLAGS('-Werror=format-security -Wformat-security', testflags=True) # This check is because for ldb_search(), a NULL format string # is not an error, but some compilers complain about that. if CHECK_CFLAGS(conf, ["-Werror=format", "-Wformat=2"], ''' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/buildtools/wafsamba/samba_conftests.py new/talloc-2.1.9/buildtools/wafsamba/samba_conftests.py --- old/talloc-2.1.8/buildtools/wafsamba/samba_conftests.py 2015-12-10 12:01:40.000000000 +0100 +++ new/talloc-2.1.9/buildtools/wafsamba/samba_conftests.py 2017-02-27 20:23:11.000000000 +0100 @@ -286,7 +286,9 @@ os.makedirs(subdir) Utils.writef(os.path.join(subdir, 'lib1.c'), 'int lib_func(void) { return 42; }\n') - Utils.writef(os.path.join(dir, 'main.c'), 'int main(void) {return !(lib_func() == 42);}\n') + Utils.writef(os.path.join(dir, 'main.c'), + 'int lib_func(void);\n' + 'int main(void) {return !(lib_func() == 42);}\n') bld = Build.BuildContext() bld.log = conf.log @@ -436,6 +438,7 @@ ret = True for v in "sysname machine release version".split(): if not conf.CHECK_CODE(''' + int printf(const char *format, ...); struct utsname n; if (uname(&n) == -1) return -1; printf("%%s", n.%s); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/buildtools/wafsamba/samba_perl.py new/talloc-2.1.9/buildtools/wafsamba/samba_perl.py --- old/talloc-2.1.8/buildtools/wafsamba/samba_perl.py 2015-12-10 12:01:40.000000000 +0100 +++ new/talloc-2.1.9/buildtools/wafsamba/samba_perl.py 2016-11-24 08:26:19.000000000 +0100 @@ -49,7 +49,8 @@ conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir perl_inc = read_perl_config_var('print "@INC"') - perl_inc.remove('.') + if '.' in perl_inc: + perl_inc.remove('.') conf.start_msg("PERL_INC: ") conf.end_msg("%s" % (perl_inc), 'GREEN') conf.env.PERL_INC = perl_inc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/buildtools/wafsamba/samba_utils.py new/talloc-2.1.9/buildtools/wafsamba/samba_utils.py --- old/talloc-2.1.8/buildtools/wafsamba/samba_utils.py 2015-12-10 12:01:40.000000000 +0100 +++ new/talloc-2.1.9/buildtools/wafsamba/samba_utils.py 2017-02-27 20:23:11.000000000 +0100 @@ -2,6 +2,7 @@ # and for SAMBA_ macros for building libraries, binaries etc import os, sys, re, fnmatch, shlex +from optparse import SUPPRESS_HELP import Build, Options, Utils, Task, Logs, Configure from TaskGen import feature, before, after from Configure import conf, ConfigurationContext @@ -669,3 +670,27 @@ if is_standard_libpath(v, i): v['LIBPATH'].remove(i) +def samba_add_onoff_option(opt, option, help=(), dest=None, default=True, + with_name="with", without_name="without"): + if default is None: + default_str = "auto" + elif default is True: + default_str = "yes" + elif default is False: + default_str = "no" + else: + default_str = str(default) + + if help == (): + help = ("Build with %s support (default=%s)" % (option, default_str)) + if dest is None: + dest = "with_%s" % option.replace('-', '_') + + with_val = "--%s-%s" % (with_name, option) + without_val = "--%s-%s" % (without_name, option) + + opt.add_option(with_val, help=help, action="store_true", dest=dest, + default=default) + opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false", + dest=dest) +Options.Handler.samba_add_onoff_option = samba_add_onoff_option diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/buildtools/wafsamba/wscript new/talloc-2.1.9/buildtools/wafsamba/wscript --- old/talloc-2.1.8/buildtools/wafsamba/wscript 2016-04-11 20:30:31.000000000 +0200 +++ new/talloc-2.1.9/buildtools/wafsamba/wscript 2017-02-27 20:23:11.000000000 +0100 @@ -490,12 +490,12 @@ if not conf.CHECK_LARGEFILE(): raise Utils.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8') - if 'HAVE_STDDEF_H' in conf.env and 'HAVE_STDLIB_H' in conf.env: + if conf.env.HAVE_STDDEF_H and conf.env.HAVE_STDLIB_H: conf.DEFINE('STDC_HEADERS', 1) conf.CHECK_HEADERS('sys/time.h time.h', together=True) - if 'HAVE_SYS_TIME_H' in conf.env and 'HAVE_TIME_H' in conf.env: + if conf.env.HAVE_SYS_TIME_H and conf.env.HAVE_TIME_H: conf.DEFINE('TIME_WITH_SYS_TIME', 1) # cope with different extensions for libraries diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/getifaddrs.c new/talloc-2.1.9/lib/replace/getifaddrs.c --- old/talloc-2.1.8/lib/replace/getifaddrs.c 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/getifaddrs.c 2017-02-27 20:23:11.000000000 +0100 @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. Samba utility functions Copyright (C) Andrew Tridgell 1998 @@ -94,17 +94,17 @@ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { return -1; } - + ifc.ifc_len = sizeof(buff); ifc.ifc_buf = buff; if (ioctl(fd, SIOCGIFCONF, &ifc) != 0) { close(fd); return -1; - } + } ifr = ifc.ifc_req; - + n = ifc.ifc_len / sizeof(struct ifreq); /* Loop through interfaces, looking for given IP address */ @@ -171,7 +171,7 @@ close(fd); return 0; -} +} #define _FOUND_IFACE_ANY #endif /* HAVE_IFACE_IFCONF */ @@ -200,14 +200,14 @@ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { return -1; } - + strioctl.ic_cmd = SIOCGIFCONF; strioctl.ic_dp = buff; strioctl.ic_len = sizeof(buff); if (ioctl(fd, I_STR, &strioctl) < 0) { close(fd); return -1; - } + } /* we can ignore the possible sizeof(int) here as the resulting number of interface structures won't change */ @@ -217,16 +217,16 @@ at the start of the buffer if the offered size is a multiple of the structure size plus an int */ if (n*sizeof(struct ifreq) + sizeof(int) == strioctl.ic_len) { - ifr = (struct ifreq *)(buff + sizeof(int)); + ifr = (struct ifreq *)(buff + sizeof(int)); } else { - ifr = (struct ifreq *)buff; + ifr = (struct ifreq *)buff; } /* Loop through interfaces */ for (i = 0; i<n; i++) { ifreq = ifr[i]; - + curif = calloc(1, sizeof(struct ifaddrs)); if (lastif == NULL) { *ifap = curif; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/replace.h new/talloc-2.1.9/lib/replace/replace.h --- old/talloc-2.1.8/lib/replace/replace.h 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/replace.h 2017-02-27 20:23:11.000000000 +0100 @@ -171,6 +171,10 @@ #include <sys/types.h> #endif +#ifdef HAVE_SYS_SYSMACROS_H +#include <sys/sysmacros.h> +#endif + #ifdef HAVE_SETPROCTITLE_H #include <setproctitle.h> #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/snprintf.c new/talloc-2.1.9/lib/replace/snprintf.c --- old/talloc-2.1.8/lib/replace/snprintf.c 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/snprintf.c 2017-02-27 20:23:11.000000000 +0100 @@ -34,7 +34,7 @@ * probably requires libm on most operating systems. Don't yet * support the exponent (e,E) and sigfig (g,G). Also, fmtint() * was pretty badly broken, it just wasn't being exercised in ways - * which showed it, so that's been fixed. Also, formated the code + * which showed it, so that's been fixed. Also, formatted the code * to mutt conventions, and removed dead code left over from the * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/system/dir.h new/talloc-2.1.9/lib/replace/system/dir.h --- old/talloc-2.1.8/lib/replace/system/dir.h 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/system/dir.h 2017-02-27 20:23:11.000000000 +0100 @@ -46,6 +46,10 @@ #define mkdir(dir, mode) mkdir(dir) #endif +#if HAVE_LIBGEN_H +# include <libgen.h> +#endif + /* Test whether a file name is the "." or ".." directory entries. * These really should be inline functions. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/system/network.h new/talloc-2.1.9/lib/replace/system/network.h --- old/talloc-2.1.8/lib/replace/system/network.h 2014-10-01 11:22:21.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/system/network.h 2017-02-27 20:23:11.000000000 +0100 @@ -365,4 +365,8 @@ #endif /* HAVE_LINUX_IPV6_V6ONLY_26 */ #endif /* HAVE_IPV6 */ +#ifndef SCOPE_DELIMITER +#define SCOPE_DELIMITER '%' +#endif + #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/test/shared_mmap.c new/talloc-2.1.9/lib/replace/test/shared_mmap.c --- old/talloc-2.1.8/lib/replace/test/shared_mmap.c 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/test/shared_mmap.c 2017-02-27 20:23:11.000000000 +0100 @@ -4,6 +4,9 @@ #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> @@ -15,7 +18,7 @@ #define MAP_FILE 0 #endif -main() +int main(void) { int *buf; int i; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/test/shared_mremap.c new/talloc-2.1.9/lib/replace/test/shared_mremap.c --- old/talloc-2.1.8/lib/replace/test/shared_mremap.c 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/test/shared_mremap.c 2017-02-27 20:23:11.000000000 +0100 @@ -3,6 +3,9 @@ #if defined(HAVE_UNISTD_H) #include <unistd.h> #endif +#ifdef HAVE_STDLIB_H +#include <stdlib.h> +#endif #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> @@ -18,7 +21,7 @@ #define MAP_FAILED (int *)-1 #endif -main() +int main(void) { int *buf; int fd; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/test/snprintf.c new/talloc-2.1.9/lib/replace/test/snprintf.c --- old/talloc-2.1.8/lib/replace/test/snprintf.c 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/test/snprintf.c 2017-02-27 20:23:11.000000000 +0100 @@ -26,4 +26,4 @@ printf("1"); exit(0); } -main() { foo("hello"); } +int main(void) { foo("hello"); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/wscript new/talloc-2.1.9/lib/replace/wscript --- old/talloc-2.1.8/lib/replace/wscript 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/wscript 2017-02-27 20:23:11.000000000 +0100 @@ -189,7 +189,7 @@ ''', define='HAVE_IPV6', lib='nsl socket', - headers='sys/socket.h netdb.h netinet/in.h') + headers='sys/socket.h netdb.h netinet/in.h net/if.h') if conf.CONFIG_SET('HAVE_SYS_UCONTEXT_H') and conf.CONFIG_SET('HAVE_SIGNAL_H'): conf.CHECK_CODE(''' @@ -376,7 +376,7 @@ if conf.CHECK_FUNCS_IN('dgettext gettext', '', checklibc=True, headers='libintl.h'): # save for dependency definitions conf.env.intl_libs='' - # others (e.g. FreeBSD) have seperate libintl + # others (e.g. FreeBSD) have separate libintl elif conf.CHECK_FUNCS_IN('dgettext gettext', 'intl', checklibc=False, headers='libintl.h'): # save for dependency definitions conf.env.intl_libs='intl' @@ -483,6 +483,9 @@ if conf.CONFIG_SET('HAVE_PORT_CREATE') and conf.CONFIG_SET('HAVE_PORT_H'): conf.DEFINE('HAVE_SOLARIS_PORTS', 1) + if conf.CHECK_FUNCS('eventfd', headers='sys/eventfd.h'): + conf.DEFINE('HAVE_EVENTFD', 1) + conf.CHECK_HEADERS('poll.h') conf.CHECK_FUNCS('poll') @@ -701,9 +704,10 @@ deps='crypt dl nsl socket rt attr' + extra_libs) bld.SAMBA_SUBSYSTEM('replace-test', - source='''test/testsuite.c test/strptime.c - test/os2_delete.c test/getifaddrs.c''', - deps='replace') + source='''test/testsuite.c test/strptime.c + test/os2_delete.c test/getifaddrs.c''', + deps='replace', + cflags="-Wno-format-length") if bld.env.standalone_replace: bld.SAMBA_BINARY('replace_testsuite', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/lib/replace/xattr.c new/talloc-2.1.9/lib/replace/xattr.c --- old/talloc-2.1.8/lib/replace/xattr.c 2014-09-16 20:04:31.000000000 +0200 +++ new/talloc-2.1.9/lib/replace/xattr.c 2017-02-27 20:23:11.000000000 +0100 @@ -61,11 +61,21 @@ #elif defined(HAVE_GETEA) return getea(path, name, value, size); #elif defined(HAVE_EXTATTR_GET_FILE) - char *s; ssize_t retval; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } + /* * The BSD implementation has a nasty habit of silently truncating * the returned value to the size of the buffer, so we have to check @@ -125,11 +135,20 @@ #elif defined(HAVE_FGETEA) return fgetea(filedes, name, value, size); #elif defined(HAVE_EXTATTR_GET_FD) - char *s; ssize_t retval; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) { if (size == 0) { @@ -414,10 +433,19 @@ #elif defined(HAVE_REMOVEEA) return removeea(path, name); #elif defined(HAVE_EXTATTR_DELETE_FILE) - char *s; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } return extattr_delete_file(path, attrnamespace, attrname); #elif defined(HAVE_ATTR_REMOVE) @@ -455,10 +483,19 @@ #elif defined(HAVE_FREMOVEEA) return fremoveea(filedes, name); #elif defined(HAVE_EXTATTR_DELETE_FD) - char *s; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } return extattr_delete_fd(filedes, attrnamespace, attrname); #elif defined(HAVE_ATTR_REMOVEF) @@ -496,11 +533,21 @@ #elif defined(HAVE_SETEA) return setea(path, name, value, size, flags); #elif defined(HAVE_EXTATTR_SET_FILE) - char *s; int retval = 0; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } + if (flags) { /* Check attribute existence */ retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0); @@ -563,11 +610,21 @@ #elif defined(HAVE_FSETEA) return fsetea(filedes, name, value, size, flags); #elif defined(HAVE_EXTATTR_SET_FD) - char *s; int retval = 0; - int attrnamespace = (strncmp(name, "system", 6) == 0) ? - EXTATTR_NAMESPACE_SYSTEM : EXTATTR_NAMESPACE_USER; - const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1; + int attrnamespace; + const char *attrname; + + if (strncmp(name, "system.", 7) == 0) { + attrnamespace = EXTATTR_NAMESPACE_SYSTEM; + attrname = name + 7; + } else if (strncmp(name, "user.", 5) == 0) { + attrnamespace = EXTATTR_NAMESPACE_USER; + attrname = name + 5; + } else { + errno = EINVAL; + return -1; + } + if (flags) { /* Check attribute existence */ retval = extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/pytalloc.c new/talloc-2.1.9/pytalloc.c --- old/talloc-2.1.8/pytalloc.c 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/pytalloc.c 2017-02-27 20:23:11.000000000 +0100 @@ -238,6 +238,14 @@ #endif }; +static PyTypeObject TallocGenericObject_Type = { + .tp_name = "talloc.GenericObject", + .tp_doc = "Python wrapper for a talloc-maintained object.", + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, + .tp_base = &TallocBaseObject_Type, + .tp_basicsize = sizeof(pytalloc_BaseObject), +}; + #define MODULE_DOC PyDoc_STR("Python wrapping of talloc-maintained objects.") #if PY_MAJOR_VERSION >= 3 @@ -261,6 +269,9 @@ if (PyType_Ready(&TallocBaseObject_Type) < 0) return NULL; + if (PyType_Ready(&TallocGenericObject_Type) < 0) + return NULL; + #if PY_MAJOR_VERSION >= 3 m = PyModule_Create(&moduledef); #else @@ -273,6 +284,8 @@ PyModule_AddObject(m, "Object", (PyObject *)&TallocObject_Type); Py_INCREF(&TallocBaseObject_Type); PyModule_AddObject(m, "BaseObject", (PyObject *)&TallocBaseObject_Type); + Py_INCREF(&TallocGenericObject_Type); + PyModule_AddObject(m, "GenericObject", (PyObject *)&TallocGenericObject_Type); return m; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/pytalloc.h new/talloc-2.1.9/pytalloc.h --- old/talloc-2.1.8/pytalloc.h 2016-03-08 14:37:39.000000000 +0100 +++ new/talloc-2.1.9/pytalloc.h 2017-02-27 20:23:11.000000000 +0100 @@ -40,6 +40,10 @@ int pytalloc_BaseObject_check(PyObject *); +int _pytalloc_check_type(PyObject *py_obj, const char *type_name); +#define pytalloc_check_type(py_obj, type) \ + _pytalloc_check_type((PyObject *)(py_obj), #type) + /* Retrieve the pointer for a pytalloc_object. Like talloc_get_type() * but for pytalloc_Objects. */ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name); @@ -58,8 +62,30 @@ #define pytalloc_new(type, typeobj) pytalloc_steal(typeobj, talloc_zero(NULL, type)) #if PY_MAJOR_VERSION < 3 -PyObject *pytalloc_CObject_FromTallocPtr(void *); +/* + * Don't use this anymore! Use pytalloc_GenericObject_steal() + * or pytalloc_GenericObject_reference(). + */ +#ifndef _DEPRECATED_ +#ifdef HAVE___ATTRIBUTE__ +#define _DEPRECATED_ __attribute__ ((deprecated)) +#else +#define _DEPRECATED_ +#endif #endif +PyObject *pytalloc_CObject_FromTallocPtr(void *) _DEPRECATED_; +#endif + +/* + * Wrap a generic talloc pointer into a talloc.GenericObject, + * this is a subclass of talloc.BaseObject. + */ +PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr); +#define pytalloc_GenericObject_steal(talloc_ptr) \ + pytalloc_GenericObject_steal_ex(talloc_ptr, talloc_ptr) +PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr); +#define pytalloc_GenericObject_reference(talloc_ptr) \ + pytalloc_GenericObject_reference_ex(talloc_ptr, talloc_ptr) size_t pytalloc_BaseObject_size(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/pytalloc_guide.txt new/talloc-2.1.9/pytalloc_guide.txt --- old/talloc-2.1.8/pytalloc_guide.txt 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/pytalloc_guide.txt 2017-02-27 20:23:11.000000000 +0100 @@ -92,6 +92,15 @@ a pytalloc_BaseObject and zero otherwise. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +int pytalloc_check_type(PyObject *py_obj, type) + +Check if the object based on `pytalloc_*Object` py_obj. type should be a +C type, similar to a type passed to `talloc_get_type`. +This can be used as a check before using pytalloc_get_type() +or an alternative codepath. Returns non-zero if it is +an object of the expected type and zero otherwise. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- type *pytalloc_get_type(PyObject *py_obj, type) Retrieve the pointer from a `pytalloc_Object` py_obj. type should be a @@ -113,7 +122,9 @@ PyObject *pytalloc_steal_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr) Create a new Python wrapping object for a talloc pointer and context, with -py_type as associated Python sub type object. +py_type as associated Python sub type object. This typically used +when `mem_ctx` and `ptr` differ, e.g. a pointer to an array element. +`pytalloc_get_ptr()` can be used to get the pointer out of the object again. This will *not* increment the reference counter for the talloc context, so the caller should make sure such an increment has happened. When the Python @@ -123,7 +134,9 @@ PyObject *pytalloc_steal(PyTypeObject *py_type, void *ptr) Create a new Python wrapping object for a talloc pointer and context, with -py_type as associated Python sub type object. +py_type as associated Python sub type object. The pointer will also be used +as the talloc context. `pytalloc_get_type()` can be used to get +the pointer out of the object again. This will *not* increment the reference counter for the talloc context, so the caller should make sure such an increment has happened. When the Python @@ -133,7 +146,9 @@ PyObject *pytalloc_reference_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx, void *ptr) Create a new Python wrapping object for a talloc pointer and context, with -py_type as associated Python sub type object. +py_type as associated Python sub type object. This typically used +when `mem_ctx` and `ptr` differ, e.g. a pointer to an array element. +`pytalloc_get_ptr()` can be used to get the pointer out of the object again. This will increment the reference counter for the talloc context. @@ -142,7 +157,8 @@ Create a new Python wrapping object for a talloc pointer, with py_type as associated Python sub type object. The pointer will also be used -as the talloc context. +as the talloc context. `pytalloc_get_type()` can be used to get +the pointer out of the object again. This will increment the reference counter for the talloc context. @@ -153,14 +169,59 @@ should be a C type, similar to talloc_new(). =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -PyObject *pytalloc_CObject_FromTallocPtr(void *); +PyObject *pytalloc_GenericObject_steal_ex(void *ptr) + +Create a new Python wrapping object for a generic talloc pointer, +as sub type of `pytalloc_BaseObject`. This typically used +when `mem_ctx` and `ptr` differ, e.g. a pointer to an array element. +`pytalloc_get_ptr()` can be used to get the pointer out of the object again. + +This will *not* increment the reference counter for the talloc context, +so the caller should make sure such an increment has happened. When the Python +object goes away, it will unreference the talloc context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +PyObject *pytalloc_GenericObject_steal(void *ptr) + +Create a new Python wrapping object for a generic talloc pointer, +as sub type of `pytalloc_BaseObject`. The pointer will also be used +as the talloc context. `pytalloc_get_type()` can be used to get +the pointer out of the object again. + +This will *not* increment the reference counter for the talloc context, +so the caller should make sure such an increment has happened. When the Python +object goes away, it will unreference the talloc context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +PyObject *pytalloc_GenericObject_reference_ex(void *ptr) + +Create a new Python wrapping object for a generic talloc pointer, +as sub type of `pytalloc_BaseObject`. This typically used +when `mem_ctx` and `ptr` differ, e.g. a pointer to an array element. +`pytalloc_get_ptr()` can be used to get the pointer out of the object again. + +This will increment the reference counter for the talloc context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +PyObject *pytalloc_GenericObject_reference(void *ptr) + +Create a new Python wrapping object for a generic talloc pointer, +as sub type of `pytalloc_BaseObject`. The pointer will also be used +as the talloc context. `pytalloc_get_type()` can be used to get +the pointer out of the object again. + +This will increment the reference counter for the talloc context. + +=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- +DEPRECATED! PyObject *pytalloc_CObject_FromTallocPtr(void *); Create a new pytalloc_Object for an abitrary talloc-maintained C pointer. This will use a generic VoidPtr Python type, which just provides an opaque object in Python. The caller is responsible for incrementing the talloc reference count before calling this function - it will dereference the talloc pointer when it is garbage collected. -This function is only available on Python 2. +This function is deprecated and only available on Python 2. +Use pytalloc_GenericObject_{reference,steal}[_ex]() instead. Debug function for talloc in Python ----------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/pytalloc_util.c new/talloc-2.1.9/pytalloc_util.c --- old/talloc-2.1.8/pytalloc_util.c 2016-03-08 14:37:39.000000000 +0100 +++ new/talloc-2.1.9/pytalloc_util.c 2017-02-27 20:23:11.000000000 +0100 @@ -64,6 +64,26 @@ return type; } +static PyTypeObject *pytalloc_GetGenericObjectType(void) +{ + static PyTypeObject *type = NULL; + PyObject *mod; + + if (type != NULL) { + return type; + } + + mod = PyImport_ImportModule("talloc"); + if (mod == NULL) { + return NULL; + } + + type = (PyTypeObject *)PyObject_GetAttrString(mod, "GenericObject"); + Py_DECREF(mod); + + return type; +} + /** * Import an existing talloc pointer into a Python object. */ @@ -204,6 +224,26 @@ #endif +/* + * Wrap a generic talloc pointer into a talloc.GenericObject, + * this is a subclass of talloc.BaseObject. + */ +_PUBLIC_ PyObject *pytalloc_GenericObject_steal_ex(TALLOC_CTX *mem_ctx, void *ptr) +{ + PyTypeObject *tp = pytalloc_GetGenericObjectType(); + return pytalloc_steal_ex(tp, mem_ctx, ptr); +} + +/* + * Wrap a generic talloc pointer into a talloc.GenericObject, + * this is a subclass of talloc.BaseObject. + */ +_PUBLIC_ PyObject *pytalloc_GenericObject_reference_ex(TALLOC_CTX *mem_ctx, void *ptr) +{ + PyTypeObject *tp = pytalloc_GetGenericObjectType(); + return pytalloc_reference_ex(tp, mem_ctx, ptr); +} + _PUBLIC_ int pytalloc_Check(PyObject *obj) { PyTypeObject *tp = pytalloc_GetObjectType(); @@ -223,21 +263,66 @@ return sizeof(pytalloc_BaseObject); } -_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name) +static void *_pytalloc_get_checked_type(PyObject *py_obj, const char *type_name, + bool check_only, const char *function) { - void *ptr = _pytalloc_get_ptr(py_obj); + TALLOC_CTX *mem_ctx; + void *ptr = NULL; void *type_obj = talloc_check_name(ptr, type_name); + mem_ctx = _pytalloc_get_mem_ctx(py_obj); + ptr = _pytalloc_get_ptr(py_obj); + + if (mem_ctx != ptr) { + if (check_only) { + return NULL; + } + + PyErr_Format(PyExc_TypeError, "%s: expected %s, " + "but the pointer is no talloc pointer, " + "pytalloc_get_ptr() would get the raw pointer.", + function, type_name); + return NULL; + } + + type_obj = talloc_check_name(ptr, type_name); if (type_obj == NULL) { - const char *name = talloc_get_name(ptr); - PyErr_Format(PyExc_TypeError, "pytalloc: expected %s, got %s", - type_name, name); + const char *name = NULL; + + if (check_only) { + return NULL; + } + + name = talloc_get_name(ptr); + PyErr_Format(PyExc_TypeError, "%s: expected %s, got %s", + function, type_name, name); return NULL; } return ptr; } +_PUBLIC_ int _pytalloc_check_type(PyObject *py_obj, const char *type_name) +{ + void *ptr = NULL; + + ptr = _pytalloc_get_checked_type(py_obj, type_name, + true, /* check_only */ + "pytalloc_check_type"); + if (ptr == NULL) { + return 0; + } + + return 1; +} + +_PUBLIC_ void *_pytalloc_get_type(PyObject *py_obj, const char *type_name) +{ + return _pytalloc_get_checked_type(py_obj, type_name, + false, /* not check_only */ + "pytalloc_get_type"); +} + _PUBLIC_ void *_pytalloc_get_ptr(PyObject *py_obj) { if (pytalloc_BaseObject_check(py_obj)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/talloc.c new/talloc-2.1.9/talloc.c --- old/talloc-2.1.8/talloc.c 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/talloc.c 2017-02-27 20:23:11.000000000 +0100 @@ -37,17 +37,13 @@ #include <sys/auxv.h> #endif -#ifdef TALLOC_BUILD_VERSION_MAJOR #if (TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR) #error "TALLOC_VERSION_MAJOR != TALLOC_BUILD_VERSION_MAJOR" #endif -#endif -#ifdef TALLOC_BUILD_VERSION_MINOR #if (TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR) #error "TALLOC_VERSION_MINOR != TALLOC_BUILD_VERSION_MINOR" #endif -#endif /* Special macros that are no-ops except when run under Valgrind on * x86. They've moved a little bit from valgrind 1.0.4 to 1.9.4 */ @@ -80,9 +76,11 @@ #define TALLOC_MAGIC_BASE 0xe814ec70 static unsigned int talloc_magic = ( - TALLOC_MAGIC_BASE + - (TALLOC_VERSION_MAJOR << 12) + - (TALLOC_VERSION_MINOR << 4)); + ~TALLOC_FLAG_MASK & ( + TALLOC_MAGIC_BASE + + (TALLOC_BUILD_VERSION_MAJOR << 24) + + (TALLOC_BUILD_VERSION_MINOR << 16) + + (TALLOC_BUILD_VERSION_RELEASE << 8))); /* by default we abort when given a bad pointer (such as when talloc_free() is called on a pointer that came from malloc() */ @@ -263,7 +261,32 @@ struct talloc_pool_hdr; struct talloc_chunk { + /* + * flags includes the talloc magic, which is randomised to + * make overwrite attacks harder + */ unsigned flags; + + /* + * If you have a logical tree like: + * + * <parent> + * / | \ + * / | \ + * / | \ + * <child 1> <child 2> <child 3> + * + * The actual talloc tree is: + * + * <parent> + * | + * <child 1> - <child 2> - <child 3> + * + * The children are linked with next/prev pointers, and + * child 1 is linked to the parent with parent/child + * pointers. + */ + struct talloc_chunk *next, *prev; struct talloc_chunk *parent, *child; struct talloc_reference_handle *refs; @@ -427,7 +450,7 @@ const char *pp = (const char *)ptr; struct talloc_chunk *tc = discard_const_p(struct talloc_chunk, pp - TC_HDR_SIZE); if (unlikely((tc->flags & (TALLOC_FLAG_FREE | ~TALLOC_FLAG_MASK)) != talloc_magic)) { - if ((tc->flags & (~0xF)) == talloc_magic) { + if ((tc->flags & (~TALLOC_FLAG_MASK)) == talloc_magic) { talloc_abort_magic(tc->flags & (~TALLOC_FLAG_MASK)); return NULL; } @@ -2476,8 +2499,12 @@ #endif static struct talloc_chunk *_vasprintf_tc(const void *t, - const char *fmt, - va_list ap) + const char *fmt, + va_list ap) PRINTF_ATTRIBUTE(2,0); + +static struct talloc_chunk *_vasprintf_tc(const void *t, + const char *fmt, + va_list ap) { int len; char *ret; @@ -2709,9 +2736,6 @@ struct talloc_chunk *tc; if (context == NULL) { - context = null_context; - } - if (context == NULL) { return 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/talloc.h new/talloc-2.1.9/talloc.h --- old/talloc-2.1.8/talloc.h 2016-02-19 22:02:02.000000000 +0100 +++ new/talloc-2.1.9/talloc.h 2017-02-27 20:23:11.000000000 +0100 @@ -43,7 +43,7 @@ */ #define TALLOC_VERSION_MAJOR 2 -#define TALLOC_VERSION_MINOR 0 +#define TALLOC_VERSION_MINOR 1 int talloc_version_major(void); int talloc_version_minor(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/testsuite.c new/talloc-2.1.9/testsuite.c --- old/talloc-2.1.8/testsuite.c 2016-07-28 09:17:50.000000000 +0200 +++ new/talloc-2.1.9/testsuite.c 2017-02-27 20:23:11.000000000 +0100 @@ -34,6 +34,12 @@ #include <unistd.h> #include <sys/wait.h> +#ifdef NDEBUG +#undef NDEBUG +#endif + +#include <assert.h> + #include "talloc_testsuite.h" static struct timeval private_timeval_current(void) @@ -604,7 +610,7 @@ void *root; struct el2 { const char *name; - } *el2; + } *el2, *el2_2, *el2_3, **el_list_save; struct el1 { int count; struct el2 **list, **list2, **list3; @@ -628,13 +634,34 @@ el1->list3[0]->name = talloc_strdup(el1->list3[0], "testing2"); el2 = talloc(el1->list, struct el2); - el2 = talloc(el1->list2, struct el2); - el2 = talloc(el1->list3, struct el2); - (void)el2; + CHECK_PARENT("el2", el2, el1->list); + el2_2 = talloc(el1->list2, struct el2); + CHECK_PARENT("el2", el2_2, el1->list2); + el2_3 = talloc(el1->list3, struct el2); + CHECK_PARENT("el2", el2_3, el1->list3); + el_list_save = el1->list; el1->list = talloc_realloc(el1, el1->list, struct el2 *, 100); + if (el1->list == el_list_save) { + printf("failure: talloc_realloc didn't move pointer"); + return false; + } + + CHECK_PARENT("el1_after_realloc", el1->list, el1); el1->list2 = talloc_realloc(el1, el1->list2, struct el2 *, 200); + CHECK_PARENT("el1_after_realloc", el1->list2, el1); el1->list3 = talloc_realloc(el1, el1->list3, struct el2 *, 300); + CHECK_PARENT("el1_after_realloc", el1->list3, el1); + + CHECK_PARENT("el2", el2, el1->list); + CHECK_PARENT("el2", el2_2, el1->list2); + CHECK_PARENT("el2", el2_3, el1->list3); + + /* Finally check realloc with multiple children */ + el1 = talloc_realloc(root, el1, struct el1, 100); + CHECK_PARENT("el1->list", el1->list, el1); + CHECK_PARENT("el1->list2", el1->list2, el1); + CHECK_PARENT("el1->list3", el1->list3, el1); talloc_free(root); @@ -958,6 +985,57 @@ return true; } +static int realloc_parent_destructor_count; + +static int test_realloc_parent_destructor(char *ptr) +{ + realloc_parent_destructor_count++; + return 0; +} + +static bool test_realloc_on_destructor_parent(void) +{ + void *top = talloc_new(NULL); + char *parent; + char *a, *b, *C, *D; + realloc_parent_destructor_count = 0; + + printf("test: free_for_exit\n# TALLOC FREE FOR EXIT\n"); + + parent = talloc_strdup(top, "parent"); + a = talloc_strdup(parent, "a"); + b = talloc_strdup(a, "b"); + C = talloc_strdup(a, "C"); + D = talloc_strdup(b, "D"); + talloc_set_destructor(D, test_realloc_parent_destructor); + /* Capitalised ones have destructors. + * + * parent --> a -> b -> D + * -> c + */ + + a = talloc_realloc(parent, a, char, 2048); + + torture_assert("check talloc_realloc", a != NULL, "talloc_realloc failed"); + + talloc_set_destructor(C, test_realloc_parent_destructor); + /* + * parent --> a[2048] -> b -> D + * -> C + * + */ + + talloc_free(parent); + + torture_assert("check destructor realloc_parent_destructor", + realloc_parent_destructor_count == 2, + "FAILED TO FIRE free_for_exit_destructor\n"); + + + printf("success: free_for_exit\n"); + return true; +} + static int fail_destructor_str(char *ptr) { return -1; @@ -1750,7 +1828,8 @@ ret = pthread_cond_wait(&condvar, &mtx); if (ret != 0) { talloc_free(top_ctx); - pthread_mutex_unlock(&mtx); + ret = pthread_mutex_unlock(&mtx); + assert(ret == 0); return NULL; } } @@ -1760,7 +1839,8 @@ /* Tell the main thread it's ready for pickup. */ pthread_cond_broadcast(&condvar); - pthread_mutex_unlock(&mtx); + ret = pthread_mutex_unlock(&mtx); + assert(ret == 0); talloc_free(top_ctx); return NULL; @@ -1831,8 +1911,8 @@ printf("pthread_cond_wait %d failed (%d)\n", i, ret); talloc_free(mem_ctx); - pthread_mutex_unlock(&mtx); - return false; + ret = pthread_mutex_unlock(&mtx); + assert(ret == 0); } } @@ -1841,7 +1921,8 @@ /* Tell the sub-threads we're ready for another. */ pthread_cond_broadcast(&condvar); - pthread_mutex_unlock(&mtx); + ret = pthread_mutex_unlock(&mtx); + assert(ret == 0); } CHECK_SIZE("pthread_talloc_passing", mem_ctx, NUM_THREADS * 100); @@ -1976,6 +2057,8 @@ test_reset(); ret &= test_free_parent_deny_child(); test_reset(); + ret &= test_realloc_on_destructor_parent(); + test_reset(); ret &= test_free_parent_reparent_child(); test_reset(); ret &= test_free_parent_reparent_child_in_pool(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/third_party/waf/wafadmin/Tools/config_c.py new/talloc-2.1.9/third_party/waf/wafadmin/Tools/config_c.py --- old/talloc-2.1.8/third_party/waf/wafadmin/Tools/config_c.py 2015-11-06 14:28:25.000000000 +0100 +++ new/talloc-2.1.9/third_party/waf/wafadmin/Tools/config_c.py 2017-02-27 20:23:11.000000000 +0100 @@ -106,7 +106,9 @@ @conf def validate_cfg(self, kw): if not 'path' in kw: - kw['path'] = 'pkg-config --errors-to-stdout --print-errors' + if not self.env.PKGCONFIG: + self.find_program('pkg-config', var='PKGCONFIG') + kw['path'] = self.env.PKGCONFIG # pkg-config version if 'atleast_pkgconfig_version' in kw: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/third_party/waf/wafadmin/Tools/msvc.py new/talloc-2.1.9/third_party/waf/wafadmin/Tools/msvc.py --- old/talloc-2.1.8/third_party/waf/wafadmin/Tools/msvc.py 2015-11-06 14:25:52.000000000 +0100 +++ new/talloc-2.1.9/third_party/waf/wafadmin/Tools/msvc.py 2017-02-27 20:23:11.000000000 +0100 @@ -373,7 +373,7 @@ if lt_path != None and lt_libname != None: if lt_static == True: - # file existance check has been made by find_lt_names + # file existence check has been made by find_lt_names return os.path.join(lt_path,lt_libname) if lt_path != None: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/talloc-2.1.8/wscript new/talloc-2.1.9/wscript --- old/talloc-2.1.8/wscript 2016-07-28 09:19:25.000000000 +0200 +++ new/talloc-2.1.9/wscript 2017-02-27 20:23:11.000000000 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/env python APPNAME = 'talloc' -VERSION = '2.1.8' +VERSION = '2.1.9' blddir = 'bin' @@ -42,6 +42,10 @@ conf.env.standalone_talloc = conf.IN_LAUNCH_DIR() + conf.define('TALLOC_BUILD_VERSION_MAJOR', int(VERSION.split('.')[0])) + conf.define('TALLOC_BUILD_VERSION_MINOR', int(VERSION.split('.')[1])) + conf.define('TALLOC_BUILD_VERSION_RELEASE', int(VERSION.split('.')[2])) + conf.env.disable_python = getattr(Options.options, 'disable_python', False) if not conf.env.standalone_talloc: @@ -141,13 +145,11 @@ bld.SAMBA_PYTHON('pytalloc', 'pytalloc.c', deps='talloc ' + name, - enabled=True, realname='talloc.so') bld.SAMBA_PYTHON('test_pytalloc', 'test_pytalloc.c', deps='pytalloc', - enabled=True, realname='_test_pytalloc.so', install=False)