diff --git a/CHANGES b/CHANGES
index 5e179135b9412af6efa85ec987c3a6af8655a787..4b3f57d966dc62bfd72f514c8bbb602a3713e06f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@ OpenLDAP 2.4.20 Engineering
 	Fixed liblber to return failure on certain failures (ITS#6344)
 	Fixed libldap sasl buffer sizing (ITS#6327,ITS#6334)
 	Fixed libldap uninitialized return value (ITS#6355)
+	Fixed libldap unlimited timeout (ITS#6388)
 	Fixed liblutil constant (ITS#5909)
 	Added slapd handling of hex server IDs (ITS#6297)
 	Added slapd syncrepl contextCSN storing in subentry (ITS#6373)
diff --git a/doc/man/man3/ldap_result.3 b/doc/man/man3/ldap_result.3
index af572bb5fa310a251758c5b340d99e43bb3242eb..50e704fea56ea05fb95db9595a95c041387e3629 100644
--- a/doc/man/man3/ldap_result.3
+++ b/doc/man/man3/ldap_result.3
@@ -48,7 +48,11 @@ is a NULL  pointer, the LDAP_OPT_TIMEOUT value set by
 is used. With the default setting,
 the  select  blocks  indefinitely.   To
 effect  a  poll,  the  timeout argument should be a non-NULL
-pointer, pointing to a zero-valued timeval structure.  See
+pointer, pointing to a zero-valued timeval structure.
+To obtain the behavior of the default setting, bypassing any value set by 
+.BR ldap_set_option (3),
+set to -1 the \fItv_sec\fP field of the \fItimeout\fP parameter.
+See
 .BR select (2)
 for further details.
 .LP
diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c
index afdc236ea7eb2d20e624f4bacddb86696e01c960..01f8d51cb1b578cbfe0ebac8bd7232aa97349da5 100644
--- a/libraries/libldap/result.c
+++ b/libraries/libldap/result.c
@@ -276,7 +276,7 @@ wait4msg(
 	}
 #endif /* LDAP_DEBUG */
 
-	if ( timeout != NULL ) {
+	if ( timeout != NULL && timeout->tv_sec != -1 ) {
 		tv0 = *timeout;
 		tv = *timeout;
 		tvp = &tv;