diff options
author | Stefan Metzmacher <metze@samba.org> | 2016-01-22 08:53:57 +0100 |
---|---|---|
committer | Garming Sam <garming@samba.org> | 2016-02-17 03:43:22 +0100 |
commit | 5db9f865bca818da8d2334208f3141f7f5c7286d (patch) | |
tree | f503037e2fbbd77e45aa00ec1b5b5c228edf03b3 /lib/ldb-samba | |
parent | cd77b0bba434139e13db5ec2096ca99b6b3f084d (diff) | |
download | samba-5db9f865bca818da8d2334208f3141f7f5c7286d.tar.gz |
ldb-samba: fix the timeout setup in ildb_request_send()
We need to use the startime as reference not the current time.
We also allow timeout == -1 to indicate no timeout at all.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb-samba')
-rw-r--r-- | lib/ldb-samba/ldb_ildap.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/ldb-samba/ldb_ildap.c b/lib/ldb-samba/ldb_ildap.c index 6ec363de9de..65f11dba018 100644 --- a/lib/ldb-samba/ldb_ildap.c +++ b/lib/ldb-samba/ldb_ildap.c @@ -418,11 +418,13 @@ static int ildb_request_send(struct ildb_context *ac, struct ldap_message *msg) return LDB_ERR_OPERATIONS_ERROR; } - talloc_free(req->time_event); - req->time_event = NULL; - if (ac->req->timeout) { - req->time_event = tevent_add_timer(ac->ildb->event_ctx, ac, - timeval_current_ofs(ac->req->timeout, 0), + TALLOC_FREE(req->time_event); + if (ac->req->timeout > 0) { + struct timeval tv = { + .tv_sec = ac->req->starttime + ac->req->timeout, + }; + + req->time_event = tevent_add_timer(ac->ildb->event_ctx, ac, tv, ildb_request_timeout, ac); } |