diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/repl/drepl_out_pull.c | 16 | ||||
-rw-r--r-- | source4/dsdb/repl/drepl_service.c | 26 |
2 files changed, 42 insertions, 0 deletions
diff --git a/source4/dsdb/repl/drepl_out_pull.c b/source4/dsdb/repl/drepl_out_pull.c index c66c5bbd19..54dbd29730 100644 --- a/source4/dsdb/repl/drepl_out_pull.c +++ b/source4/dsdb/repl/drepl_out_pull.c @@ -79,6 +79,22 @@ WERROR dreplsrv_schedule_pull_replication(struct dreplsrv_service *s, TALLOC_CTX return WERR_OK; } + +/* force an immediate of the specified partition by GUID */ +WERROR dreplsrv_schedule_partition_pull_by_guid(struct dreplsrv_service *s, TALLOC_CTX *mem_ctx, + struct GUID *guid) +{ + struct dreplsrv_partition *p; + + for (p = s->partitions; p; p = p->next) { + if (GUID_compare(&p->nc.guid, guid) == 0) { + return dreplsrv_schedule_partition_pull(s, p, mem_ctx); + } + } + + return WERR_NOT_FOUND; +} + static void dreplsrv_pending_op_callback(struct dreplsrv_out_operation *op) { struct repsFromTo1 *rf = op->source_dsa->repsFrom1; diff --git a/source4/dsdb/repl/drepl_service.c b/source4/dsdb/repl/drepl_service.c index 27572af3df..eb49da3d41 100644 --- a/source4/dsdb/repl/drepl_service.c +++ b/source4/dsdb/repl/drepl_service.c @@ -106,6 +106,30 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo } /* + DsReplicaSync messages from the DRSUAPI server are forwarded here + */ +static NTSTATUS drepl_replica_sync(struct irpc_message *msg, + struct drsuapi_DsReplicaSync *r) +{ + struct dreplsrv_service *service = talloc_get_type(msg->private_data, + struct dreplsrv_service); + WERROR werr; + struct GUID *guid = &r->in.req.req1.naming_context->guid; + + werr = dreplsrv_schedule_partition_pull_by_guid(service, msg, guid); + if (W_ERROR_IS_OK(werr)) { + DEBUG(3,("drepl_replica_sync: forcing sync of partition %s\n", + GUID_string(msg, guid))); + dreplsrv_run_pending_ops(service); + } else { + DEBUG(3,("drepl_replica_sync: failed setup of sync of partition %s - %s\n", + GUID_string(msg, guid), win_errstr(werr))); + return NT_STATUS_INTERNAL_ERROR; + } + return NT_STATUS_OK; +} + +/* startup the dsdb replicator service task */ static void dreplsrv_task_init(struct task_server *task) @@ -173,6 +197,8 @@ static void dreplsrv_task_init(struct task_server *task) } irpc_add_name(task->msg_ctx, "dreplsrv"); + + IRPC_REGISTER(task->msg_ctx, drsuapi, DRSUAPI_DSREPLICASYNC, drepl_replica_sync, service); } /* |