diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-07-16 13:40:50 +0300 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-07-19 17:33:34 +1000 |
commit | 8deae13313b87c0d7efa64e9334c06987ed90ac6 (patch) | |
tree | 0533613d5f1d83011427a6f991c5e36e8952b657 /source4/lib | |
parent | 148b8588bc7864f4771c8dcf21cfdc150b22e701 (diff) | |
download | samba-8deae13313b87c0d7efa64e9334c06987ed90ac6.tar.gz samba-8deae13313b87c0d7efa64e9334c06987ed90ac6.tar.bz2 samba-8deae13313b87c0d7efa64e9334c06987ed90ac6.zip |
s4-pyldb: Use ldb_msg_difference() in py_ldb_msg_diff()
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/pyldb.c | 12 |
1 files 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; } |