[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
ldap_add_s - mods.mod_values empty
Hello,
Firstly, I hope this is the correct list
Relevant versions:
O/S: Debian Etch (server) - Debian Lenny (client)
Slapd : OpenLDAP: slapd 2.3.30
Client libs : libldap2 (debian)
I'm seeing some problems using the ldap_add_s function call - For some reason the mods.mod_values array *appears* to be empty - slapd reports that it's missing values for the attribute type and wireshark confirms that to be the case (partial extract below).
addRequest
entry: macaddress=002145ccfadf,dc=nodomain
attributes: 2 items
Item macaddress
type: macaddress
vals: 0 items
The below is the partial source code involved.
Code :
char * vals[LdapDefaults::MAX_MODS][2];
ACE_DEBUG((LM_DEBUG, "(%t) Add Entry %s:%s %D \n", tempName, tempValue));
vals[loopcount][0] = new char [LdapDefaults::MAX_OPTION_LEN];
vals[loopcount][1] = 0;
opTypes[loopcount] = new char [LdapDefaults::MAX_OPTION_LEN];
mod[loopcount].mod_op = 0;
strcpy (opTypes[loopcount], tempName);
strcpy (vals[loopcount][0], tempValue);
mod[loopcount].mod_type = new char [LdapDefaults::MAX_OPTION_LEN];
strcpy (mod[loopcount].mod_type ,opTypes[loopcount]);
mod[loopcount].mod_values = vals[loopcount];
loopcount ++;
++ nvpBegin ;
for (int counter = 0 ; counter < loopcount ; counter ++)
{
mods[counter] = &mod[counter];
mods[counter]->mod_values = sn_values;
ADA_DEBUG ((LM_DEBUG, "Value == %s\n", mods[counter]->mod_values[0]));
}
mods[loopcount] = 0;
errCode = ldap_add_s(pld, tempDn , mods) ;
addRequest
entry: macaddress=002145ccfadf,dc=nodomain
attributes: 2 items
Item macaddress
type: macaddress
vals: 0 items
There are a couple of curious things here.
1. Assigning mod->mod_values to a statically declared array ( char *sn_values[] = { "Jensen", NULL }; mods[counter]->mod_values = sn_values;) does not change the behavior
2. Debugging the contents of mods[i]->mod_values[0] immediately before and after the call to ldap_add_s shows that the correct values as being present in the structure.
3. Building a standalone test application and directly linking my library produced works as expected.
Any thoughts on how to debug this further much appreciated.
Thanks
Sean