mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
pyldb: py_ldb_dn_get_parent() uses PyErr_LDB_DN_OR_RAISE
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
8830149ef9
commit
1eeb0e3651
@ -605,14 +605,17 @@ static PyObject *py_ldb_dn_richcmp(PyObject *pydn1, PyObject *pydn2, int op)
|
||||
return richcmp(ret, op);
|
||||
}
|
||||
|
||||
static PyObject *py_ldb_dn_get_parent(PyLdbDnObject *self,
|
||||
static PyObject *py_ldb_dn_get_parent(PyObject *self,
|
||||
PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
struct ldb_dn *dn = pyldb_Dn_AS_DN((PyObject *)self);
|
||||
struct ldb_dn *dn = NULL;
|
||||
struct ldb_dn *parent;
|
||||
PyLdbDnObject *py_ret;
|
||||
PyLdbDnObject *py_ret = NULL;
|
||||
PyLdbDnObject *dn_self = NULL;
|
||||
TALLOC_CTX *mem_ctx = NULL;
|
||||
|
||||
PyErr_LDB_DN_OR_RAISE(self, dn);
|
||||
|
||||
if (ldb_dn_get_comp_num(dn) < 1) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
@ -636,9 +639,11 @@ static PyObject *py_ldb_dn_get_parent(PyLdbDnObject *self,
|
||||
talloc_free(mem_ctx);
|
||||
return NULL;
|
||||
}
|
||||
dn_self = (PyLdbDnObject *)self;
|
||||
|
||||
py_ret->mem_ctx = mem_ctx;
|
||||
py_ret->dn = parent;
|
||||
py_ret->pyldb = self->pyldb;
|
||||
py_ret->pyldb = dn_self->pyldb;
|
||||
Py_INCREF(py_ret->pyldb);
|
||||
return (PyObject *)py_ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user