Blame SOURCES/freeradius-ldap-infinite-timeout-on-starttls.patch

0ec6e5
From: Antonio Torres <antorres@redhat.com>
0ec6e5
Date: Fri, 28 Jan 2022
0ec6e5
Subject: Use infinite timeout when using LDAP+start-TLS
0ec6e5
0ec6e5
This will ensure that the TLS connection to the LDAP server will complete
0ec6e5
before starting FreeRADIUS, as it forces libldap to use a blocking socket during 
0ec6e5
the process. Infinite timeout is the OpenLDAP default.
0ec6e5
Avoids this: https://git.openldap.org/openldap/openldap/-/blob/87ffc60006298069a5a044b8e63dab27a61d3fdf/libraries/libldap/tls2.c#L1134
0ec6e5
0ec6e5
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1992551
0ec6e5
Signed-off-by: Antonio Torres <antorres@redhat.com>
0ec6e5
---
0ec6e5
 src/modules/rlm_ldap/ldap.c | 5 ++++-
0ec6e5
 1 file changed, 4 insertions(+), 1 deletion(-)
0ec6e5
0ec6e5
diff --git a/src/modules/rlm_ldap/ldap.c b/src/modules/rlm_ldap/ldap.c
0ec6e5
index cf7a84e069..841bf888a1 100644
0ec6e5
--- a/src/modules/rlm_ldap/ldap.c
0ec6e5
+++ b/src/modules/rlm_ldap/ldap.c
0ec6e5
@@ -1472,7 +1472,10 @@ void *mod_conn_create(TALLOC_CTX *ctx, void *instance)
0ec6e5
 	}
0ec6e5
 
0ec6e5
 #ifdef LDAP_OPT_NETWORK_TIMEOUT
0ec6e5
-	if (inst->net_timeout) {
0ec6e5
+	bool using_tls = inst->start_tls ||
0ec6e5
+					 inst->port == 636 ||
0ec6e5
+					 strncmp(inst->server, "ldaps://", strlen("ldaps://")) == 0;
0ec6e5
+	if (inst->net_timeout && !using_tls) {
0ec6e5
 		memset(&tv, 0, sizeof(tv));
0ec6e5
 		tv.tv_sec = inst->net_timeout;
0ec6e5