]> 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)
committerGünther Deschner <gd@samba.org>
Wed, 13 Aug 2025 18:30:44 +0000 (18:30 +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>
source3/lib/tldap.c

index f89306d2acd8a5df485e677e59e2e9db59d29bae..7b1d04064e2b271a47093205f95fefccde1daa32 100644 (file)
@@ -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;