[Date Prev][Date Next] [Chronological] [Thread] [Top]

Is ldap_bind() mandatory before each ldap_search() call?

Hi all,
I see that most LDAP utilities (openldap included) do a ldap_bind() before every ldap_search(). Is this mandatory?
If LDAP descriptor (ld) is valid and can be used for multiple ldap_search() calls, when does it become invalid? Is it time based, say ld becomes invalid after 10 minutes?
I have an application which needs to search the LDAP server for some specific attributes of users. The user name is taken as input from the command line. Is it necessary to do a ldap_bind() before each ldap_search() call? Doesn't this make it costly?
 Can I do ldap_bind() once and call ldap_search() many times? When does my "bind" become invalid?
Can my application do this:
#1 - bind to a LDAP server during initialization
#2- then do an ldap_search() whenever required
#3- then invalidate the ld after 10 minutes 
#4- do a ldap_bind() again and repeat from #2?
Can someone kindly clarify?