Hi guys,

 

I am trying to create an OU named “test” in ADAM under the root dc=abcd,dc=com.

For this ,I wrote the following code :

 

    LDAPMod cnmod, ocmod;

    LDAPMod *mods[3];

    char *cnvals[2], *ocvals[3];

 

    cnvals[0] = location;

    cnvals[1] = NULL;

    cnmod.mod_op = LDAP_MOD_ADD;

    cnmod.mod_type = "ou";

    cnmod.mod_values = cnvals;

    ocvals[0]="organizationalUnit";

    ocvals[1]="top";

    ocvals[2]=NULL;

    ocmod.mod_op = 0;

    ocmod.mod_type = "objectclass";

    ocmod.mod_values = ocvals;

    mods[0] = &cnmod;

    mods[1] = &ocmod;

    mods[2] = NULL;

 

    char *entry = "ou=test,dc=abcd,dc=com";

 

    int error = ldap_add_s(ld, entry, mods );

 

The error code returned is 34 or 0x22 which means that the “distinguished name has an invalid syntax”.

Do I not need to give in “entry” the string containing the entry to add?

What is wrong with this code ?

 

Thanks,

Harry

Reply via email to