ldb:pyldb.c - we cannot use "ldb_dn_compare" if both message DNs are NULL in "py_ldb_...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 7 Jun 2010 19:26:33 +0000 (21:26 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Mon, 7 Jun 2010 19:26:33 +0000 (21:26 +0200)
Discovered by the testcase.

source4/lib/ldb/pyldb.c

index bbb2e715b388ca6e2b95ce2595410697b8134f11..3a956ed6e24fdd68c1b1230a7b77ab47de9510d5 100644 (file)
@@ -2087,9 +2087,11 @@ static int py_ldb_msg_compare(PyLdbMessageObject *py_msg1,
        unsigned int i;
        int ret;
 
-       ret = ldb_dn_compare(msg1->dn, msg2->dn);
-       if (ret != 0) {
-               return ret;
+       if ((msg1->dn != NULL) || (msg2->dn != NULL)) {
+               ret = ldb_dn_compare(msg1->dn, msg2->dn);
+               if (ret != 0) {
+                       return ret;
+               }
        }
 
        ret = msg1->num_elements - msg2->num_elements;