Timeouts with ldap_search_ext_s and other APIS

venugopal chinnakotla <[email protected]> Wed, 10 Dec 2025 11:08:41 +0530
Newsgroups gmane.network.openldap.technical,gmane.network.openldap.devel
Message-ID <CAJCMw6sQnTYzfyMsQvvsphwbJw4Yw9HFau47ZrQHqnYMa5GSmw@mail.gmail.com>
--0000000000007925d806459271b5
Content-Type: text/plain; charset="UTF-8"

Hi Team,

We are working on migration of nsldap C sdk to OpenLDAP C sdk for our
application client code.

We are using OpenLDAP 2.6.7.

As part of this migration, we are facing one issue related to timeouts,
that we set LDAP Handle using ldap_set_option and calling an API
ldap_search_ext_s.

With Mozilla NSLDAP, setting PRLDAP_OPT_IO_MAX_TIMEOUT value to zero in
LDAP Handle and making ldap_search_ext_s function call. Also passing
timeout value (for Ex: 30 seconds) explicitly as one on the argument. This
search call is giving an error: "Timeout error."


With OpenLDAP, setting LDAP_OPT_TIMEOUT value to zero in LDAP Handle and
making ldap_search_ext_s function call. Also passing timeout value (Same
value: 30 seconds) explicitly as one of the arguments. This search call is
giving a successful result instead of Timeout error.

*Note:* With OpenLDAP, setting  LDAP_OPT_TIMEOUT  value to zero in LDAP
Handle (0 sec, 1 microseconds) and making ldap_search_ext_s function call.
Also passing timeout value 30 seconds explicitly as one of the arguments.
This search call is giving a successful result instead of Timeout error.

*Even tried this: *With OpenLDAP, setting LDAP_OPT_NETWORK_TIMEOUT value to
zero in LDAP Handle (0 sec, 1 microseconds) and making ldap_search_ext_s
function call. Also passing timeout value 30 seconds explicitly as one of
the arguments. This search call is giving a successful result instead of
Timeout error.  --Here, I think LDAP_OPT_NETWORK_TIMEOUT is applicable only
for connection calls.

As per our application expected behaviour, with OpenLDAP, search call
should give a timeout error, but it is giving a successful result.


1. What is the difference between the implementation of nsldap and OpenLDAP
for timeouts?

2. If we want to get a Timeout error in the above use case (setting
LDAP_OPT_TIMEOUT to zero) , what should we change with usage of OpenLDAP
timeouts and APIs?

3. Also provide me some details on how timeouts are applied for each
operation like connect/bind/search calls?

4. Which timeout will take the precedence/consideration when we have
different timeouts, one is in LDAP Handle LDAP_OPT_TIMEOUT  and another
timeout value that we pass explicitly to ldap_searh_ext_s API?

  a. What happens when we have LDAP_OPT_TIMEOUT  (ldo_tm_api in LDAP
Handle) has less value than the timeout value specified
in ldap_search_ext_s API argument explicitly?

b. What happens when we have LDAP_OPT_TIMEOUT  (ldo_tm_api in LDAP Handle)
has greater value than the timeout value specified in ldap_search_ext_s API
argument explicitly?

5. How do these timeouts apply to other API calls ldap_smple_bind_s?

6. Also, can you provide an equivalent timeout in OpenLDAP for Mozilla
NSLDAP timeouts?

LDAP_X_OPT_CONNECT_TIMEOUT -  ( We mapped LDAP_OPT_NETWORK_TIMEOUT in
OpenLDA)

PRLDAP_OPT_IO_MAX_TIMEOUT - (We mapped LDAP_OPT_TIMEOUT in OpenLDAP)


-- 
Thanks,
*c.venugopal*

--0000000000007925d806459271b5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi Team,<br><br>We are working on migration of nsldap=
 C sdk to OpenLDAP C sdk for our application client code.<br><br>We are usi=
ng OpenLDAP 2.6.7.</div><div><br></div><div>As part of this migration, we a=
re facing one issue related to timeouts, that we set LDAP Handle using ldap=
_set_option and calling an API ldap_search_ext_s.</div><div><br></div><div>=
With Mozilla NSLDAP, setting PRLDAP_OPT_IO_MAX_TIMEOUT value to zero in LDA=
P Handle and making ldap_search_ext_s function call. Also passing timeout v=
alue (for Ex: 30 seconds)=C2=A0explicitly as one on the argument. This sear=
ch call is giving an error: &quot;Timeout error.&quot;</div><div><p><br></p=
><p>With OpenLDAP, setting LDAP_OPT_TIMEOUT value to zero in LDAP Handle an=
d making ldap_search_ext_s function call. Also passing timeout value (Same =
value: 30 seconds)=C2=A0explicitly as one of the arguments. This search cal=
l is giving a successful result instead of Timeout error.</p><p><b>Note:</b=
> With OpenLDAP, setting=C2=A0

LDAP_OPT_TIMEOUT=C2=A0 value to zero in LDAP Handle (0 sec, 1 microseconds)=
 and making ldap_search_ext_s function call. Also passing timeout value 30 =
seconds explicitly as one of the arguments. This search call is giving a su=
ccessful result instead of Timeout error.</p><p><b>Even tried this: </b>Wit=
h OpenLDAP, setting LDAP_OPT_NETWORK_TIMEOUT value to zero in LDAP Handle (=
0 sec, 1 microseconds) and making ldap_search_ext_s function call. Also pas=
sing timeout value 30 seconds explicitly as one of the arguments. This sear=
ch call is giving a successful result instead of Timeout error.=C2=A0 --Her=
e, I think LDAP_OPT_NETWORK_TIMEOUT is applicable only for connection calls=
.</p><p>As per our application expected behaviour, with OpenLDAP, search ca=
ll should give a timeout error, but it is giving a successful result.</p><p=
><br></p><p>1. What is the difference between the implementation of nsldap =
and OpenLDAP for timeouts?</p><p>2. If we want to get a Timeout error in th=
e above use case (setting LDAP_OPT_TIMEOUT to zero) , what should we change=
 with usage of OpenLDAP timeouts and APIs?</p><p>3. Also provide me some de=
tails on how timeouts are applied for each operation like connect/bind/sear=
ch calls?</p><p>4. Which timeout will take the precedence/consideration whe=
n we have different timeouts, one is in LDAP Handle LDAP_OPT_TIMEOUT=C2=A0 =
and another timeout value that we pass explicitly to ldap_searh_ext_s API?=
=C2=A0</p><p>=C2=A0 a. What happens when we have LDAP_OPT_TIMEOUT=C2=A0 (ld=
o_tm_api in LDAP Handle) has less value than the timeout value specified in=
=C2=A0ldap_search_ext_s API argument explicitly?</p><p>b. What happens when=
 we have LDAP_OPT_TIMEOUT=C2=A0 (ldo_tm_api in LDAP Handle) has greater val=
ue than the timeout value specified in=C2=A0ldap_search_ext_s API argument =
explicitly?</p><p>5. How do these timeouts apply to other API calls ldap_sm=
ple_bind_s?</p><p>6. Also, can you provide an equivalent timeout in OpenLDA=
P for Mozilla NSLDAP timeouts?</p><p>LDAP_X_OPT_CONNECT_TIMEOUT -=C2=A0 ( W=
e mapped=C2=A0LDAP_OPT_NETWORK_TIMEOUT in OpenLDA)</p><p>PRLDAP_OPT_IO_MAX_=
TIMEOUT - (We mapped=C2=A0LDAP_OPT_TIMEOUT in OpenLDAP)</p><p><br></p></div=
><span class=3D"gmail_signature_prefix">-- </span><br><div dir=3D"ltr" clas=
s=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div><font style=
=3D"background-color:#ffffff">Thanks,</font></div>
<div><em><strong><font color=3D"#006600">c.venugopal</font></strong></em></=
div></div></div>

--0000000000007925d806459271b5--