From 57bcdf008fa44d4c550819cbceada968b11be63c Mon Sep 17 00:00:00 2001 From: Fernando J V da Silva Date: Thu, 15 Apr 2010 17:37:40 -0300 Subject: s4-drs: samdb_is_rodc() function and new samdb_rodc() function This patch creates the samdb_is_rodc() function, which looks for the NTDSDSA object for a DC that has a specific invocationId and if msDS-isRODC is present on such object and it is TRUE, then consider the DC as a RODC. The new samdb_rodc() function uses the samdb_is_rodc() function for the local server. Signed-off-by: Andrew Tridgell --- source4/dsdb/repl/drepl_out_helpers.c | 5 ++++- source4/dsdb/repl/drepl_service.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'source4/dsdb/repl') diff --git a/source4/dsdb/repl/drepl_out_helpers.c b/source4/dsdb/repl/drepl_out_helpers.c index a12481b897..07fb0b3d62 100644 --- a/source4/dsdb/repl/drepl_out_helpers.c +++ b/source4/dsdb/repl/drepl_out_helpers.c @@ -542,6 +542,8 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req) char *ntds_guid_str; char *ntds_dns_name; struct tevent_req *subreq; + bool am_rodc; + int ret; r = talloc(state, struct drsuapi_DsReplicaUpdateRefs); if (tevent_req_nomem(r, req)) { @@ -566,7 +568,8 @@ static void dreplsrv_update_refs_trigger(struct tevent_req *req) r->in.req.req1.dest_dsa_dns_name = ntds_dns_name; r->in.req.req1.dest_dsa_guid = service->ntds_guid; r->in.req.req1.options = DRSUAPI_DRS_ADD_REF | DRSUAPI_DRS_DEL_REF; - if (!samdb_rodc(service->samdb)) { + ret = samdb_rodc(service->samdb, &am_rodc); + if (ret == LDB_SUCCESS && !am_rodc) { r->in.req.req1.options |= DRSUAPI_DRS_WRIT_REP; } diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 4196f94234..59436d6c0c 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -132,6 +132,8 @@ static void dreplsrv_task_init(struct task_server *task) WERROR status; struct dreplsrv_service *service; uint32_t periodic_startup_interval; + bool am_rodc; + int ret; switch (lp_server_role(task->lp_ctx)) { case ROLE_STANDALONE: @@ -194,7 +196,8 @@ static void dreplsrv_task_init(struct task_server *task) } /* if we are a RODC then we do not send DSReplicaSync*/ - if (!samdb_rodc(service->samdb)) { + ret = samdb_rodc(service->samdb, &am_rodc); + if (ret == LDB_SUCCESS && !am_rodc) { service->notify.interval = lp_parm_int(task->lp_ctx, NULL, "dreplsrv", "notify_interval", 5); /* in seconds */ status = dreplsrv_notify_schedule(service, service->notify.interval); -- cgit