ldap_open (Compact 2013)

3/26/2014

This function creates and initializes a connection block, and then opens the connection to an LDAP server. This function is currently depreciated: users are strongly encouraged to use ldap_init instead.

Syntax

LDAP* ldap_open(
  UNICODE PTCHAR HostName,
  ULONG PortNumber
);

Parameters

  • HostName
    [in] List of host names or dotted strings that represent the IP address of LDAP server hosts.

    Note

    In Windows Embedded Compact, you cannot pass in a domain name for this parameter. The name or IP address of the server is required.

  • PortNumber
    [in] Contains the TCP port number to which to connect. The default LDAP port, 389, can be obtained by supplying the constant LDAP_PORT. If a host name includes a port number then this parameter is ignored.

Return Value

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

If this function fails, it returns NULL. Use the LdapGetLastError function to retrieve the error code.

Remarks

Call this function to create a connection block to an LDAP server. The HostName parameter can be NULL, in which case the run time attempts to find the default LDAP server. The host names are tried in the order listed, stopping with the first successful connection.

The default LDAP server is a Microsoft specific option when you use LDAP_OPT_HOST_NAME. This option specifies the host name of the default LDAP server and returns the host name.

This function allocates an LDAP data structure to maintain state information for the session and returns a handle to this structure. You can 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.

The use of this function is strongly depreciated by the current LDAP request for comments (RFC) because it precludes the use of setting any session options. Users are encouraged to use ldap_init as the preferred method of initializing an LDAP session.

For Windows Embedded Compact, the HostName parameter cannot be set to a domain name, it must be set to the name or IP address of the server.

Requirements

Header

winldap.h

Library

wldap32.lib

See Also

Reference

LDAP Session Functions
cldap_open
ldap_init
LdapGetLastError