From 8640293fabb0fd0fe92b814411577dcdb449100d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 9 Sep 2009 18:04:07 +1000 Subject: s4/repl: implement DsReplicaSync This patch implements DsReplicaSync by passing the call via irpc to the repl server task. The repl server then triggers an immediate replication of the specified partition. This means we no longer need to set a small value for dreplsrv:periodic_interval to force frequent DRS replication. We can now wait for the DC to send us a ReplicaSync msg for any partition that changes, and we immediately sync that partition. --- source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 31 ++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'source4/rpc_server/drsuapi') diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index a9c7eb794a..73cc8cb1ef 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -29,6 +29,7 @@ #include "lib/ldb/include/ldb_errors.h" #include "param/param.h" #include "librpc/gen_ndr/ndr_drsblobs.h" +#include "messaging/irpc.h" /* drsuapi_DsBind @@ -228,12 +229,32 @@ static WERROR dcesrv_drsuapi_DsUnbind(struct dcesrv_call_state *dce_call, TALLOC drsuapi_DsReplicaSync */ static WERROR dcesrv_drsuapi_DsReplicaSync(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, - struct drsuapi_DsReplicaSync *r) + struct drsuapi_DsReplicaSync *r) { - /* TODO: implement this call correct! - * for now we just say yes, - * because we have no output parameter - */ + struct server_id *repld; + struct irpc_request *ireq; + + if (DEBUGLVL(4)) { + NDR_PRINT_IN_DEBUG(drsuapi_DsReplicaSync, r); + } + + repld = irpc_servers_byname(dce_call->msg_ctx, mem_ctx, "dreplsrv"); + if (repld == NULL || repld[0].id == 0) { + DEBUG(0,("DsReplicaSync: Unable to find dreplsrv task\n")); + return WERR_DS_DRA_INTERNAL_ERROR; + } + + ireq = IRPC_CALL_SEND(dce_call->msg_ctx, repld[0], + drsuapi, DRSUAPI_DSREPLICASYNC, + r, mem_ctx); + if (ireq == NULL) { + DEBUG(0,("DsReplicaSync: Failed to forward request to dreplsrv task\n")); + return WERR_DS_DRA_INTERNAL_ERROR; + } + + /* we are not interested in a reply */ + talloc_free(ireq); + return WERR_OK; } -- cgit