]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pyldb: add a FIXME for a non-transitive compare
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Thu, 14 Mar 2024 03:36:07 +0000 (16:36 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 Mar 2024 23:42:34 +0000 (23:42 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index 86f96e4b305ac997d8264b14f75fd5d5cfdafe55..42badbc2e3721dc93f59fba06234dd5594e39007 100644 (file)
@@ -4018,7 +4018,18 @@ static PyObject *py_ldb_msg_richcmp(PyLdbMessageObject *py_msg1,
 
        msg1 = pyldb_Message_AsMessage(py_msg1),
        msg2 = pyldb_Message_AsMessage(py_msg2);
-
+       /*
+        * FIXME: this can be a non-transitive compare, unsuitable for
+        * sorting.
+        *
+        * supposing msg1, msg2, and msg3 have 1, 2, and 3 elements
+        * each. msg2 has a NULL DN, while msg1 has a DN that compares
+        * higher than msg3. Then:
+        *
+        * msg1 < msg2, due to num_elements.
+        * msg2 < msg3, due to num_elements.
+        * msg1 > msg3, due to DNs.
+        */
        if ((msg1->dn != NULL) || (msg2->dn != NULL)) {
                ret = ldb_dn_compare(msg1->dn, msg2->dn);
                if (ret != 0) {