]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tldap: use tevent_req_set_endtime() to terminate LDAP searches
authorRalph Boehme <slow@samba.org>
Mon, 21 Jul 2025 04:44:22 +0000 (06:44 +0200)
committerJule Anger <janger@samba.org>
Fri, 22 Aug 2025 15:56:15 +0000 (15:56 +0000)
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 <slow@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 4e79fe13325385ef4fe37baeec8656c9b332de19)

source3/lib/tldap.c

index ac95272fe0636a9796a406f78d8244db85b2baaa..3d4f672ac005a98ee3becc20e58e1552cf628b99 100644 (file)
@@ -1899,6 +1899,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;