From 7f1db0d8df6c5b68c9eb9a2d578ce79a43ce0719 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 15 Sep 2010 16:45:37 +0300 Subject: [PATCH 1/1] s4-drs: Wait DsReplicaSync for as long as it takes to complete In case the caller wants sync execution, we should not cancel the call for internal timeout reason, but rather wait for its execution --- source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index 4a6c37005c..9d388b2fbb 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -266,16 +266,33 @@ static WERROR dcesrv_drsuapi_DsReplicaSync(struct dcesrv_call_state *dce_call, T struct drsuapi_DsReplicaSync *r) { WERROR status; + uint32_t timeout; status = drs_security_level_check(dce_call, "DsReplicaSync", SECURITY_DOMAIN_CONTROLLER, NULL); if (!W_ERROR_IS_OK(status)) { return status; } - dcesrv_irpc_forward_rpc_call(dce_call, mem_ctx, r, NDR_DRSUAPI_DSREPLICASYNC, + if (r->in.level != 1) { + DEBUG(0,("DsReplicaSync called with unsupported level %d\n", r->in.level)); + return WERR_DS_DRA_INVALID_PARAMETER; + } + + if (r->in.req->req1.options & DRSUAPI_DRS_ASYNC_OP) { + timeout = IRPC_CALL_TIMEOUT; + } else { + /* + * use Infinite time for timeout in case + * the caller made a sync call + */ + timeout = IRPC_CALL_TIMEOUT_INF; + } + + dcesrv_irpc_forward_rpc_call(dce_call, mem_ctx, + r, NDR_DRSUAPI_DSREPLICASYNC, &ndr_table_drsuapi, "dreplsrv", "DsReplicaSync", - IRPC_CALL_TIMEOUT); + timeout); return WERR_OK; } -- 2.34.1