slapi_dn_normalize_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. 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_v3(char *dn);
Parameters
dn
The DN that you want to normalize. It is not modified by the function.
Returns
The normalized DN in newly allocated space.
Note: It is the responsibility of the caller to free the normalized DN.