[SCM] Samba Shared Repository - branch v4-0-stable updated
Karolin Seeger
kseeger at samba.org
Wed May 6 13:12:16 MDT 2015
The branch, v4-0-stable has been updated
via 58dd8c8 WHATSNEW: Add release notes for Samba 4.0.26.
via 92e4c21 s4:auth/gensec_gssapi: let gensec_gssapi_update() return NT_STATUS_LOGON_FAILURE for unknown errors
via 786cbeb s3:configure: require external talloc >= 2.1.2
via 28e014b talloc: version 2.1.2
via 79f15e0 talloc: fix _talloc_total_limit_size prototype
via 3cbf66c lib: talloc: Test suite for the new destructor reparent logic.
via 1b584cf lib: talloc: Allow destructors to reparent the object they're called on.
via 8194d06 lib: talloc: Fix bug when calling a destructor.
via 6640cfa talloc:build: improve detection of srcdir
via 8eb3271 talloc: version 2.1.1
via 509dd16 talloc/tests: avoid some unused variable warnings
via 243be7a talloc: fix compiler warning
via f2396a6 talloc: check for TALLOC_GET_TYPE_ABORT_NOOP
via 51cc876 talloc: avoid a function call in TALLOC_FREE() if possible.
via 61e6848 talloc: inline talloc_get_name()
via 0886602 talloc: inline more static functions
via 4419cad talloc: Tune talloc_vasprintf
via d9e00c6 talloc: Update flags in pytalloc-util pkgconfig file
via 6e5df36 Add a basic guide on pytalloc.
via 2d30bcb talloc: Add a warning to talloc_reference() documentation.
via 2c3ca8f talloc: Test the pooled object
via eb093c2 talloc: Add talloc_pooled_object
via fb91890 talloc: Allow nested pools.
via 040a3e1 talloc: Add a separate pool size
via e5ff3e1 talloc: Put pool-specific data before the chunk
via aa2a731 talloc: Introduce __talloc_with_prefix
via 164fb45 talloc: Decouple the dual use of chunk->pool
via 61c0ed7 Fix valgrind errors with memmove and talloc pools.
via 571ac8c Add simple limited pool tests to test_memlimit().
via 18e14d6 Remove talloc_memlimit_update(). No longer used.
via cf58b43 Inside _talloc_realloc(), keep track of size changes over malloc/realloc/free.
via e9f3ce8 Don't call talloc_memlimit_update() inside _talloc_realloc() when we're just manipulating pool members.
via 2435334 Fix a conditional check. (size - tc->size > 0) is always true if size and tc->size are unsigned.
via 378363f In _talloc_steal_internal(), correctly decrement the memory limit in the source, and increment in the destination.
via e17b670 Inside _talloc_free_internal(), always call talloc_memlimit_update_on_free() before we free the real memory.
via 0aa59ad Update memory limits when we call free() on a pool.
via 681728a Change __talloc() to only call talloc_memlimit_check()/talloc_memlimit_grow() on actual malloc allocation.
via a49237c Change _talloc_total_mem_internal() to ignore memory allocated from a pool when calculating limit size.
via ddde41c Remove magic TC_HDR_SIZE handling inside talloc_memlimit_check().
via 079a5e6 Start to fix talloc memlimits with talloc pools.
via 6afc7bc talloc: Fix a typo
via e762b71 talloc: only provide the --enable-talloc-compat1 in standalone build
via 9935376 talloc: Simplify _talloc_free_poolmem a bit
via 1828505 talloc: Do an early return
via 5c2eade talloc: Avoid some "else" by doing early returns
via 61150fb talloc: Fix nonblank line endings
via 856220d talloc: Convert error cecking macros into fns
via 07ca908 Add tests for talloc_memlimit
via 1460f36 Add memory limiting capability to talloc
via 594e911 smbd: Stop using vfs_Chdir after SMB_VFS_DISCONNECT.
via 2722ad6 Merge tag 'samba-4.0.25' into v4-0-test
via 1a13242 VERSION: Bump version up to 4.0.26.
via 31b74e8 VERSION: Disable git snapshots for the 3.0.25 release.
via bad8f6d WHATSNEW: Add release notes for Samba 3.0.25.
via 1d573da auth: Make sure that creds_out is initialized with NULL.
via 9d5417d s3-netlogon: Make sure we do not deference a NULL pointer.
via 43feed1 CVE-2015-0240: s3: netlogon: Ensure we don't call talloc_free on an uninitialized pointer.
via 0d5069f s3: smbclient: Allinfo leaves the file handle open.
via 40b9149 printing/cups: pack requested-attributes with IPP_TAG_KEYWORD
via 9f56abb s3:smb2_server: protect against integer wrap with "smb2 max credits = 65535"
via da4e832 s3:smb2_server: always try to grant the credits the client just consumed
via 1f9586f dsdb: Add tokenGroupsGlobalAndUniversal, tokenGroups, tokenGroupsNoGCAcceptable
via f69bee5 Revert "dsdb: Add tokenGroupsGlobalAndUniversal, tokenGroups, tokenGroupsNoGCAcceptable"
via 19e184e libsmb: provide authinfo domain for encrypted session referrals
via 371d159 libsmb: provide authinfo domain for DFS referral auth
via 2856b64 libsmb: reuse connections derived from DFS referrals
via f9693a1 VERSION: Bump version up to 4.0.25.
via 9b14925 Merge tag 'samba-4.0.24' into v4-0-test
via 654b1d1 smbd: Fix CID 1063259 Uninitialized scalar variable
via 03299a2 net: Fix sam addgroupmem
via 017ff20 dsdb: Add tokenGroupsGlobalAndUniversal, tokenGroups, tokenGroupsNoGCAcceptable
via 4f6075e nsswitch: fix soname of linux nss_*.so.2 modules
via 53f27f1 selftest: use shared/libnss_wrapper_winbind.so.2
via 61c1e5a wafsamba: add optional keep_underscore=True to SAMBA_LIBRARY()
via ae18bda winbind: Retry after SESSION_EXPIRED error in ping-dc
via db79019 winbind: Retry LogonControl RPC in ping-dc after session expiration
via eb3ed91 libcli/smb: only force signing of smb2 session setups when binding a new session
via f27d938 s3:smb2_server: allow reauthentication without signing
via a7bee71 s3:smb2_server: use the global signing key to check if signing is required
via cc66e97 testprogs/test_ldb: check rootdse search with extended-dn control
via cc5599e s4:dsdb/rootdse: expand extended dn values with the AS_SYSTEM control
via 759e3fd s3:utils/profiles fix a use after free
via 997f6a9 s3:registry/regfio fix some valgrind warnings
via e71772e s3:registry/regfio read SD from the correct location
via de99f7e s3: modules: Fix *allocate* calls to follow POSIX error return convention.
via 0ad2013 s3: smbd: Fix *allocate* calls to follow POSIX error return convention.
via 339bac8 s3: smbd: Fix *allocate* calls to follow POSIX error return convention.
via b1adeee VERSION: Bump version up to 4.0.24...
from 4395552 VERSION: Disable git snapshots for the 3.0.25 release.
https://git.samba.org/?p=samba.git;a=shortlog;h=v4-0-stable
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
VERSION | 2 +-
WHATSNEW.txt | 82 +-
buildtools/wafsamba/wafsamba.py | 6 +-
...oc-util-2.0.6.sigs => pytalloc-util-2.0.8.sigs} | 0
...oc-util-2.0.6.sigs => pytalloc-util-2.1.0.sigs} | 0
...oc-util-2.0.6.sigs => pytalloc-util-2.1.1.sigs} | 0
...oc-util-2.0.6.sigs => pytalloc-util-2.1.2.sigs} | 0
.../ABI/{talloc-2.0.3.sigs => talloc-2.0.8.sigs} | 1 +
.../ABI/{talloc-2.0.3.sigs => talloc-2.1.0.sigs} | 2 +
.../ABI/{talloc-2.0.3.sigs => talloc-2.1.1.sigs} | 2 +
.../ABI/{talloc-2.0.3.sigs => talloc-2.1.2.sigs} | 2 +
lib/talloc/pytalloc-util.pc.in | 4 +-
lib/talloc/pytalloc.h | 3 +
lib/talloc/pytalloc_guide.txt | 153 ++++
lib/talloc/talloc.c | 839 ++++++++++++++++-----
lib/talloc/talloc.h | 73 +-
lib/talloc/testsuite.c | 356 +++++++++
lib/talloc/wscript | 14 +-
libcli/smb/smbXcli_base.c | 7 +-
nsswitch/wscript_build | 24 +-
selftest/target/Samba.pm | 2 +-
source3/client/client.c | 1 +
source3/configure.in | 2 +-
source3/libsmb/clidfs.c | 118 ++-
source3/modules/vfs_default.c | 17 +-
source3/modules/vfs_streams_xattr.c | 5 +-
source3/modules/vfs_time_audit.c | 8 +-
source3/printing/print_cups.c | 2 +-
source3/registry/regfio.c | 10 +-
source3/smbd/process.c | 1 +
source3/smbd/service.c | 6 +-
source3/smbd/smb2_server.c | 16 +-
source3/smbd/smb2_sesssetup.c | 4 +
source3/smbd/vfs.c | 22 +-
source3/utils/net_sam.c | 8 +-
source3/utils/profiles.c | 6 +-
source3/winbindd/winbindd_dual_srv.c | 18 +
source3/wscript_build | 7 -
source4/auth/gensec/gensec_gssapi.c | 4 +-
source4/dsdb/samdb/ldb_modules/operational.c | 66 +-
source4/dsdb/samdb/ldb_modules/rootdse.c | 6 +-
source4/dsdb/tests/python/token_group.py | 351 ++++++++-
source4/selftest/tests.py | 2 +-
testprogs/blackbox/test_ldb.sh | 2 +
44 files changed, 1942 insertions(+), 312 deletions(-)
copy lib/talloc/ABI/{pytalloc-util-2.0.6.sigs => pytalloc-util-2.0.8.sigs} (100%)
copy lib/talloc/ABI/{pytalloc-util-2.0.6.sigs => pytalloc-util-2.1.0.sigs} (100%)
copy lib/talloc/ABI/{pytalloc-util-2.0.6.sigs => pytalloc-util-2.1.1.sigs} (100%)
copy lib/talloc/ABI/{pytalloc-util-2.0.6.sigs => pytalloc-util-2.1.2.sigs} (100%)
copy lib/talloc/ABI/{talloc-2.0.3.sigs => talloc-2.0.8.sigs} (98%)
copy lib/talloc/ABI/{talloc-2.0.3.sigs => talloc-2.1.0.sigs} (96%)
copy lib/talloc/ABI/{talloc-2.0.3.sigs => talloc-2.1.1.sigs} (96%)
copy lib/talloc/ABI/{talloc-2.0.3.sigs => talloc-2.1.2.sigs} (96%)
create mode 100644 lib/talloc/pytalloc_guide.txt
Changeset truncated at 500 lines:
diff --git a/VERSION b/VERSION
index b7ef305..db42d5f 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
########################################################
SAMBA_VERSION_MAJOR=4
SAMBA_VERSION_MINOR=0
-SAMBA_VERSION_RELEASE=25
+SAMBA_VERSION_RELEASE=26
########################################################
# If a official release has a serious bug #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 80d9c95..88d1cfe 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,4 +1,82 @@
==============================
+ Release Notes for Samba 4.0.26
+ May 6, 2015
+ ==============================
+
+
+This is the last bug-fix release of the Samba 4.1 release series.
+There will be security releases only starting from now.
+
+
+Changes since 4.0.25:
+---------------------
+
+o Jeremy Allison <jra at samba.org>
+ * BUG 10982: s3: smbd: Fix *allocate* calls to follow POSIX error return
+ convention.
+ * BUG 11094: s3: smbclient: Allinfo leaves the file handle open.
+
+
+o Christian Ambach <ambi at samba.org>
+ * BUG 9629: Fix 'profiles' tool.
+
+
+o Ira Cooper <ira at samba.org>
+ * BUG 11115: smbd: Stop using vfs_Chdir after SMB_VFS_DISCONNECT.
+
+
+o David Disseldorp <ddiss at samba.org>
+ * BUG 10808: printing/cups: Pack requested-attributes with IPP_TAG_KEYWORD.
+ * BUG 11059: libsmb: Provide authinfo domain for encrypted session
+ referrals.
+
+
+o Volker Lendecke <vl at samba.org>
+ * BUG 11041: smbd: Fix CID 1063259 Uninitialized scalar variable.
+ * BUG 11051: net: Fix 'net sam addgroupmem'.
+
+
+o Stefan Metzmacher <metze at samba.org>
+ * BUG 9299: nsswitch: Fix soname of linux nss_*.so.2 modules.
+ * BUG 9702: s3:smb2_server: Protect against integer wrap with "smb2 max
+ credits = 65535".
+ * BUG 10949: s4:dsdb/rootdse: Expand extended dn values with the AS_SYSTEM
+ control.
+ * BUG 10958: libcli/smb: Nnly force signing of smb2 session setups when
+ binding a new session.
+ * BUG 11144: Fix memory leak in SMB2 notify handling.
+ * BUG 11164: s4:auth/gensec_gssapi: Let gensec_gssapi_update() return
+ NT_STATUS_LOGON_FAILURE for unknown errors.
+
+
+o Christof Schmitt <cs at samba.org>
+ * BUG 11034: winbind: Retry after SESSION_EXPIRED error in ping-dc.
+
+
+######################################################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored. All bug reports should
+be filed under the Samba 4.0 product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
+ ==============================
Release Notes for Samba 4.0.25
February 23, 2015
==============================
@@ -51,8 +129,8 @@ database (https://bugzilla.samba.org/).
======================================================================
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
+
==============================
Release Notes for Samba 4.0.24
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index d26b7b5..ba8b40b 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -109,6 +109,7 @@ def SAMBA_LIBRARY(bld, libname, source,
ldflags='',
external_library=False,
realname=None,
+ keep_underscore=False,
autoproto=None,
autoproto_extra_source='',
group='libraries',
@@ -209,7 +210,10 @@ def SAMBA_LIBRARY(bld, libname, source,
libname)
if target_type == 'PYTHON' or realname or not private_library:
- bundled_name = libname.replace('_', '-')
+ if keep_underscore:
+ bundled_name = libname
+ else:
+ bundled_name = libname.replace('_', '-')
else:
bundled_name = PRIVATE_NAME(bld, libname, bundled_extension,
private_library)
diff --git a/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.0.8.sigs
similarity index 100%
copy from lib/talloc/ABI/pytalloc-util-2.0.6.sigs
copy to lib/talloc/ABI/pytalloc-util-2.0.8.sigs
diff --git a/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.1.0.sigs
similarity index 100%
copy from lib/talloc/ABI/pytalloc-util-2.0.6.sigs
copy to lib/talloc/ABI/pytalloc-util-2.1.0.sigs
diff --git a/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.1.1.sigs
similarity index 100%
copy from lib/talloc/ABI/pytalloc-util-2.0.6.sigs
copy to lib/talloc/ABI/pytalloc-util-2.1.1.sigs
diff --git a/lib/talloc/ABI/pytalloc-util-2.0.6.sigs b/lib/talloc/ABI/pytalloc-util-2.1.2.sigs
similarity index 100%
copy from lib/talloc/ABI/pytalloc-util-2.0.6.sigs
copy to lib/talloc/ABI/pytalloc-util-2.1.2.sigs
diff --git a/lib/talloc/ABI/talloc-2.0.3.sigs b/lib/talloc/ABI/talloc-2.0.8.sigs
similarity index 98%
copy from lib/talloc/ABI/talloc-2.0.3.sigs
copy to lib/talloc/ABI/talloc-2.0.8.sigs
index 6e236d5..15a9e95 100644
--- a/lib/talloc/ABI/talloc-2.0.3.sigs
+++ b/lib/talloc/ABI/talloc-2.0.8.sigs
@@ -43,6 +43,7 @@ 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 *)
diff --git a/lib/talloc/ABI/talloc-2.0.3.sigs b/lib/talloc/ABI/talloc-2.1.0.sigs
similarity index 96%
copy from lib/talloc/ABI/talloc-2.0.3.sigs
copy to lib/talloc/ABI/talloc-2.1.0.sigs
index 6e236d5..eae12cc 100644
--- a/lib/talloc/ABI/talloc-2.0.3.sigs
+++ b/lib/talloc/ABI/talloc-2.1.0.sigs
@@ -4,6 +4,7 @@ _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 *)
@@ -43,6 +44,7 @@ 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 *)
diff --git a/lib/talloc/ABI/talloc-2.0.3.sigs b/lib/talloc/ABI/talloc-2.1.1.sigs
similarity index 96%
copy from lib/talloc/ABI/talloc-2.0.3.sigs
copy to lib/talloc/ABI/talloc-2.1.1.sigs
index 6e236d5..eae12cc 100644
--- a/lib/talloc/ABI/talloc-2.0.3.sigs
+++ b/lib/talloc/ABI/talloc-2.1.1.sigs
@@ -4,6 +4,7 @@ _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 *)
@@ -43,6 +44,7 @@ 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 *)
diff --git a/lib/talloc/ABI/talloc-2.0.3.sigs b/lib/talloc/ABI/talloc-2.1.2.sigs
similarity index 96%
copy from lib/talloc/ABI/talloc-2.0.3.sigs
copy to lib/talloc/ABI/talloc-2.1.2.sigs
index 6e236d5..eae12cc 100644
--- a/lib/talloc/ABI/talloc-2.0.3.sigs
+++ b/lib/talloc/ABI/talloc-2.1.2.sigs
@@ -4,6 +4,7 @@ _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 *)
@@ -43,6 +44,7 @@ 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 *)
diff --git a/lib/talloc/pytalloc-util.pc.in b/lib/talloc/pytalloc-util.pc.in
index bc704b4..b7426bb 100644
--- a/lib/talloc/pytalloc-util.pc.in
+++ b/lib/talloc/pytalloc-util.pc.in
@@ -6,6 +6,6 @@ includedir=@includedir@
Name: pytalloc-util
Description: Utility functions for using talloc objects with Python
Version: @TALLOC_VERSION@
-Libs: -L${libdir} -lpytalloc-util
-Cflags: @LIB_RPATH@ -I${includedir}
+Libs: @LIB_RPATH@ -L${libdir} -lpytalloc-util
+Cflags: -I${includedir}
URL: http://talloc.samba.org/
diff --git a/lib/talloc/pytalloc.h b/lib/talloc/pytalloc.h
index 2d2c57b..5c3876e 100644
--- a/lib/talloc/pytalloc.h
+++ b/lib/talloc/pytalloc.h
@@ -29,7 +29,10 @@ typedef struct {
void *ptr;
} pytalloc_Object;
+/* Return the PyTypeObject for pytalloc_Object. Returns a new reference. */
PyTypeObject *pytalloc_GetObjectType(void);
+
+/* Check whether a specific object is a talloc Object. */
int pytalloc_Check(PyObject *);
/* Retrieve the pointer for a pytalloc_object. Like talloc_get_type()
diff --git a/lib/talloc/pytalloc_guide.txt b/lib/talloc/pytalloc_guide.txt
new file mode 100644
index 0000000..755a52b
--- /dev/null
+++ b/lib/talloc/pytalloc_guide.txt
@@ -0,0 +1,153 @@
+Using talloc in Samba4
+======================
+
+.. contents::
+
+Jelmer Vernooij
+August 2013
+
+The most current version of this document is available at
+ http://samba.org/ftp/unpacked/talloc/pytalloc_guide.txt
+
+pytalloc is a small library that provides glue for wrapping
+talloc-allocated objects from C in Python objects.
+
+What is pytalloc, and what is it not?
+-------------------------------------
+
+pytalloc is merely a helper library - it provides a convenient base type object
+for objects that wrap talloc-maintained memory in C. It won't write your
+bindings for you but it will make it easier to write C bindings that involve
+talloc, and take away some of the boiler plate.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+pytalloc_Object
+
+This is the new base class that all Python objects that wrap talloc pointers
+derive from. It is itself a subclass of the "Object" type that all objects
+in Python derive from.
+
+Note that you will almost never create objects of the pytalloc_Object type
+itself, as they are just opaque pointers that can not be accessed from
+Python. A common pattern is other objects that subclass pytalloc_Object and
+rely on it for their memory management.
+
+Each `pytalloc_Object` wraps two core of information - a talloc context
+and a pointer. The pointer is the actual data that is wrapped. The talloc
+context is used for memory management purposes only; when the wrapping Python object
+goes away, it unlinks the talloc context. The talloc context pointer and the ptr
+can (and often do) have the same value.
+
+Each pytalloc_Object has a custom __repr__ implementation that
+describes that it is a talloc object and the location of the
+pointer it is wrapping. it also has a custom __cmp__/__eq__/__neq__ method that
+compares the pointers the object is wrapping rather than the objects
+themselves (since there can be multiple objects that wrap the same talloc
+pointer).
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+PyTypeObject *pytalloc_GetObjectType(void)
+
+Obtain a reference to the PyTypeObject for `pytalloc_Object`. The reference
+counter for the object will be incremented, so the caller will have to
+decrement it when it no longer needs it (using `Py_DECREF`).
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-
+int pytalloc_Check(PyObject *)
+
+Check whether a specific object is a talloc Object. Returns non-zero if it is
+a pytalloc_Object and zero otherwise.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+type *pytalloc_get_type(PyObject *py_obj, type)
+
+Retrieve the pointer from a `pytalloc_Object` py_obj. type should be a
+C type, similar to a type passed to `talloc_get_type`.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+pytalloc_get_ptr(PyObject *py_obj)
+
+Retrieve the pointer from a `pytalloc_Object` py_obj. There is no
+type checking - use `pytalloc_get_type` if possible.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+TALLOC_CTX *pytalloc_get_mem_ctx(PyObject *py_obj)
+
+Retrieve the talloc context associated with a pytalloc_Object.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+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.
+
+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_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.
+
+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_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.
+
+This will increment the reference counter for the talloc context.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+PyObject *pytalloc_reference(PyTypeObject *py_type, void *talloc_ptr)
+
+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.
+
+This will increment the reference counter for the talloc context.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+PyObject *pytalloc_new(type, PyTypeObject *typeobj)
+
+Create a new, empty pytalloc_Object with the specified Python type object. type
+should be a C type, similar to talloc_new().
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+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.
+
+Debug function for talloc in Python
+-----------------------------------
+
+The "talloc" module in Python provides a couple of functions that can be used
+to debug issues with objects wrapped by pytalloc.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+report_full(obj?)
+
+Print a full report on a specific object or on all allocated objects by Python.
+Same behaviour as the `talloc_report_full()` function that is provided by
+C talloc.
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+enable_null_tracking()
+
+This enables tracking of the NULL memory context without enabling leak
+reporting on exit. Useful for when you want to do your own leak
+reporting call via talloc_report_null_full().
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+pytalloc_total_blocks(obj?)
+
+Return the talloc block count for all allocated objects or a specific object if
+specified.
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 18ee548..c10fd53 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1,4 +1,4 @@
-/*
+/*
Samba Unix SMB/CIFS implementation.
Samba trivial allocation library - new interface
@@ -7,11 +7,11 @@
Copyright (C) Andrew Tridgell 2004
Copyright (C) Stefan Metzmacher 2006
-
+
** NOTE! The following LGPL license applies to the talloc
** 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
@@ -71,9 +71,10 @@
#define TALLOC_FLAG_LOOP 0x02
#define TALLOC_FLAG_POOL 0x04 /* This is a talloc pool */
#define TALLOC_FLAG_POOLMEM 0x08 /* This is allocated in a pool */
+
#define TALLOC_MAGIC_REFERENCE ((const char *)1)
-/* by default we abort when given a bad pointer (such as when talloc_free() is called
+/* by default we abort when given a bad pointer (such as when talloc_free() is called
on a pointer that came from malloc() */
#ifndef TALLOC_ABORT
#define TALLOC_ABORT(reason) abort()
@@ -227,8 +228,26 @@ struct talloc_reference_handle {
const char *location;
};
+struct talloc_memlimit {
+ struct talloc_chunk *parent;
+ struct talloc_memlimit *upper;
+ size_t max_size;
+ size_t cur_size;
+};
+
+static inline bool talloc_memlimit_check(struct talloc_memlimit *limit, size_t size);
+static inline void talloc_memlimit_grow(struct talloc_memlimit *limit,
+ 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 _talloc_set_name_const(const void *ptr, const char *name);
+
typedef int (*talloc_destructor_t)(void *);
+struct talloc_pool_hdr;
+
struct talloc_chunk {
struct talloc_chunk *next, *prev;
struct talloc_chunk *parent, *child;
@@ -239,17 +258,21 @@ struct talloc_chunk {
unsigned flags;
/*
- * "pool" has dual use:
- *
- * For the talloc pool itself (i.e. TALLOC_FLAG_POOL is set), "pool"
- * marks the end of the currently allocated area.
- *
- * For members of the pool (i.e. TALLOC_FLAG_POOLMEM is set), "pool"
+ * limit semantics:
+ * if 'limit' is set it means all *new* children of the context will
+ * be limited to a total aggregate size ox max_size for memory
+ * allocations.
+ * cur_size is used to keep track of the current use
--
Samba Shared Repository
More information about the samba-cvs
mailing list