s4-dsdb: fixed the sort in dsdb_find_nc_root()
authorAndrew Tridgell <tridge@samba.org>
Thu, 17 Dec 2009 12:50:05 +0000 (23:50 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 18 Dec 2009 10:03:39 +0000 (21:03 +1100)
source4/dsdb/common/util.c

index 8ba734c15999a9b8482939dc63631a2d56b76205..61d065b85c4394c1c96ec6bd0f57b987fb165258 100644 (file)
@@ -2781,6 +2781,11 @@ int dsdb_wellknown_dn(struct ldb_context *samdb, TALLOC_CTX *mem_ctx,
 }
 
 
+static int dsdb_dn_compare_ptrs(struct ldb_dn **dn1, struct ldb_dn **dn2)
+{
+       return ldb_dn_compare(*dn1, *dn2);
+}
+
 /*
   find a NC root given a DN within the NC
  */
@@ -2830,7 +2835,7 @@ int dsdb_find_nc_root(struct ldb_context *samdb, TALLOC_CTX *mem_ctx, struct ldb
               }
        }
 
-       qsort(nc_dns, el->num_values, sizeof(nc_dns[0]), (comparison_fn_t)ldb_dn_compare);
+       qsort(nc_dns, el->num_values, sizeof(nc_dns[0]), (comparison_fn_t)dsdb_dn_compare_ptrs);
 
        for (i=0; i<el->num_values; i++) {
                if (ldb_dn_compare_base(nc_dns[i], dn) == 0) {