The branch, master has been updated via 7f1db0d s4-drs: Wait DsReplicaSync for as long as it takes to complete via 7b20b79 s4-irpc: Don't install endtime-timer in case timeout is INFINITE for the call via ee169d7 s4-irpc: Add 'timeout' param for dcesrv_irpc_forward_rpc_call() call via 839ed05 s4-irpc: Add value for "infinite" timeout for IRPC calls from aa7df7b s3/printing: make clock jump save and use monotonic time for cache timeout
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 7f1db0d8df6c5b68c9eb9a2d578ce79a43ce0719 Author: Kamen Mazdrashki <kame...@samba.org> Date: Wed Sep 15 16:45:37 2010 +0300 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 commit 7b20b795ab024fda4e159852b60d829f7ae793c7 Author: Kamen Mazdrashki <kame...@samba.org> Date: Wed Sep 15 16:53:48 2010 +0300 s4-irpc: Don't install endtime-timer in case timeout is INFINITE for the call commit ee169d73479a5e8672d56617f2ad9cfac254f8bf Author: Kamen Mazdrashki <kame...@samba.org> Date: Wed Sep 15 16:41:47 2010 +0300 s4-irpc: Add 'timeout' param for dcesrv_irpc_forward_rpc_call() call It is to be used when caller wants to explicitly specify the timeout for the call commit 839ed051fc4fe62b9b2ce008898b538509769f88 Author: Kamen Mazdrashki <kame...@samba.org> Date: Wed Sep 15 14:22:27 2010 +0300 s4-irpc: Add value for "infinite" timeout for IRPC calls ----------------------------------------------------------------------- Summary of changes: source4/lib/messaging/irpc.h | 4 ++- source4/lib/messaging/messaging.c | 9 +++++-- source4/rpc_server/common/forward.c | 10 ++++++-- source4/rpc_server/drsuapi/dcesrv_drsuapi.c | 29 +++++++++++++++++++++++--- 4 files changed, 41 insertions(+), 11 deletions(-) Changeset truncated at 500 lines: diff --git a/source4/lib/messaging/irpc.h b/source4/lib/messaging/irpc.h index 2a76461..3c7edcc 100644 --- a/source4/lib/messaging/irpc.h +++ b/source4/lib/messaging/irpc.h @@ -43,7 +43,9 @@ struct irpc_message { }; /* don't allow calls to take too long */ -#define IRPC_CALL_TIMEOUT 10 +#define IRPC_CALL_TIMEOUT 10 +/* wait for the calls as long as it takes */ +#define IRPC_CALL_TIMEOUT_INF 0 /* the server function type */ diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index c33db82..d880c63 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -1139,9 +1139,12 @@ static struct tevent_req *irpc_bh_raw_call_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - ok = tevent_req_set_endtime(req, ev, timeval_current_ofs(hs->timeout, 0)); - if (!ok) { - return tevent_req_post(req, ev); + if (hs->timeout != IRPC_CALL_TIMEOUT_INF) { + /* set timeout-callback in case caller wants that */ + ok = tevent_req_set_endtime(req, ev, timeval_current_ofs(hs->timeout, 0)); + if (!ok) { + return tevent_req_post(req, ev); + } } return req; diff --git a/source4/rpc_server/common/forward.c b/source4/rpc_server/common/forward.c index 51e7507..c983ac3 100644 --- a/source4/rpc_server/common/forward.c +++ b/source4/rpc_server/common/forward.c @@ -57,13 +57,14 @@ static void dcesrv_irpc_forward_callback(struct tevent_req *subreq) -/* - forward a RPC call using IRPC to another task +/** + * Forward a RPC call using IRPC to another task */ void dcesrv_irpc_forward_rpc_call(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r, uint32_t callid, const struct ndr_interface_table *ndr_table, - const char *dest_task, const char *opname) + const char *dest_task, const char *opname, + uint32_t timeout) { struct dcesrv_forward_state *st; struct dcerpc_binding_handle *binding_handle; @@ -96,6 +97,9 @@ void dcesrv_irpc_forward_rpc_call(struct dcesrv_call_state *dce_call, TALLOC_CTX return; } + /* reset timeout for the handle */ + dcerpc_binding_handle_set_timeout(binding_handle, timeout); + /* forward the call */ subreq = dcerpc_binding_handle_call_send(st, dce_call->event_ctx, binding_handle, diff --git a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c index 95113dd..9d388b2 100644 --- a/source4/rpc_server/drsuapi/dcesrv_drsuapi.c +++ b/source4/rpc_server/drsuapi/dcesrv_drsuapi.c @@ -29,6 +29,7 @@ #include "libcli/security/security.h" #include "auth/auth.h" #include "param/param.h" +#include "lib/messaging/irpc.h" #define DRSUAPI_UNSUPPORTED(fname) do { \ DEBUG(1,(__location__ ": Unsupported DRS call %s\n", #fname)); \ @@ -265,15 +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"); + "dreplsrv", "DsReplicaSync", + timeout); return WERR_OK; } @@ -751,7 +770,8 @@ static WERROR dcesrv_drsuapi_DsExecuteKCC(struct dcesrv_call_state *dce_call, TA } dcesrv_irpc_forward_rpc_call(dce_call, mem_ctx, r, NDR_DRSUAPI_DSEXECUTEKCC, - &ndr_table_drsuapi, "kccsrv", "DsExecuteKCC"); + &ndr_table_drsuapi, "kccsrv", "DsExecuteKCC", + IRPC_CALL_TIMEOUT); return WERR_OK; } @@ -775,7 +795,8 @@ static WERROR dcesrv_drsuapi_DsReplicaGetInfo(struct dcesrv_call_state *dce_call } dcesrv_irpc_forward_rpc_call(dce_call, mem_ctx, r, NDR_DRSUAPI_DSREPLICAGETINFO, - &ndr_table_drsuapi, "kccsrv", "DsReplicaGetInfo"); + &ndr_table_drsuapi, "kccsrv", "DsReplicaGetInfo", + IRPC_CALL_TIMEOUT); return WERR_OK; } -- Samba Shared Repository