s4: Handle DRSUAPI_DS_REPLICA_NEIGHBOUR_ASYNC_REP in getncchanges
authorAnatoliy Atanasov <anatoliy.atanasov@postpath.com>
Wed, 23 Sep 2009 23:52:34 +0000 (16:52 -0700)
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>
Thu, 24 Sep 2009 00:10:21 +0000 (17:10 -0700)
When this flag is specified in the request we should return
for ncRoot only and so scope of search is LDB_SCOPE_BASE.

source4/rpc_server/drsuapi/getncchanges.c

index 22e82fb4e8d93c00462bf7bdd125e214ae39d8c5..75f62139630c6434225d2ae7b3ea7480c8af6683 100644 (file)
@@ -307,6 +307,7 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
        const char *attrs[] = { "*", "parentGUID", "distinguishedName", NULL };
        WERROR werr;
        char* search_filter;
+       enum ldb_scope scope = LDB_SCOPE_SUBTREE;
 
        *r->out.level_out = 6;
        /* TODO: linked attributes*/
@@ -372,9 +373,14 @@ WERROR dcesrv_drsuapi_DsGetNCChanges(struct dcesrv_call_state *dce_call, TALLOC_
                                                "(&%s(isCriticalSystemObject=true))",
                                                search_filter);
        }
+
        ncRoot_dn = ldb_dn_new(mem_ctx, sam_ctx, ncRoot->dn);
+       if ((r->in.req->req8.replica_flags & DRSUAPI_DS_REPLICA_NEIGHBOUR_ASYNC_REP)
+           == DRSUAPI_DS_REPLICA_NEIGHBOUR_ASYNC_REP) {
+               scope = LDB_SCOPE_BASE;
+       }
        ret = drsuapi_search_with_extended_dn(sam_ctx, mem_ctx, &site_res,
-                                             ncRoot_dn, LDB_SCOPE_SUBTREE, attrs,
+                                             ncRoot_dn, scope, attrs,
                                              "distinguishedName",
                                              search_filter);
        if (ret != LDB_SUCCESS) {