slapi_dn_normalize_case_v3()

slapi_dn_normalize_v3() converts a distinguished name (DN) to canonical format. It means no leading or trailing spaces, no spaces between components and no spaces around the equals sign.

The API normalizes the attribute type name to the first textual type name in the schema definition. Any semicolons that are used to separate relative distinguished names (RDN) are converted to commas. A compound RDN is sorted alphabetically by attribute name. The case of attribute types is changed to uppercase in all cases. The case of the attribute values is converted to uppercase only when the matching rules are case-sensitive. If the matching rules for the attribute are case-sensitive, the case of the attribute value is preserved. In the following example, user name is a case-sensitive attribute and cn, ou, and o are case-sensitive. For example, the following DN:
userName=johnDOE + commonName = John Doe ;
ou = Engineering , o = Darius the function returns:
CN=JOHN DOE+USERNAME=johnDOE,OU=ENGINEERING,O=DARIUS
Special characters in a DN, if escaped by using double quotation marks, are converted to use backslash (\) as the escape mechanism. For example, the following DN:
cn="a + b", o=sample the function returns
CN=A \+ B,o=sample
An attribute value that contains a backslash followed by a two-digit hex representation of a UTF-8 character is converted to the character representation. For example, the following DN:
cn=\4A\6F\68\6E Doe,ou=Engineering,o=Darius
the function returns CN=JOHN DOE,OU=ENGINEERING,O=DARIUS
A ber-encoded attribute value is converted to a UTF-8 value. For example, the following DN:
cn=#04044A6F686E20446F65,ou=Engineering,o=Darius
the function returns CN=JOHN DOE,OU=ENGINEERING,O=DARIUS
An invalid DN returns NULL.
Syntax
#include "slapi-plugin.h"
char *slapi_dn_normalize_case_v3(char *dn);
Parameters
dn
The DN that you want to normalize and convert to lowercase. It is not modified by the function.
Returns
The normalized DN in newly allocated space.
Note: It is the caller's responsibility to free the normalized DN.