The branch, master has been updated via c80606274fd ldb ABI bump for pyldb_Ldb_AsLdbContext change via fdb9a59069c pyldb: ldb.register_module() checks arguments a little bit via 192386ede62 pyldb: remove ldb.open, which was never survivable via 3af57daa840 py segfault test: ldb.open via 545e95386f6 py segfault test: ldb.register_module via 1d6b472cdcd pyldb: rename pyldb_Dn_AsDn() to pyldb_Dn_AS_DN() via 339f8bbdda0 pyldb: check for errors in PyLdb_GetPyType() via e075f52a750 pyldb: fork pyldb_Ldb_AsLdbContext macro to reflect unsafeness via f5e0339a0de pyldb: add pyldb_check_type() via 19a13cbe068 ldb: do not allow adding a DN as a base to itself from 09ddad6c14d s3: smbd: Remove ifdef'ed out dptr_close_oldest().
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit c80606274fdb1f1736e74e8da26d918bf259922e Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Sun Jul 7 12:49:57 2019 +1200 ldb ABI bump for pyldb_Ldb_AsLdbContext change Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> Autobuild-User(master): Douglas Bagnall <dbagn...@samba.org> Autobuild-Date(master): Wed Jul 10 05:48:52 UTC 2019 on sn-devel-184 commit fdb9a59069c5fea131669510b59901cbe3d9e58e Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jul 4 16:43:12 2019 +1200 pyldb: ldb.register_module() checks arguments a little bit Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 192386ede62c4a72c0fbc173240f02357455c609 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jul 4 16:29:56 2019 +1200 pyldb: remove ldb.open, which was never survivable There was no way to call ldb.open without evoking signal 11, so it is unlikely anyone was using it. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 3af57daa8404476773cef3be544a82ac419f961d Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jul 4 03:59:42 2019 +0000 py segfault test: ldb.open There seems to be no way of using ldb.open without causing a segfault Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 545e95386f6a37009975718f2f5ad03390d9296d Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu Jul 4 03:59:11 2019 +0000 py segfault test: ldb.register_module Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 1d6b472cdcddbd6892741a381f33faf0b4ddc847 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Fri Apr 27 13:15:01 2018 +1200 pyldb: rename pyldb_Dn_AsDn() to pyldb_Dn_AS_DN() Following the python/C convention for checking vs non-checking convertors. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 339f8bbdda04a23460e7fa908d60857b95271c6e Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu May 3 11:17:55 2018 +1200 pyldb: check for errors in PyLdb_GetPyType() Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit e075f52a7508979b744fde463d6184405d7a3772 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Fri Apr 20 16:23:42 2018 +1200 pyldb: fork pyldb_Ldb_AsLdbContext macro to reflect unsafeness In the Python/C API, conversion functions which check the types of their arguments have names like: double PyFloat_AsDouble(PyObject *pyfloat); while conversion macros that don't check have names like: PyFloat_AS_DOUBLE(pyfloat) The pyldb_Ldb_AsLdbContext() macro looks like one of the checking functions but it actually isn't. This has fooled us more than once. Here we fork the macro into two -- one which performs checks and keeps the camel case, and one with a shouty name that keeps the check-free behaviour. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit f5e0339a0de71dc7d07f3ba95e6573076efe9efd Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Thu May 3 12:10:21 2018 +1200 pyldb: add pyldb_check_type() This will be used by pyldb_Ldb_AsLdbContext(). Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> commit 19a13cbe0681b3996c33f7449f69b0fb0dc5d640 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Sat Jul 6 23:24:43 2019 +1200 ldb: do not allow adding a DN as a base to itself If you try to add a dn to itself, it expands as it goes. The resulting loop cannot end well. It looks like this in Python: dn = ldb.Dn(ldb.Ldb(), 'CN=y,DC=x') dn.add_base(dn) Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Gary Lockyer <g...@catalyst.net.nz> ----------------------------------------------------------------------- Summary of changes: lib/ldb-samba/pyldb.c | 14 +-- lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.1.0.sigs} | 0 ...yldb-util-1.1.10.sigs => pyldb-util-2.1.0.sigs} | 1 + lib/ldb/common/ldb_dn.c | 4 + lib/ldb/pyldb.c | 127 +++++++++++---------- lib/ldb/pyldb.h | 12 +- lib/ldb/pyldb_util.c | 37 +++++- lib/ldb/wscript | 2 +- python/samba/tests/segfault.py | 4 + selftest/knownfail.d/python-segfaults | 2 - source4/dns_server/pydns.c | 2 +- source4/dsdb/pydsdb.c | 4 +- 12 files changed, 128 insertions(+), 81 deletions(-) copy lib/ldb/ABI/{ldb-2.0.5.sigs => ldb-2.1.0.sigs} (100%) copy lib/ldb/ABI/{pyldb-util-1.1.10.sigs => pyldb-util-2.1.0.sigs} (73%) Changeset truncated at 500 lines: diff --git a/lib/ldb-samba/pyldb.c b/lib/ldb-samba/pyldb.c index b4839785c05..48adc74b16a 100644 --- a/lib/ldb-samba/pyldb.c +++ b/lib/ldb-samba/pyldb.c @@ -56,7 +56,7 @@ static PyObject *py_ldb_set_loadparm(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &py_lp_ctx)) return NULL; - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); lp_ctx = lpcfg_from_py_object(ldb, py_lp_ctx); if (lp_ctx == NULL) { @@ -84,7 +84,7 @@ static PyObject *py_ldb_set_credentials(PyObject *self, PyObject *args) return NULL; } - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); ldb_set_opaque(ldb, "credentials", creds); @@ -104,7 +104,7 @@ static PyObject *py_ldb_set_opaque_integer(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "si", &py_opaque_name, &value)) return NULL; - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); /* see if we have a cached copy */ old_val = (int *)ldb_get_opaque(ldb, py_opaque_name); @@ -161,7 +161,7 @@ static PyObject *py_ldb_set_utf8_casefold(PyObject *self, { struct ldb_context *ldb; - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); ldb_set_utf8_fns(ldb, NULL, wrap_casefold); @@ -195,7 +195,7 @@ static PyObject *py_ldb_set_session_info(PyObject *self, PyObject *args) if (!ret) return NULL; - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); info = PyAuthSession_AsSession(py_session_info); @@ -216,7 +216,7 @@ static PyObject *py_ldb_samba_schema_attribute_add(PyLdbObject *self, if (!PyArg_ParseTuple(args, "sIs", &attribute, &flags, &syntax)) return NULL; - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AsLdbContext((PyObject *)self); s = ldb_samba_syntax_by_name(ldb_ctx, syntax); ret = ldb_schema_attribute_add_with_syntax(ldb_ctx, attribute, @@ -235,7 +235,7 @@ static PyObject *py_ldb_register_samba_handlers(PyObject *self, /* XXX: Perhaps call this from PySambaLdb's init function ? */ - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); ret = ldb_register_samba_handlers(ldb); PyErr_LDB_ERROR_IS_ERR_RAISE(py_ldb_error, ret, ldb); diff --git a/lib/ldb/ABI/ldb-2.0.5.sigs b/lib/ldb/ABI/ldb-2.1.0.sigs similarity index 100% copy from lib/ldb/ABI/ldb-2.0.5.sigs copy to lib/ldb/ABI/ldb-2.1.0.sigs diff --git a/lib/ldb/ABI/pyldb-util-1.1.10.sigs b/lib/ldb/ABI/pyldb-util-2.1.0.sigs similarity index 73% copy from lib/ldb/ABI/pyldb-util-1.1.10.sigs copy to lib/ldb/ABI/pyldb-util-2.1.0.sigs index 74d6719d2bc..164a806b2ff 100644 --- a/lib/ldb/ABI/pyldb-util-1.1.10.sigs +++ b/lib/ldb/ABI/pyldb-util-2.1.0.sigs @@ -1,2 +1,3 @@ pyldb_Dn_FromDn: PyObject *(struct ldb_dn *) pyldb_Object_AsDn: bool (TALLOC_CTX *, PyObject *, struct ldb_context *, struct ldb_dn **) +pyldb_check_type: bool (PyObject *, const char *) diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c index 2e98f391467..eccb4a0ce4b 100644 --- a/lib/ldb/common/ldb_dn.c +++ b/lib/ldb/common/ldb_dn.c @@ -1357,6 +1357,10 @@ bool ldb_dn_add_base(struct ldb_dn *dn, struct ldb_dn *base) return false; } + if (dn == base) { + return false; /* or we will visit infinity */ + } + if (dn->components) { unsigned int i; diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 868e3665128..a6069be46a9 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -212,7 +212,7 @@ static PyObject *py_ldb_control_new(PyTypeObject *type, PyObject *args, PyObject return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(py_ldb); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(py_ldb); parsed_controls = ldb_parse_control_from_string(ldb_ctx, mem_ctx, data); if (!parsed_controls) { @@ -603,14 +603,14 @@ static PyObject *py_ldb_dn_richcmp(PyObject *dn1, PyObject *dn2, int op) Py_INCREF(Py_NotImplemented); return Py_NotImplemented; } - ret = ldb_dn_compare(pyldb_Dn_AsDn(dn1), pyldb_Dn_AsDn(dn2)); + ret = ldb_dn_compare(pyldb_Dn_AS_DN(dn1), pyldb_Dn_AS_DN(dn2)); return richcmp(ret, op); } static PyObject *py_ldb_dn_get_parent(PyLdbDnObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_dn *dn = pyldb_Dn_AsDn((PyObject *)self); + struct ldb_dn *dn = pyldb_Dn_AS_DN((PyObject *)self); struct ldb_dn *parent; PyLdbDnObject *py_ret; TALLOC_CTX *mem_ctx = talloc_new(NULL); @@ -639,7 +639,7 @@ static PyObject *py_ldb_dn_add_child(PyLdbDnObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &py_other)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); if (!pyldb_Object_AsDn(NULL, py_other, ldb_dn_get_ldb_context(dn), &other)) return NULL; @@ -654,7 +654,7 @@ static PyObject *py_ldb_dn_add_base(PyLdbDnObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &py_other)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); if (!pyldb_Object_AsDn(NULL, py_other, ldb_dn_get_ldb_context(dn), &other)) return NULL; @@ -669,7 +669,7 @@ static PyObject *py_ldb_dn_remove_base_components(PyLdbDnObject *self, PyObject if (!PyArg_ParseTuple(args, "i", &i)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); return PyBool_FromLong(ldb_dn_remove_base_components(dn, i)); } @@ -681,7 +681,7 @@ static PyObject *py_ldb_dn_is_child_of(PyLdbDnObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "O", &py_base)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); if (!pyldb_Object_AsDn(NULL, py_base, ldb_dn_get_ldb_context(dn), &base)) return NULL; @@ -698,7 +698,7 @@ static PyObject *py_ldb_dn_get_component_name(PyLdbDnObject *self, PyObject *arg if (!PyArg_ParseTuple(args, "I", &num)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); name = ldb_dn_get_component_name(dn, num); if (name == NULL) { @@ -717,7 +717,7 @@ static PyObject *py_ldb_dn_get_component_value(PyLdbDnObject *self, PyObject *ar if (!PyArg_ParseTuple(args, "I", &num)) return NULL; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); val = ldb_dn_get_component_val(dn, num); if (val == NULL) { @@ -756,7 +756,7 @@ static PyObject *py_ldb_dn_get_rdn_name(PyLdbDnObject *self, struct ldb_dn *dn; const char *name; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); name = ldb_dn_get_rdn_name(dn); if (name == NULL) { @@ -772,7 +772,7 @@ static PyObject *py_ldb_dn_get_rdn_value(PyLdbDnObject *self, struct ldb_dn *dn; const struct ldb_val *val; - dn = pyldb_Dn_AsDn((PyObject *)self); + dn = pyldb_Dn_AS_DN((PyObject *)self); val = ldb_dn_get_rdn_val(dn); if (val == NULL) { @@ -853,7 +853,7 @@ static PyMethodDef py_ldb_dn_methods[] = { static Py_ssize_t py_ldb_dn_len(PyLdbDnObject *self) { - return ldb_dn_get_comp_num(pyldb_Dn_AsDn((PyObject *)self)); + return ldb_dn_get_comp_num(pyldb_Dn_AS_DN((PyObject *)self)); } /* @@ -875,7 +875,7 @@ static PyObject *py_ldb_dn_copy(struct ldb_dn *dn) static PyObject *py_ldb_dn_concat(PyLdbDnObject *self, PyObject *py_other) { - struct ldb_dn *dn = pyldb_Dn_AsDn((PyObject *)self), + struct ldb_dn *dn = pyldb_Dn_AS_DN((PyObject *)self), *other; PyLdbDnObject *py_ret; @@ -917,8 +917,7 @@ static PyObject *py_ldb_dn_new(PyTypeObject *type, PyObject *args, PyObject *kwa PyErr_SetString(PyExc_TypeError, "Expected Ldb"); goto out; } - - ldb_ctx = pyldb_Ldb_AsLdbContext(py_ldb); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(py_ldb); mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { @@ -993,7 +992,7 @@ static PyObject *py_ldb_set_debug(PyObject *self, PyObject *args) Py_INCREF(cb); /* FIXME: DECREF cb when exiting program */ py_ldb_debug_func = cb; - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_set_debug(ldb_ctx, py_ldb_debug, cb), ldb_ctx); @@ -1007,7 +1006,7 @@ static PyObject *py_ldb_set_create_perms(PyTypeObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "I", &perms)) return NULL; - ldb_set_create_perms(pyldb_Ldb_AsLdbContext(self), perms); + ldb_set_create_perms(pyldb_Ldb_AS_LDBCONTEXT(self), perms); Py_RETURN_NONE; } @@ -1018,7 +1017,7 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &modules_dir)) return NULL; - ldb_set_modules_dir(pyldb_Ldb_AsLdbContext(self), modules_dir); + ldb_set_modules_dir(pyldb_Ldb_AS_LDBCONTEXT(self), modules_dir); Py_RETURN_NONE; } @@ -1026,7 +1025,7 @@ static PyObject *py_ldb_set_modules_dir(PyTypeObject *self, PyObject *args) static PyObject *py_ldb_transaction_start(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); int ldb_err; ldb_err = ldb_transaction_start(ldb_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); @@ -1036,7 +1035,7 @@ static PyObject *py_ldb_transaction_start(PyLdbObject *self, static PyObject *py_ldb_transaction_commit(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); int ldb_err; ldb_err = ldb_transaction_commit(ldb_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); @@ -1046,7 +1045,7 @@ static PyObject *py_ldb_transaction_commit(PyLdbObject *self, static PyObject *py_ldb_transaction_prepare_commit(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); int ldb_err; ldb_err = ldb_transaction_prepare_commit(ldb_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); @@ -1056,7 +1055,7 @@ static PyObject *py_ldb_transaction_prepare_commit(PyLdbObject *self, static PyObject *py_ldb_transaction_cancel(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); int ldb_err; ldb_err = ldb_transaction_cancel(ldb_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); @@ -1066,7 +1065,7 @@ static PyObject *py_ldb_transaction_cancel(PyLdbObject *self, static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb_ctx = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); int ldb_err; ldb_err = ldb_setup_wellknown_attributes(ldb_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ldb_err, ldb_ctx); @@ -1081,7 +1080,7 @@ static PyObject *py_ldb_repr(PyLdbObject *self) static PyObject *py_ldb_get_root_basedn(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_dn *dn = ldb_get_root_basedn(pyldb_Ldb_AsLdbContext(self)); + struct ldb_dn *dn = ldb_get_root_basedn(pyldb_Ldb_AS_LDBCONTEXT(self)); if (dn == NULL) Py_RETURN_NONE; return py_ldb_dn_copy(dn); @@ -1091,7 +1090,7 @@ static PyObject *py_ldb_get_root_basedn(PyLdbObject *self, static PyObject *py_ldb_get_schema_basedn(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_dn *dn = ldb_get_schema_basedn(pyldb_Ldb_AsLdbContext(self)); + struct ldb_dn *dn = ldb_get_schema_basedn(pyldb_Ldb_AS_LDBCONTEXT(self)); if (dn == NULL) Py_RETURN_NONE; return py_ldb_dn_copy(dn); @@ -1100,7 +1099,7 @@ static PyObject *py_ldb_get_schema_basedn(PyLdbObject *self, static PyObject *py_ldb_get_config_basedn(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_dn *dn = ldb_get_config_basedn(pyldb_Ldb_AsLdbContext(self)); + struct ldb_dn *dn = ldb_get_config_basedn(pyldb_Ldb_AS_LDBCONTEXT(self)); if (dn == NULL) Py_RETURN_NONE; return py_ldb_dn_copy(dn); @@ -1109,7 +1108,7 @@ static PyObject *py_ldb_get_config_basedn(PyLdbObject *self, static PyObject *py_ldb_get_default_basedn(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_dn *dn = ldb_get_default_basedn(pyldb_Ldb_AsLdbContext(self)); + struct ldb_dn *dn = ldb_get_default_basedn(pyldb_Ldb_AS_LDBCONTEXT(self)); if (dn == NULL) Py_RETURN_NONE; return py_ldb_dn_copy(dn); @@ -1165,7 +1164,7 @@ static int py_ldb_init(PyLdbObject *self, PyObject *args, PyObject *kwargs) &url, &flags, &py_options)) return -1; - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_options == Py_None) { options = NULL; @@ -1233,7 +1232,7 @@ static PyObject *py_ldb_connect(PyLdbObject *self, PyObject *args, PyObject *kwa return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); ret = ldb_connect(ldb_ctx, url, flags, options); talloc_free(options); @@ -1265,7 +1264,7 @@ static PyObject *py_ldb_modify(PyLdbObject *self, PyObject *args, PyObject *kwar PyErr_NoMemory(); return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_controls == Py_None) { parsed_controls = NULL; @@ -1414,7 +1413,7 @@ static PyObject *py_ldb_add(PyLdbObject *self, PyObject *args, PyObject *kwargs) PyErr_NoMemory(); return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_controls == Py_None) { parsed_controls = NULL; @@ -1507,7 +1506,7 @@ static PyObject *py_ldb_delete(PyLdbObject *self, PyObject *args, PyObject *kwar PyErr_NoMemory(); return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_controls == Py_None) { parsed_controls = NULL; @@ -1573,7 +1572,7 @@ static PyObject *py_ldb_rename(PyLdbObject *self, PyObject *args, PyObject *kwar struct ldb_request *req; const char * const kwnames[] = { "dn1", "dn2", "controls", NULL }; - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|O", discard_const_p(char *, kwnames), @@ -1651,7 +1650,7 @@ static PyObject *py_ldb_schema_attribute_remove(PyLdbObject *self, PyObject *arg if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - ldb_schema_attribute_remove(pyldb_Ldb_AsLdbContext(self), name); + ldb_schema_attribute_remove(pyldb_Ldb_AS_LDBCONTEXT(self), name); Py_RETURN_NONE; } @@ -1666,7 +1665,7 @@ static PyObject *py_ldb_schema_attribute_add(PyLdbObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "sIs", &attribute, &flags, &syntax)) return NULL; - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); ret = ldb_schema_attribute_add(ldb_ctx, attribute, flags, syntax); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); @@ -1713,7 +1712,7 @@ static PyObject *py_ldb_write_ldif(PyLdbObject *self, PyObject *args) mem_ctx = talloc_new(NULL); - string = ldb_ldif_write_string(pyldb_Ldb_AsLdbContext(self), mem_ctx, &ldif); + string = ldb_ldif_write_string(pyldb_Ldb_AS_LDBCONTEXT(self), mem_ctx, &ldif); if (!string) { PyErr_SetString(PyExc_KeyError, "Failed to generate LDIF"); return NULL; @@ -1820,7 +1819,7 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args) return NULL; } - ldb = pyldb_Ldb_AsLdbContext(self); + ldb = pyldb_Ldb_AS_LDBCONTEXT(self); ldb_ret = ldb_msg_difference(ldb, ldb, pyldb_Message_AsMessage(py_msg_old), pyldb_Message_AsMessage(py_msg_new), @@ -1860,7 +1859,7 @@ static PyObject *py_ldb_schema_format_value(PyLdbObject *self, PyObject *args) return NULL; } - a = ldb_schema_attribute_by_name(pyldb_Ldb_AsLdbContext(self), element_name); + a = ldb_schema_attribute_by_name(pyldb_Ldb_AS_LDBCONTEXT(self), element_name); if (a == NULL) { Py_RETURN_NONE; @@ -1872,7 +1871,7 @@ static PyObject *py_ldb_schema_format_value(PyLdbObject *self, PyObject *args) return NULL; } - if (a->syntax->ldif_write_fn(pyldb_Ldb_AsLdbContext(self), mem_ctx, &old_val, &new_val) != 0) { + if (a->syntax->ldif_write_fn(pyldb_Ldb_AS_LDBCONTEXT(self), mem_ctx, &old_val, &new_val) != 0) { talloc_free(mem_ctx); Py_RETURN_NONE; } @@ -1914,7 +1913,7 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar PyErr_NoMemory(); return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_attrs == Py_None) { attrs = NULL; @@ -2109,7 +2108,7 @@ static PyObject *py_ldb_search_iterator(PyLdbObject *self, PyObject *args, PyObj return NULL; } - ldb_ctx = pyldb_Ldb_AsLdbContext(self); + ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); if (py_attrs == Py_None) { attrs = NULL; @@ -2193,7 +2192,7 @@ static PyObject *py_ldb_get_opaque(PyLdbObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - data = ldb_get_opaque(pyldb_Ldb_AsLdbContext(self), name); + data = ldb_get_opaque(pyldb_Ldb_AS_LDBCONTEXT(self), name); if (data == NULL) Py_RETURN_NONE; @@ -2213,7 +2212,7 @@ static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args) /* FIXME: More interpretation */ - ldb_set_opaque(pyldb_Ldb_AsLdbContext(self), name, data); + ldb_set_opaque(pyldb_Ldb_AS_LDBCONTEXT(self), name, data); Py_RETURN_NONE; } @@ -2221,7 +2220,7 @@ static PyObject *py_ldb_set_opaque(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_modules(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) { - struct ldb_context *ldb = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb = pyldb_Ldb_AS_LDBCONTEXT(self); PyObject *ret = PyList_New(0); struct ldb_module *mod; @@ -2250,7 +2249,7 @@ static PyObject *py_ldb_modules(PyLdbObject *self, static PyObject *py_ldb_sequence_number(PyLdbObject *self, PyObject *args) { - struct ldb_context *ldb = pyldb_Ldb_AsLdbContext(self); + struct ldb_context *ldb = pyldb_Ldb_AS_LDBCONTEXT(self); int type, ret; uint64_t value; @@ -2277,7 +2276,7 @@ static const struct ldb_dn_extended_syntax test_dn_syntax = { static PyObject *py_ldb_register_test_extensions(PyLdbObject *self, PyObject *Py_UNUSED(ignored)) -- Samba Shared Repository