From: Rusty Russell Date: Wed, 1 Jun 2011 02:50:08 +0000 (+0930) Subject: libcli/cldap/cldap.c: don't hand huge values to tevent_timeval_add usecs X-Git-Tag: samba-4.0.0alpha16^2~488 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=c29069e079018853867d643b8de604edd95c94d9 libcli/cldap/cldap.c: don't hand huge values to tevent_timeval_add usecs state->request.delay is two million here, resulting in an invalid timeval. Since tevent doesn't have a convenient wrapper to add arbitrary usecs, do the arithmetic here (it's the sole caller of this function). Signed-off-by: Rusty Russell --- diff --git a/libcli/cldap/cldap.c b/libcli/cldap/cldap.c index f5585c2b730..37b4f4913db 100644 --- a/libcli/cldap/cldap.c +++ b/libcli/cldap/cldap.c @@ -626,7 +626,8 @@ struct tevent_req *cldap_search_send(TALLOC_CTX *mem_ctx, now = tevent_timeval_current(); end = now; for (i = 0; i < state->request.count; i++) { - end = tevent_timeval_add(&end, 0, state->request.delay); + end = tevent_timeval_add(&end, state->request.delay / 1000000, + state->request.delay % 1000000); } if (!tevent_req_set_endtime(req, state->caller.cldap->event.ctx, end)) { @@ -688,7 +689,8 @@ static void cldap_search_state_queue_done(struct tevent_req *subreq) return; } - next = tevent_timeval_current_ofs(0, state->request.delay); + next = tevent_timeval_current_ofs(state->request.delay / 1000000, + state->request.delay % 1000000); subreq = tevent_wakeup_send(state, state->caller.cldap->event.ctx, next);