summaryrefslogtreecommitdiff
path: root/lib/talloc
Commit message (Collapse)AuthorAgeFilesLines
...
* talloc: use the system pytalloc-util for python3 as wellAndrew Bartlett2017-03-102-16/+32
| | | | | | | | | | | | | | | | This involves installing a .pc file for the python3 library as well To get the .pc file generated and installed is quite a mission, we have to rework the talloc build system to ensure that the second 'env' created for EXTRA_PYTHON has everything set up on it, the TALLOC_VERSION in particular. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Incorportaing fixes by Petr Viktorin <pviktori@redhat.com> Signed-off-by: Petr Viktorin <pviktori@redhat.com>
* talloc: fix doxygen of talloc_moveUri Simchoni2017-03-101-3/+4
| | | | | | | | | | talloc_move cannot fail. Signed-off-by: Uri Simchoni <uri@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Mar 10 07:30:40 CET 2017 on sn-devel-144
* talloc: version 2.1.9talloc-2.1.9Stefan Metzmacher2017-02-256-7/+97
| | | | | | | | | | | * 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]() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pytalloc: add pytalloc_GenericObject_{steal,reference}[_ex]()Stefan Metzmacher2017-02-256-12/+203
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* talloc: fix TALLOC_VERSION_* mismatch detectionStefan Metzmacher2017-02-223-8/+9
| | | | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Wed Feb 22 00:14:34 CET 2017 on sn-devel-144
* talloc/wscript: avoid passing pointless enabled=True to SAMBA_PYTHON()Stefan Metzmacher2017-02-011-2/+0
| | | | | | | | | | This is the default and should not be passed explicitly. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Feb 1 18:16:58 CET 2017 on sn-devel-144
* lib: talloc: Make it clear that talloc_get_size(NULL) returns 0.Jeremy Allison2017-01-121-3/+0
| | | | | | | | | | | | | This *isn't* a behavior change, as the previous code could potentially return the size of null_context, which (currently) is defined as a named talloc region of ZERO size, but this makes it very clear what the ABI behavior should be. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Thu Jan 12 19:23:25 CET 2017 on sn-devel-144
* talloc: Add tests for talloc destructor behaviour after talloc_realloc()Andrew Bartlett2016-12-131-1/+66
| | | | | | | | | | | That this behaved correctly was not clear, so I added tests to prove it to myself. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Dec 13 06:47:58 CET 2016 on sn-devel-144
* talloc: Add tests for talloc_parent() after realloc() of the parentAndrew Bartlett2016-12-011-4/+13
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: clarify that talloc_magic never includes the bits in TALLOC_FLAG_MASKAndrew Bartlett2016-12-011-3/+4
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: add ASCII art to describe parent/child arrangementAndrew Bartlett2016-12-011-0/+25
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: Fix CID 1373619 Unchecked return valueVolker Lendecke2016-10-151-3/+4
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Oct 15 01:28:02 CEST 2016 on sn-devel-144
* talloc: Fix CID 1373621 Unchecked return valueVolker Lendecke2016-10-141-2/+10
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Fix format-nonliteral warningAmitay Isaacs2016-08-241-2/+6
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=12168 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: version 2.1.8talloc-2.1.8Stefan Metzmacher2016-07-284-1/+91
| | | | | | | | | * performance improvements * build fixes * documentation updates Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* pytalloc: Add a warning about enable_null_trackingGarming Sam2016-07-191-0/+2
| | | | | | | | | If it is called in the middle of a script such as samba-tool, memory would be hanging from both the actual NULL context and the talloc_null_context (causing a segfault at system_exit). Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
* lib: talloc: Add check for destructor protection.Andrew Bartlett2016-07-031-0/+6
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: As we have a struct talloc_chunk * in ↵Andrew Bartlett2016-07-031-1/+1
| | | | | | | _talloc_free_children_internal(), use it to call _tc_free_internal() directly. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: As _tc_free_internal() takes a struct talloc_chunk *, add an ↵Andrew Bartlett2016-07-031-0/+14
| | | | | | | extra paranoia check against destructor overwrite. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Rename the internals of _talloc_free_internal() to ↵Andrew Bartlett2016-07-031-19/+31
| | | | | | | | | | _tc_free_internal(). Make it use a struct talloc_chunk *tc parameter. Define _talloc_free_internal() in terms of _tc_free_internal(). Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Call talloc_chunk_from_ptr() less often in __talloc_with_prefix()Andrew Bartlett2016-07-031-8/+7
| | | | | | | | Rename 'ptc' pointer to parent as it's re-used as that name later in the function. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Rename talloc_set_name_v() to tc_set_name_v(). Make it take a ↵Andrew Bartlett2016-07-031-11/+19
| | | | | | | struct talloc_chunk *tc as the first argument. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Add _vasprintf_tc() which returns the struct talloc_chunk *, ↵Andrew Bartlett2016-07-031-3/+17
| | | | | | | | | | not the talloc'ed pointer. Define talloc_vasprintf() in terms of _vasprintf_tc(). We will use _vasprintf_tc() internally later. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Change _talloc_set_name_const() to _tc_set_name_const()Andrew Bartlett2016-07-031-12/+14
| | | | | | | | First argument is now struct talloc_chunk *tc. Ensure all callers pass correct talloc chunk from given pointer. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Change __talloc() to return a struct talloc_chunk *.Andrew Bartlett2016-07-031-9/+16
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Change __talloc_with_prefix() to return a struct talloc_chunk *.Andrew Bartlett2016-07-031-5/+8
| | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib: talloc: Rename talloc_XXX() internal functions that take a 'struct ↵Jeremy Allison2016-07-031-17/+17
| | | | | | | | | talloc_chunk *' to tc_XXX(). We will be adding more and it ensures a consistent naming scheme. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* talloc: rename local timeval function copiesRalph Boehme2016-06-011-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timeval_current() and timeval_elapsed() are public functions from libsamba-util. Redeclaring them as static functions here triggers linker error when building with gcc link-time-optimisation (LTO). This shows the error after reverting this patch: [slow@kazak lto]$ make -j WAF_MAKE=1 python ./buildtools/bin/waf build Waf: Entering directory `/home/slow/git/samba/lto/bin' Selected embedded Heimdal build [ 174/4259] Generating ctdb-samba-version-header [ 174/4259] Generating ctdb-samba-version-header [ 521/4259] Generating source4/torture/local/proto.h [2565/4259] Compiling lib/talloc/testsuite.c [4125/4259] Linking default/source4/torture/smbtorture /tmp/ccvL9UCe.ltrans3.ltrans.o:<artificial>:function smbsrv_accept.lto_priv.11: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smbsrv_recv_smb2_request: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smb2srv_negprot_backend: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans4.ltrans.o:<artificial>:function smb2srv_negprot_backend: error: undefined reference to 'timeval_current.lto_priv.630' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_oplock_batch22: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' /tmp/ccvL9UCe.ltrans9.ltrans.o:<artificial>:function test_smb2_bench_oplock: error: undefined reference to 'timeval_elapsed.lto_priv.628' collect2: error: ld returned 1 exit status ... Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Wed Jun 1 21:09:16 CEST 2016 on sn-devel-144
* pytalloc: avoid double 0x0x in repr stringsDouglas Bagnall2016-05-101-1/+1
| | | | | | | | | | The %p format puts one in itself. Before: <drsblobs.repsFromTo2 talloc based object at 0x0x1b551e0> After: <drsblobs.repsFromTo2 talloc based object at 0x1b551e0> Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* talloc: version 2.1.7talloc-2.1.7Stefan Metzmacher2016-05-054-1/+91
| | | | | | | | | | * Fix memory leak when destructors reparent children. (bug #11901) Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 5 22:33:04 CEST 2016 on sn-devel-144
* lib:talloc. Fix memory leak when destructors reparent children.Saji VR2016-05-051-1/+1
| | | | | | | | | | | | | | | If a destructor reparents a child, we shouldn't exit the loop freeing children as there may be others to process. https://bugzilla.samba.org/show_bug.cgi?id=11901 Signed-off-by: Saji VR <saji.vr@nutanix.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Richard Sharpe <rsharpe@samba.org> Reviewed-by: Ira Cooper <ira@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu May 5 08:33:53 CEST 2016 on sn-devel-144
* talloc/testsuite: Fix CID 1291641 - Logically dead codeRobin Hack2016-04-261-5/+5
| | | | | | | | Add check for snprintf return code. Signed-off-by: Robin Hack <hack.robin@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* pytalloc: Correct description of pytalloc_Get{Base,}ObjectType behaviourtalloc-2.1.6Andrew Bartlett2016-03-081-6/+8
| | | | | | | | | | Thanks to Jelmer for spotting the static variable that causes this odd behaviour Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Tue Mar 8 05:14:15 CET 2016 on sn-devel-144
* pytalloc: Add pytalloc_BaseObject_PyType_Ready() wrapperAndrew Bartlett2016-03-085-0/+23
| | | | | | | | This avoids the need for the caller to set tp_base and tp_basicsize and so removes those as possible errors. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: Bump version numberAndrew Bartlett2016-03-084-1/+89
| | | | | | | | | | | | | The removal of the macros and replacement with proper functions is a API, but not ABI break. Only code that incorrectly used the structure either in function signatures or to access the members directly will need to be modified before being built against this version of talloc. Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* pytalloc: Add new BaseObjectAndrew Bartlett2016-03-087-31/+433
| | | | | | | | | This new object not only avoids the ABI issues of talloc.Object it stores one more pointer, being the start of the array, and so can be used to fix the PIDL bindings/talloc refcount issue. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* pytalloc: add a _pytalloc_get_type() helper function and generate ↵Stefan Metzmacher2016-03-082-4/+17
| | | | | | | | PyExc_TypeError on mismatch Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: add _pytalloc_get_ptr/_pytalloc_get_mem_ctx helper functionsAndrew Bartlett2016-03-084-5/+17
| | | | | | | | | | | This allows us to check which type is involved, and dereference that type correctly Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: Improve testsuite by avoiding path issuesAndrew Bartlett2016-03-082-5/+8
| | | | | | | We now rely on waf to tell us where the helper binary is. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* talloc: Only set public headers field when installing as a public library.Jelmer Vernooij2016-01-131-2/+2
| | | | Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
* talloc: Fix a documentation typoMartin Schwenke2016-01-111-1/+1
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Mon Jan 11 18:34:53 CET 2016 on sn-devel-144
* talloc: version 2.1.5talloc-2.1.5Stefan Metzmacher2015-11-054-1/+77
| | | | | | * Minor build fixes Signed-off-by: Stefan Metzmacher <metze@samba.org>
* talloc: Fix the O3 developer buildVolker Lendecke2015-10-121-2/+5
| | | | | | | | Compilers can't see that the child exits. Thus "exit_status" is used uninitialized in the child. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* talloc: Test that talloc magic differs between processes.talloc-2.1.4Adrian Cochrane2015-10-093-1/+36
| | | | | | | | | Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Fri Oct 9 23:15:06 CEST 2015 on sn-devel-104
* talloc: Increment minor version due to added talloc_test_get_magic.Adrian Cochrane2015-10-093-1/+72
| | | | | | Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Provide tests access to talloc_magicAdrian Cochrane2015-10-092-0/+7
| | | | | | Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* talloc: Test magic protection measures.Adrian Cochrane2015-10-091-0/+66
| | | | | | Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/talloc: Provide multiple-loading detection for libtalloc via rand()Andrew Bartlett2015-10-091-1/+16
| | | | | | | | | The use of rand() is strongly discrouanged, but here is it ideal, as we just want to select a different set of random bytes if we are called again within the same process. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/talloc: Disrupt buffer overflow attacks on Samba by using random magicAndrew Bartlett2015-10-092-18/+54
| | | | | | | | | | | | | | | By setting the talloc magic to a random value, we make it much harder to overwrite a talloc_chunk in a valid way with a simple buffer overflow. The flags are placed before more senstive variables so they have to be overwritten first. Inspired by the exploit in: http://blog.csnc.ch/wp-content/uploads/2012/07/sambaexploit_v1.0.pdf Andrew Bartlett Signed-off-by: Andrew Bartlett <abartlet@samba.org> Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz> Reviewed-by: Jeremy Allison <jra@samba.org>
* lib/talloc: Fix CID 1291639 Missing unlockAnoop C S2015-08-061-0/+1
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>