Partager via


ldap_escape_filter_element (Compact 2013)

3/26/2014

This function converts raw binary data in a filter element to a safe text string that can be passed safely in a search filter.

Syntax

ULONG ldap_escape_filter_element(
  UNICODE PTCHAR sourceFilterElement,
  ULONG sourceLength,
  UNICODE PTCHAR destFilterElement,
  ULONG destLength
);

Parameters

  • sourceFilterElement
    [in] Filter element to convert.
  • sourceLength
    [in] Length of the source filter element.
  • destFilterElement
    [out] Safe text string.
  • destLength
    [out] Length of the safe text string.

Return Value

If this function succeeds, the return value is LDAP_SUCCESS.

If this function fails, it returns an error code. See the LDAP_RETCODE enumeration for a list of possible return values.

Remarks

This 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 this function with the sourceFilterElement parameter pointing to raw data and sourceCount 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.

Do not call this function 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

Header

winldap.h

Library

wldap32.lib

See Also

Reference

LDAP Search Functions
LDAP_RETCODE