From 8deae13313b87c0d7efa64e9334c06987ed90ac6 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 16 Jul 2010 13:40:50 +0300 Subject: s4-pyldb: Use ldb_msg_difference() in py_ldb_msg_diff() Signed-off-by: Andrew Bartlett --- source4/lib/ldb/pyldb.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index f27ab3dd95..19123c3c24 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -1035,9 +1035,11 @@ static PyObject *py_ldb_parse_ldif(PyLdbObject *self, PyObject *args) static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args) { + int ldb_ret; PyObject *py_msg_old; PyObject *py_msg_new; struct ldb_message *diff; + struct ldb_context *ldb; PyObject *py_ret; if (!PyArg_ParseTuple(args, "OO", &py_msg_old, &py_msg_new)) @@ -1053,14 +1055,20 @@ static PyObject *py_ldb_msg_diff(PyLdbObject *self, PyObject *args) return NULL; } - diff = ldb_msg_diff(PyLdb_AsLdbContext(self), PyLdbMessage_AsMessage(py_msg_old), PyLdbMessage_AsMessage(py_msg_new)); - if (!diff) { + ldb = PyLdb_AsLdbContext(self); + ldb_ret = ldb_msg_difference(ldb, ldb, + PyLdbMessage_AsMessage(py_msg_old), + PyLdbMessage_AsMessage(py_msg_new), + &diff); + if (ldb_ret != LDB_SUCCESS) { PyErr_SetString(PyExc_RuntimeError, "Failed to generate the Ldb Message diff"); return NULL; } py_ret = PyLdbMessage_FromMessage(diff); + talloc_unlink(ldb, diff); + return py_ret; } -- cgit