Partager via


ldap_sslinit (Compact 2013)

3/26/2014

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 LDAP structure.

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

Remarks

Call this function to create a connection block to an LDAP server that uses SSL. The HostName parameter 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

See Also

Reference

LDAP Session Functions
LDAP
LdapGetLastError