ldap_ufn2dnW function (winldap.h)

The ldap_ufn2dn function converts a user-friendly name to a distinguished name.

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_ufn2dnW(
  [in]  const PWSTR ufn,
  [out] PWSTR       *pDn
);

Parameters

[in] ufn

Pointer to a null-terminated string that contains the user-friendly name to convert.

[out] pDn

Pointer to a variable that receives a pointer to a null-terminated string that contains the resulting distinguished name.

If the pDn parameter returns non-NULL, free it with a call to ldap_memfree.

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

The ldap_ufn2dn function attempts to normalize a user-specified name to a distinguished name. For example, consider an LDAP directory format for a common name of LastName, FirstName. Given a directory name of "Jeff Smith," ldap_ufn2dn will attempt to normalize this to "Smith, Jeff." The function follows RFC 1781; add CN= if not present, add OU= if none present, and so on. If it runs into any errors while normalizing, the function returns a copy of what was passed. It then allocates the output string from the LDAP memory pool.

Note

The winldap.h header defines ldap_ufn2dn as an alias that 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 is 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

Functions

Return Values

ldap_memfree