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.
A version of this page is also available for
4/8/2010

This function initializes a Secure Sockets Layer (SSL) session with an LDAP server.

Syntax

LDAP* ldap_sslinit(
  UNICODE PTCHAR 
HostName,
  ULONG 
PortNumber,
  int 
secure
);

Parameters

HostName

[in] Space-separated list of host names or dotted strings representing the IP address of hosts running an LDAP server to which to connect. Each host name in the list can include an optional port number, which is separated from the host itself with a colon (:) character.

PortNumber

[in] Contains the TCP port number to which to connect. Set to LDAP_SSL_PORT to obtain the default port, 636. This parameter is ignored if a host name includes a port number.

secure

[in] If nonzero, the function uses SSL encryption. If the value is zero, the function establishes a plain TCP connection and uses clear text (no encryption).

Return Value

If this function succeeds, it returns a session handle in the form of a pointer to an LDAPstructure.

If this function fails, the return value is NULL. Use the LdapGetLastErrorfunction to retrieve the error code.

Remarks

Call this function to create a connection block to an LDAP server that uses SSL. The HostNameparameter can be NULL, in which case the run time attempts to find the default LDAP server. The hosts are tried in the order listed, stopping with the first one to which a successful connection is made.

The function allocates an LDAP structure to maintain state information for the session and returns a handle to this structure. You pass this handle to subsequent LDAP function calls during the course of the session.

In a multithreading environment, calls to this function are thread-safe.

Microsoft implements security features, like SSL, through its Security Support Provider Interface (SSPI) capabilities.

Requirements

Header winldap.h
Library wldap32.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also