replmd: Ensure that binary blobs in links are ordered in the database
authorGarming Sam <garming@catalyst.net.nz>
Fri, 10 Mar 2017 04:29:53 +0000 (17:29 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 13 Mar 2017 04:10:11 +0000 (05:10 +0100)
This is required if we are to search them with a binsearch.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index 4da182f1e71fc45ba1a43d79ae98dbeded5ee629..9edcc33b08abb0ac164a0c240fc7b98d6b03b85c 100644 (file)
@@ -1949,7 +1949,12 @@ static int ndr_guid_compare(struct GUID *guid1, struct GUID *guid2)
 
 static int parsed_dn_compare(struct parsed_dn *pdn1, struct parsed_dn *pdn2)
 {
-       return ndr_guid_compare(&pdn1->guid, &pdn2->guid);
+       int ret = ndr_guid_compare(&pdn1->guid, &pdn2->guid);
+       if (ret == 0) {
+               return data_blob_cmp(&pdn1->dsdb_dn->extra_part,
+                                    &pdn2->dsdb_dn->extra_part);
+       }
+       return ret;
 }
 
 static int la_guid_compare_with_trusted_dn(struct compare_ctx *ctx,