ldap_escape_filter_element function (winldap.h)

The ldap_escape_filter_element function converts a filter element to a null-terminated character string that can be passed safely in a search filter.

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_escape_filter_element(
  [in]  PCHAR sourceFilterElement,
  [in]  ULONG sourceLength,
  [out] PCHAR destFilterElement,
  [in]  ULONG destLength
);

Parameters

[in] sourceFilterElement

A pointer to a null-terminated string that contains the filter element to convert.

[in] sourceLength

The length, in bytes, of the source filter element.

[out] destFilterElement

A pointer to a null-terminated character string.

[in] destLength

The length, in bytes, of the destFilterElement buffer.

Return value

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. See Return Values for more information.

Remarks

The ldap_escape_filter_element function allows you to use raw binary data in search filters. For example, you can use this function to specify a certificate or a JPEG image as the attribute to match.

Call ldap_escape_filter_element with the sourceFilterElement parameter pointing to raw data and sourceLength set appropriately to the length of data. If the destFilterElement parameter is NULL, then the return value is the length required for the output buffer. If destFilterElement is not NULL, then the function copies the source into the destination buffer and ensures that it is of a safe format. Then insert the destination buffer into your search filter after the "attributetype=" filter element.

Note  Do not call ldap_escape_filter_element for attribute values that are strings, as the run time does not perform any conversion from UTF-8 format. Use this function only for attribute elements that are raw binary data.
 

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

Functions

Return Values