The ldap_sslinit function operates identical to ldap_init, except that it has one additional parameter, secure. If this parameter is set to zero, an unencrypted session is created. Be aware that even if the secure parameter is set to zero, if the PortNumber parameter is set to LDAP_SSL_PORT (636) or to LDAP_SSL_GC_PORT (3269), an encrypted session is initiated. Also, if the secure parameter is set to a nonzero value, again, an encrypted session is initiated, regardless of the port number passed in the PortNumber parameter. For more information, see Using ldap_init.
Note If SSL, now TLS, is selected as the encryption method, certificates must be set up prior to binding, on both the client and the server.
For more information and a code example of using ldap_sslinit to establish a session, see Example Code for Establishing a Session Over SSL.