summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ldb/pyldb.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index e2a2e7180e..4c71569f05 100644
--- a/lib/ldb/pyldb.c
+++ b/lib/ldb/pyldb.c
@@ -522,6 +522,21 @@ static PyObject *py_ldb_dn_add_base(PyLdbDnObject *self, PyObject *args)
return ldb_dn_add_base(dn, other)?Py_True:Py_False;
}
+static PyObject *py_ldb_dn_compare_base(PyLdbDnObject *self, PyObject *args)
+{
+ PyObject *py_base;
+ struct ldb_dn *dn, *base;
+ if (!PyArg_ParseTuple(args, "O", &py_base))
+ return NULL;
+
+ dn = PyLdbDn_AsDn((PyObject *)self);
+
+ if (!PyObject_AsDn(NULL, py_base, dn_ldb_ctx(dn), &base))
+ return NULL;
+
+ return PyInt_FromLong(ldb_dn_compare_base(base, dn));
+}
+
static PyMethodDef py_ldb_dn_methods[] = {
{ "validate", (PyCFunction)py_ldb_dn_validate, METH_NOARGS,
"S.validate() -> bool\n"
@@ -540,6 +555,8 @@ static PyMethodDef py_ldb_dn_methods[] = {
{ "canonical_str", (PyCFunction)py_ldb_dn_canonical_str, METH_NOARGS,
"S.canonical_str() -> string\n"
"Canonical version of this DN (like a posix path)." },
+ { "compare_base", (PyCFunction)py_ldb_dn_compare_base, METH_VARARGS,
+ "S.compare_base(basedn) -> int\n\n"},
{ "canonical_ex_str", (PyCFunction)py_ldb_dn_canonical_ex_str, METH_NOARGS,
"S.canonical_ex_str() -> string\n"
"Canonical version of this DN (like a posix path, with terminating newline)." },