I am trying to add value to attribute for user in LDAP. I have user "uid=testUser,ou=Local,ou=Type1,ou=People,dc=mnopid,dc=com"
For that user I have schema under "objectClass:inetOrgPerson" and attribute name is "mailid"
I have created LDAPMod structure. I am using ldap_add_ext API to add the attribute.
My code is in c language.
My code for addition part is (this is not complete code)
#define CHANGE_DN = "uid=testUser,ou=Local,ou=Type1,ou=People,dc=mnopid,dc=com";
LDAPMod *mods[2] ;
LDAPMod modsattr ;
int rc,msgid;
char *mail[] = { "[email protected]",NULL };
modsattr.mod_op = LDAP_MOD_ADD;
modsattr.mod_type = "mailid";
modsattr.mod_values = mail;
mods[0]=&modsattr;
mods[1]=NULL;
rc = ldap_add_ext( ld, CHANGE_DN, mods, NULL, NULL ,&msgid );
All required data are properly defined.There are no compilation errors.
When I run the code I am getting error as "Object Class violation (65)
Please help.
=in#define CHANGE_DNwill certainly not help. I even wonder how that code compiles. If this is not the cause of your misfortunes, the error code you get means the request does not match your schema. Most likely a typo or a name confusion in yourCHANGE_DNstring. IIRC you should be able to get extended error informations to get a better idea of the cause of the violation (right now I can't remember how, but check the API just in case). Anyway, you have my sympathy for coping with this eyesore of a protocol. - kuroi neko