From: Andrew Bartlett Date: Mon, 4 Dec 2023 21:08:23 +0000 (+1300) Subject: dsdb: Use pyldb_Ldb_AsLdbContext() in PyErr_LDB_OR_RAISE() X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=da63ee78b3427865b51631a2ffb690b356e0f521;p=npower%2Fsamba-autobuild%2F.git dsdb: Use pyldb_Ldb_AsLdbContext() in PyErr_LDB_OR_RAISE() This macro already checks the type, so we do not need to call py_check_dcerpc_type() and prepares to move this macro into pyldb.h Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c index 7f77f2b7834..594d111f0ba 100644 --- a/source4/dsdb/pydsdb.c +++ b/source4/dsdb/pydsdb.c @@ -39,11 +39,11 @@ /* FIXME: These should be in a header file somewhere */ #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \ - if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \ + ldb = pyldb_Ldb_AsLdbContext(py_ldb); \ + if (!ldb) { \ PyErr_SetString(PyExc_TypeError, "Ldb connection object required"); \ return NULL; \ - } \ - ldb = pyldb_Ldb_AS_LDBCONTEXT(py_ldb); + } #define PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn) \ if (!py_check_dcerpc_type(py_ldb_dn, "ldb", "Dn")) { \