From: Joseph Sutton Date: Thu, 26 Aug 2021 01:53:23 +0000 (+1200) Subject: CVE-2021-3670 ldap_server: Set timeout on requests based on MaxQueryDuration X-Git-Tag: ldb-2.5.0~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86fe9d48883f87c928bf31ccbd275db420386803;p=thirdparty%2Fsamba.git CVE-2021-3670 ldap_server: Set timeout on requests based on MaxQueryDuration BUG: https://bugzilla.samba.org/show_bug.cgi?id=14694 Signed-off-by: Joseph Sutton Reviewed-by: Douglas Bagnall --- diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index e19f82cf5df..c7405f66643 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -869,7 +869,17 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) } } - ldb_set_timeout(samdb, lreq, req->timelimit); + { + time_t timeout = call->conn->limits.search_timeout; + + if (timeout == 0 + || (req->timelimit != 0 + && req->timelimit < timeout)) + { + timeout = req->timelimit; + } + ldb_set_timeout(samdb, lreq, timeout); + } if (!call->conn->is_privileged) { ldb_req_mark_untrusted(lreq);