Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
To establish a session with an LDAP server, you first need to create a connection block to the server. If you want to specify an option, such as a time-out value, that affects how you establish the connection, call the ldap_initfunction to create and initialize the connection block. To create a connection block to an LDAP server using a Secure Sockets Layer (SSL) connection, call the ldap_sslinitfunction and set the PortNumberparameter to LDAP_SSL_PORT. Then, using the connection handle, call the ldap_set_optionfunction with the appropriate option and value.
When ldap_set_optionreturns, you can call the ldap_connectfunction to verify that the server is available. However, if a connection does not already exist, the first call to an operation function that requires an open connection will call ldap_connectinternally.
You should specify which LDAP version you are using to access the full functionality of LDAP. You do this when you call ldap_set_optionas demonstrated by the following code example.
Copy Code | |
---|---|
ULONG version = LDAP_VERSION3; ldap_set_option(ld, LDAP_OPT_VERSION, &version); |
You must call ldap_set_optionafter calling ldap_init, and before calling ldap_bind.
To take full advantage of LDAP, your client should use LDAP version 3 unless connecting to a server that supports only version 2. Microsoft Active Directory supports LDAP versions 2 and 3.