ldap_set_optionW function (winldap.h)

The ldap_set_option function sets options on connection blocks. For more information about structures, see Data Structures.

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_set_optionW(
  [in] LDAP       *ld,
  [in] int        option,
  [in] const void *invalue
);

Parameters

[in] ld

The session handle.

[in] option

The name of the option set.

[in] invalue

A pointer to the value that the option is to be given. The actual type of this parameter depends on the setting of the option parameter. The constants LDAP_OPT_ON and LDAP_OPT_OFF can be given for options that have on or off settings.

Return value

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. For more information, see Return Values.

Remarks

Call ldap_set_option to access the LDAP structure that represents an LDAP session. Do not attempt to modify the LDAP data structure directly.

For more information and a description of optional settings that apply to an LDAP session, see Session Options. For more information about flags, see DsGetDcName.

It is now possible to digitally sign or encrypt all of your LDAP traffic to and from a Windows LDAP server using the Kerberos authentication protocol. This new feature provides integrity and confidentiality required by some applications. Be aware that using Secure Sockets Layer (SSL) will give you the same benefits, but requires extensive certificate enrollments for the server and, sometimes, for the client.

To enable signing and sealing, you have to turn on one of the following options prior to calling ldap_bind_s with LDAP_AUTH_NEGOTIATE for the bind method.

#define LDAP_OPT_SIGN      0x95
#define LDAP_OPT_ENCRYPT   0x96

To turn off signing and sealing, close the connection by calling ldap_unbind() on the connection handle.

Multithreading: Calls to ldap_set_option are unsafe because it affects the connection as a whole. Use caution if threads share connections.

Note

The winldap.h header defines ldap_set_option as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header winldap.h
Library Wldap32.lib
DLL Wldap32.dll

See also

DsGetDcName

Functions

Getting and Setting Session Options

LDAP

Return Values

ldap_get_option