summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules')
-rw-r--r--source4/dsdb/samdb/ldb_modules/acl.c12
-rw-r--r--source4/dsdb/samdb/ldb_modules/kludge_acl.c6
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_init.c5
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c7
4 files changed, 11 insertions, 19 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/acl.c b/source4/dsdb/samdb/ldb_modules/acl.c
index 5f50084281..250d62677b 100644
--- a/source4/dsdb/samdb/ldb_modules/acl.c
+++ b/source4/dsdb/samdb/ldb_modules/acl.c
@@ -39,6 +39,7 @@
#include "librpc/gen_ndr/ndr_security.h"
#include "param/param.h"
#include "dsdb/samdb/ldb_modules/util.h"
+#include "lib/util/tsort.h"
struct extended_access_check_attribute {
const char *oa_name;
@@ -528,11 +529,7 @@ static int acl_childClasses(struct ldb_module *module,
}
}
if (allowedClasses->num_values > 1) {
- qsort(allowedClasses->values,
- allowedClasses->num_values,
- sizeof(*allowedClasses->values),
- (comparison_fn_t)data_blob_cmp);
-
+ TYPESAFE_QSORT(allowedClasses->values, allowedClasses->num_values, data_blob_cmp);
for (i=1 ; i < allowedClasses->num_values; i++) {
struct ldb_val *val1 = &allowedClasses->values[i-1];
struct ldb_val *val2 = &allowedClasses->values[i];
@@ -615,10 +612,7 @@ static int acl_childClassesEffective(struct ldb_module *module,
}
if (allowedClasses->num_values > 1) {
- qsort(allowedClasses->values,
- allowedClasses->num_values,
- sizeof(*allowedClasses->values),
- (comparison_fn_t)data_blob_cmp);
+ TYPESAFE_QSORT(allowedClasses->values, allowedClasses->num_values, data_blob_cmp);
for (i=1 ; i < allowedClasses->num_values; i++) {
struct ldb_val *val1 = &allowedClasses->values[i-1];
struct ldb_val *val2 = &allowedClasses->values[i];
diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
index 73e135f17d..cc29d26cf0 100644
--- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c
+++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
@@ -36,6 +36,7 @@
#include "libcli/security/security.h"
#include "dsdb/samdb/samdb.h"
#include "param/param.h"
+#include "lib/util/tsort.h"
/* Kludge ACL rules:
*
@@ -174,10 +175,7 @@ static int kludge_acl_childClasses(struct ldb_context *ldb, struct ldb_message *
}
if (allowedClasses->num_values > 1) {
- qsort(allowedClasses->values,
- allowedClasses->num_values,
- sizeof(*allowedClasses->values),
- (comparison_fn_t)data_blob_cmp);
+ TYPESAFE_QSORT(allowedClasses->values, allowedClasses->num_values, data_blob_cmp);
for (i=1 ; i < allowedClasses->num_values; i++) {
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index c791c6f6cf..5dcd88a5db 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -30,6 +30,8 @@
*/
#include "dsdb/samdb/ldb_modules/partition.h"
+#include "lib/util/tsort.h"
+
static int partition_sort_compare(const void *v1, const void *v2)
{
const struct dsdb_partition *p1;
@@ -359,8 +361,7 @@ static int add_partition_to_data(struct ldb_context *ldb, struct partition_priva
data->partitions[i+1] = NULL;
/* Sort again (should use binary insert) */
- qsort(data->partitions, i+1,
- sizeof(*data->partitions), partition_sort_compare);
+ TYPESAFE_QSORT(data->partitions, i+1, partition_sort_compare);
ret = partition_register(ldb, partition->ctrl);
if (ret != LDB_SUCCESS) {
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 67d7094d4c..9fd2c1e617 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -48,6 +48,7 @@
#include "dsdb/samdb/ldb_modules/util.h"
#include "lib/util/binsearch.h"
#include "libcli/security/security.h"
+#include "lib/util/tsort.h"
#define W2K3_LINKED_ATTRIBUTES 1
@@ -1278,7 +1279,7 @@ static int get_parsed_dns(struct ldb_module *module, TALLOC_CTX *mem_ctx,
p->v = v;
}
- qsort(*pdn, el->num_values, sizeof((*pdn)[0]), (comparison_fn_t)parsed_dn_compare);
+ TYPESAFE_QSORT(*pdn, el->num_values, parsed_dn_compare);
return LDB_SUCCESS;
}
@@ -3151,9 +3152,7 @@ static int replmd_replicated_uptodate_modify(struct replmd_replicated_request *a
/*
* sort the cursors
*/
- qsort(nuv.ctr.ctr2.cursors, nuv.ctr.ctr2.count,
- sizeof(struct drsuapi_DsReplicaCursor2),
- (comparison_fn_t)drsuapi_DsReplicaCursor2_compare);
+ TYPESAFE_QSORT(nuv.ctr.ctr2.cursors, nuv.ctr.ctr2.count, drsuapi_DsReplicaCursor2_compare);
/*
* create the change ldb_message