From: Ralph Boehme Date: Mon, 21 Jul 2025 04:44:22 +0000 (+0200) Subject: tldap: use tevent_req_set_endtime() to terminate LDAP searches X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4e79fe13325385ef4fe37baeec8656c9b332de19;p=thirdparty%2Fsamba.git tldap: use tevent_req_set_endtime() to terminate LDAP searches Needed to detect unresponsive LDAP servers, otherwise we might be sitting up to 924.6 seconds after sending a request before the kernel notifies us of a broken connection. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15844 Signed-off-by: Ralph Boehme Reviewed-by: Guenther Deschner --- diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c index f89306d2acd..7b1d04064e2 100644 --- a/source3/lib/tldap.c +++ b/source3/lib/tldap.c @@ -1905,6 +1905,11 @@ struct tevent_req *tldap_search_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } + if (timelimit != 0) { + struct timeval end; + end = timeval_current_ofs(timelimit * 1.5F, 0); + tevent_req_set_endtime(subreq, ev, end); + } tevent_req_set_callback(subreq, tldap_search_done, req); return req;