pyldb: py_ldb_dn_concat() uses PyErr_LDB_DN_OR_RAISE
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 14 Mar 2024 04:27:58 +0000 (17:27 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 10 Apr 2024 05:13:32 +0000 (05:13 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index 386c9478ea402d7f4cebb54e87aeed335c271684..ce6defd5306ee8a374f5de1f46db1a796b15c775 100644 (file)
@@ -980,16 +980,18 @@ static PyObject *py_ldb_dn_copy(struct ldb_dn *dn, PyLdbObject *pyldb)
        return (PyObject *)py_ret;
 }
 
-static PyObject *py_ldb_dn_concat(PyLdbDnObject *self, PyObject *py_other)
+static PyObject *py_ldb_dn_concat(PyObject *self, PyObject *py_other)
 {
        TALLOC_CTX *mem_ctx = NULL;
-       struct ldb_dn *dn = pyldb_Dn_AS_DN((PyObject *)self),
-                                 *other;
+       struct ldb_dn *dn = NULL;
+       struct ldb_dn *other = NULL;
+
        struct ldb_dn *new_dn = NULL;
-       PyLdbDnObject *py_ret;
+       PyLdbDnObject *py_ret = NULL;
 
-       if (!pyldb_Object_AsDn(NULL, py_other, NULL, &other))
-               return NULL;
+
+       PyErr_LDB_DN_OR_RAISE(self, dn);
+       PyErr_LDB_DN_OR_RAISE(py_other, other);
 
        mem_ctx = talloc_new(NULL);
        if (mem_ctx == NULL) {
@@ -1017,7 +1019,7 @@ static PyObject *py_ldb_dn_concat(PyLdbDnObject *self, PyObject *py_other)
        py_ret->mem_ctx = mem_ctx;
        py_ret->dn = new_dn;
 
-       py_ret->pyldb = self->pyldb;
+       py_ret->pyldb = ((PyLdbDnObject *)self)->pyldb;
        Py_INCREF(py_ret->pyldb);
 
        return (PyObject *)py_ret;