s4:ldb Python requires that a 'compare' handler return -1, 0 or 1
authorAndrew Bartlett <abartlet@samba.org>
Fri, 21 Aug 2009 07:50:04 +0000 (17:50 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 21 Aug 2009 07:51:52 +0000 (17:51 +1000)
source4/lib/ldb/pyldb.c

index 5825f8853077848dd37f1d6c3c89eb6b6da92e32..d55e0aae7ca23ff5c6bb5620fb511688ac1d9593 100644 (file)
@@ -211,7 +211,11 @@ static PyObject *py_ldb_dn_check_special(PyLdbDnObject *self, PyObject *args)
 
 static int py_ldb_dn_compare(PyLdbDnObject *dn1, PyLdbDnObject *dn2)
 {
-       return ldb_dn_compare(dn1->dn, dn2->dn);
+       int ret;
+       ret = ldb_dn_compare(dn1->dn, dn2->dn);
+       if (ret < 0) ret = -1;
+       if (ret > 0) ret = 1;
+       return ret;
 }
 
 static PyObject *py_ldb_dn_get_parent(PyLdbDnObject *self)