summaryrefslogtreecommitdiff
path: root/source4/auth/credentials
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-04-20 15:33:00 +1000
committerAndrew Tridgell <tridge@samba.org>2010-04-20 15:50:27 +1000
commitf1c523939b88aee0b1ce7375d68b06a0b8cf5d28 (patch)
treeaae27335d6a01e6ffaaf2a7901ef6b1aa14eae3d /source4/auth/credentials
parent45be1c7ba4382d85c742a241687bbc6d5a2ebd8c (diff)
downloadsamba-f1c523939b88aee0b1ce7375d68b06a0b8cf5d28.tar.gz
samba-f1c523939b88aee0b1ce7375d68b06a0b8cf5d28.tar.bz2
samba-f1c523939b88aee0b1ce7375d68b06a0b8cf5d28.zip
pytalloc: ensure talloc_ctx is directly after PyObject_HEAD
the talloc python interface for tp_alloc and tp_dealloc relies on a cast to a py_talloc_Object to find the talloc_ctx (see py_talloc_dealloc). This means we rely on the talloc_ctx for the object being directly after the PyObject_HEAD This fixes the talloc free with references bug in samba_dnsupdate The actual problem was the tp_alloc() call in PyCredentialCacheContainer_from_ccache_container() which used a cast from a py_talloc_Object to a PyCredentialCacheContainerObject. That case effectively changed the parent/child relationship between the talloc_ctx and the ccc ptr. This patch changes all the structures that follow this pattern to put the TALLOC_CTX directly after the PyObject_HEAD, to ensure that if anyone else decides to do a dangerous cast like this that it won't cause the same sort of subtle breakage. Pair-Programmed-With: Rusty Russell <rusty@samba.org>
Diffstat (limited to 'source4/auth/credentials')
-rw-r--r--source4/auth/credentials/pycredentials.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/source4/auth/credentials/pycredentials.h b/source4/auth/credentials/pycredentials.h
index 6d03ca158b..09deb05e58 100644
--- a/source4/auth/credentials/pycredentials.h
+++ b/source4/auth/credentials/pycredentials.h
@@ -26,8 +26,8 @@ PyAPI_DATA(PyTypeObject) PyCredentials;
PyAPI_DATA(PyTypeObject) PyCredentialCacheContainer;
typedef struct {
PyObject_HEAD
- struct ccache_container *ccc;
TALLOC_CTX *mem_ctx;
+ struct ccache_container *ccc;
} PyCredentialCacheContainerObject;
#define PyCredentials_Check(py_obj) PyObject_TypeCheck(py_obj, &PyCredentials)
#define PyCredentials_AsCliCredentials(py_obj) py_talloc_get_type(py_obj, struct cli_credentials)