[Date Prev][Date Next] [Chronological] [Thread] [Top]

ldap_explode_dn question



This sample code generates an output / string that seems incorrect:

Snippet
=======================
#include <stdio.h>
#include <ldap.h>

int main (int argc, const char * argv[])
{
    const char    *testDN = "cn=LastName\\, FirstName,dc=test,dc=com";
    char **dn = ldap_explode_dn( testDN, 1 );

    printf( "rdn = %s\n", dn[0] );

    return 0;
}

Outputs:
==========================
rdn = LastName\2C FirstName

Expected:
==========================
rdn = LastName, FirstName

Hex 2C is obviously a comma, but a string in that form is not really usable for routines expecting the actual value. Is this expected behavior or is there some other routine you are expected to use to unescape the string?

This is on OpenLDAP 2.2.19 (but it doesn't look like there were any changes to this code in later 2.2.x releases).

Thanks,
-Jason

Attachment: smime.p7s
Description: S/MIME cryptographic signature