summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2011-08-11 13:59:00 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-08-13 12:30:48 +1000
commit65e12c05012b714dc1060650419f72266bf5ad07 (patch)
treee394f4f6d82c02f86d984c87cb48ea063a40e162 /source3
parentae9a3274bc511a302ab52ec94b43b7a0abd84fe9 (diff)
downloadsamba-65e12c05012b714dc1060650419f72266bf5ad07.tar.gz
samba-65e12c05012b714dc1060650419f72266bf5ad07.tar.bz2
samba-65e12c05012b714dc1060650419f72266bf5ad07.zip
passdb: Allocate talloc stackframe before calling in pdb functions.
Diffstat (limited to 'source3')
-rw-r--r--source3/passdb/py_passdb.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c
index ceac49112d..8d1ee5681c 100644
--- a/source3/passdb/py_passdb.c
+++ b/source3/passdb/py_passdb.c
@@ -959,10 +959,16 @@ static PyObject *py_pdb_domain_info(pytalloc_Object *self, PyObject *args)
struct pdb_methods *methods;
struct pdb_domain_info *domain_info;
PyObject *py_domain_info;
+ TALLOC_CTX *tframe;
methods = pytalloc_get_ptr(self);
- domain_info = methods->get_domain_info(methods, pytalloc_get_mem_ctx(self));
+ if ((tframe = talloc_stackframe()) == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
+ domain_info = methods->get_domain_info(methods, tframe);
if (! domain_info) {
Py_RETURN_NONE;
}
@@ -980,7 +986,7 @@ static PyObject *py_pdb_domain_info(pytalloc_Object *self, PyObject *args)
struct GUID guid;
*/
- talloc_free(domain_info);
+ talloc_free(tframe);
return py_domain_info;
}
@@ -1432,6 +1438,12 @@ static PyObject *py_passdb_backends(PyObject *self)
{
PyObject *py_blist;
const struct pdb_init_function_entry *entry;
+ TALLOC_CTX *tframe;
+
+ if ((tframe = talloc_stackframe()) == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
entry = pdb_get_backends();
if(! entry) {
@@ -1448,6 +1460,8 @@ static PyObject *py_passdb_backends(PyObject *self)
entry = entry->next;
}
+ talloc_free(tframe);
+
return py_blist;
}
@@ -1455,17 +1469,25 @@ static PyObject *py_passdb_backends(PyObject *self)
static PyObject *py_set_smb_config(PyObject *self, PyObject *args)
{
const char *smb_config;
+ TALLOC_CTX *tframe;
if (!PyArg_ParseTuple(args, "s", &smb_config)) {
return NULL;
}
+ if ((tframe = talloc_stackframe()) == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
/* Load smbconf parameters */
if (!lp_load_global(smb_config)) {
PyErr_Format(py_pdb_error, "Cannot open '%s'", smb_config);
return NULL;
}
+ talloc_free(tframe);
+
Py_RETURN_NONE;
}
@@ -1473,11 +1495,17 @@ static PyObject *py_set_smb_config(PyObject *self, PyObject *args)
static PyObject *py_set_secrets_dir(PyObject *self, PyObject *args)
{
const char *private_dir;
+ TALLOC_CTX *tframe;
if (!PyArg_ParseTuple(args, "s", &private_dir)) {
return NULL;
}
+ if ((tframe = talloc_stackframe()) == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
/* Initialize secrets database */
if (!secrets_init_path(private_dir)) {
PyErr_Format(py_pdb_error, "Cannot open secrets file database in '%s'",
@@ -1485,6 +1513,8 @@ static PyObject *py_set_secrets_dir(PyObject *self, PyObject *args)
return NULL;
}
+ talloc_free(tframe);
+
Py_RETURN_NONE;
}