summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/drsuapi/getncchanges.c26
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c7
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c10
3 files changed, 19 insertions, 24 deletions
diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c
index 82be9b2e81..a82962e31d 100644
--- a/source4/rpc_server/drsuapi/getncchanges.c
+++ b/source4/rpc_server/drsuapi/getncchanges.c
@@ -31,6 +31,7 @@
#include "../libcli/drsuapi/drsuapi.h"
#include "libcli/security/security.h"
#include "lib/util/binsearch.h"
+#include "lib/util/tsort.h"
/*
build a DsReplicaObjectIdentifier from a ldb msg
@@ -506,7 +507,7 @@ static int linked_attribute_compare(const struct drsuapi_DsReplicaLinkedAttribut
/*
sort the objects we send by tree order
*/
-static int site_res_cmp_parent_order(const struct ldb_message **m1, const struct ldb_message **m2)
+static int site_res_cmp_parent_order(struct ldb_message **m1, struct ldb_message **m2)
{
return ldb_dn_compare((*m2)->dn, (*m1)->dn);
}
@@ -514,7 +515,7 @@ static int site_res_cmp_parent_order(const struct ldb_message **m1, const struct
/*
sort the objects we send first by uSNChanged
*/
-static int site_res_cmp_usn_order(const struct ldb_message **m1, const struct ldb_message **m2)
+static int site_res_cmp_usn_order(struct ldb_message **m1, struct ldb_message **m2)
{
unsigned usnchanged1, usnchanged2;
unsigned cn1, cn2;
@@ -841,24 +842,21 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
}
if (req8->replica_flags & DRSUAPI_DRS_GET_ANC) {
- qsort(getnc_state->site_res->msgs,
- getnc_state->site_res->count,
- sizeof(getnc_state->site_res->msgs[0]),
- (comparison_fn_t)site_res_cmp_parent_order);
+ TYPESAFE_QSORT(getnc_state->site_res->msgs,
+ getnc_state->site_res->count,
+ site_res_cmp_parent_order);
} else {
- qsort(getnc_state->site_res->msgs,
- getnc_state->site_res->count,
- sizeof(getnc_state->site_res->msgs[0]),
- (comparison_fn_t)site_res_cmp_usn_order);
+ TYPESAFE_QSORT(getnc_state->site_res->msgs,
+ getnc_state->site_res->count,
+ site_res_cmp_usn_order);
}
getnc_state->uptodateness_vector = talloc_steal(getnc_state, req8->uptodateness_vector);
if (getnc_state->uptodateness_vector) {
/* make sure its sorted */
- qsort(getnc_state->uptodateness_vector->cursors,
- getnc_state->uptodateness_vector->count,
- sizeof(getnc_state->uptodateness_vector->cursors[0]),
- (comparison_fn_t)drsuapi_DsReplicaCursor_compare);
+ TYPESAFE_QSORT(getnc_state->uptodateness_vector->cursors,
+ getnc_state->uptodateness_vector->count,
+ drsuapi_DsReplicaCursor_compare);
}
}
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index 9709520da5..d4a33c2dc2 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -28,6 +28,7 @@
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "librpc/gen_ndr/ndr_lsa.h"
#include "../lib/crypto/crypto.h"
+#include "lib/util/tsort.h"
/*
this type allows us to distinguish handle types
@@ -1637,8 +1638,7 @@ static NTSTATUS dcesrv_lsa_EnumTrustDom(struct dcesrv_call_state *dce_call, TALL
}
/* sort the results by name */
- qsort(entries, count, sizeof(*entries),
- (comparison_fn_t)compare_DomainInfo);
+ TYPESAFE_QSORT(entries, count, compare_DomainInfo);
if (*r->in.resume_handle >= count) {
*r->out.resume_handle = -1;
@@ -1733,8 +1733,7 @@ static NTSTATUS dcesrv_lsa_EnumTrustedDomainsEx(struct dcesrv_call_state *dce_ca
}
/* sort the results by name */
- qsort(entries, count, sizeof(*entries),
- (comparison_fn_t)compare_TrustDomainInfoInfoEx);
+ TYPESAFE_QSORT(entries, count, compare_TrustDomainInfoInfoEx);
if (*r->in.resume_handle >= count) {
*r->out.resume_handle = -1;
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 13955265b0..76f35ddefb 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -37,6 +37,7 @@
#include "rpc_server/samr/proto.h"
#include "../lib/util/util_ldb.h"
#include "param/param.h"
+#include "lib/util/tsort.h"
/* these query macros make samr_Query[User|Group|Alias]Info a bit easier to read */
@@ -1168,8 +1169,7 @@ static NTSTATUS dcesrv_samr_EnumDomainGroups(struct dcesrv_call_state *dce_call,
}
/* sort the results by rid */
- qsort(entries, count, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, count, compare_SamEntry);
/* find the first entry to return */
for (first=0;
@@ -1529,8 +1529,7 @@ static NTSTATUS dcesrv_samr_EnumDomainUsers(struct dcesrv_call_state *dce_call,
}
/* sort the results by rid */
- qsort(entries, num_filtered_entries, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, num_filtered_entries, compare_SamEntry);
/* find the first entry to return */
for (first=0;
@@ -1739,8 +1738,7 @@ static NTSTATUS dcesrv_samr_EnumDomainAliases(struct dcesrv_call_state *dce_call
}
/* sort the results by rid */
- qsort(entries, count, sizeof(struct samr_SamEntry),
- (comparison_fn_t)compare_SamEntry);
+ TYPESAFE_QSORT(entries, count, compare_SamEntry);
/* find the first entry to return */
for (first=0;