Directory Services |
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.
ULONG ldap_escape_filter_element( PCHAR sourceFilterElement, ULONG sourceLength, PCHAR destFilterElement, ULONG destLength );
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.
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.
Client: Included in Windows XP and
Windows 2000 Professional.
Server: Included in Windows Server 2003 and
Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension
on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on all
platforms.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.