summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-22 17:07:33 -0700
committerAndrew Tridgell <tridge@samba.org>2009-09-22 17:10:06 -0700
commitee4f7f1209cc7668e7245d21e9bf2424d8c77244 (patch)
tree79287709bda11c735a0f62a35e6ef2a834e9e2fe /source4
parent83bef7d047def0711b0893c6b2a5096b195811ef (diff)
downloadsamba-ee4f7f1209cc7668e7245d21e9bf2424d8c77244.tar.gz
samba-ee4f7f1209cc7668e7245d21e9bf2424d8c77244.tar.bz2
samba-ee4f7f1209cc7668e7245d21e9bf2424d8c77244.zip
s4-drsserver: sort by DN to give tree order
This might help the windows client with ordered requests. Later we need to support the "ancestors" mode flag.
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/drsuapi/dcesrv_drsuapi.h3
-rw-r--r--source4/rpc_server/drsuapi/drsutil.c31
-rw-r--r--source4/rpc_server/drsuapi/getncchanges.c3
3 files changed, 29 insertions, 8 deletions
diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.h b/source4/rpc_server/drsuapi/dcesrv_drsuapi.h
index 685203360b..a6b11c5dac 100644
--- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.h
+++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.h
@@ -54,7 +54,8 @@ int drsuapi_search_with_extended_dn(struct ldb_context *ldb,
struct ldb_dn *basedn,
enum ldb_scope scope,
const char * const *attrs,
- const char *format, ...) PRINTF_ATTRIBUTE(7,8);
+ const char *sort_attrib,
+ const char *format, ...) PRINTF_ATTRIBUTE(8,9);
WERROR drs_security_level_check(struct dcesrv_call_state *dce_call,
const char* call);
diff --git a/source4/rpc_server/drsuapi/drsutil.c b/source4/rpc_server/drsuapi/drsutil.c
index 03116f29d9..ef48a9f079 100644
--- a/source4/rpc_server/drsuapi/drsutil.c
+++ b/source4/rpc_server/drsuapi/drsutil.c
@@ -44,12 +44,13 @@ char *drs_ObjectIdentifier_to_string(TALLOC_CTX *mem_ctx,
}
int drsuapi_search_with_extended_dn(struct ldb_context *ldb,
- TALLOC_CTX *mem_ctx,
- struct ldb_result **_res,
- struct ldb_dn *basedn,
- enum ldb_scope scope,
- const char * const *attrs,
- const char *format, ...)
+ TALLOC_CTX *mem_ctx,
+ struct ldb_result **_res,
+ struct ldb_dn *basedn,
+ enum ldb_scope scope,
+ const char * const *attrs,
+ const char *sort_attrib,
+ const char *format, ...)
{
va_list ap;
int ret;
@@ -93,6 +94,24 @@ int drsuapi_search_with_extended_dn(struct ldb_context *ldb,
return ret;
}
+ if (sort_attrib) {
+ struct ldb_server_sort_control *sort_control;
+ sort_control = talloc(req, struct ldb_server_sort_control);
+ if (sort_control == NULL) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ sort_control->attributeName = sort_attrib;
+ sort_control->orderingRule = NULL;
+ sort_control->reverse = 1;
+
+ ret = ldb_request_add_control(req, LDB_CONTROL_SERVER_SORT_OID, true, sort_control);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
+
ret = ldb_request(ldb, req);
if (ret == LDB_SUCCESS) {
ret = ldb_wait(req->handle, LDB_WAIT_ALL);
diff --git a/source4/rpc_server/drsuapi/getncchanges.c b/source4/rpc_server/drsuapi/getncchanges.c
index 8538ea8ff1..56a37e9928 100644
--- a/source4/rpc_server/drsuapi/getncchanges.c
+++ b/source4/rpc_server/drsuapi/getncchanges.c
@@ -268,7 +268,7 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
struct drsuapi_DsReplicaObjectListItemEx **currentObject;
NTSTATUS status;
DATA_BLOB session_key;
- const char *attrs[] = { "*", "parentGUID", NULL };
+ const char *attrs[] = { "*", "parentGUID", "distinguishedName", NULL };
WERROR werr;
*r->out.level_out = 6;
@@ -322,6 +322,7 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
ncRoot_dn = ldb_dn_new(mem_ctx, sam_ctx, ncRoot->dn);
ret = drsuapi_search_with_extended_dn(sam_ctx, mem_ctx, &site_res,
ncRoot_dn, LDB_SCOPE_SUBTREE, attrs,
+ "distinguishedName",
"(uSNChanged>=%llu)",
(unsigned long long)(r->in.req->req8.highwatermark.highest_usn+1));
if (ret != LDB_SUCCESS) {