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

problem with ldap_modify_s



We are experiencing unexpected behavior using this function.

Here is our code example:

 	LDAPMod *array[2];
      array[0]=new (LDAPMod )[sizeof(LDAPMod)];
      array[0]->mod_op=LDAP_MOD_REPLACE;
      array[0]->mod_type="SPAM";
      array[0]->mod_vals.modv_strvals=new char*[2];
      array[0]->mod_vals.modv_strvals[0]="EGGS&SPAM";
      array[0]->mod_vals.modv_strvals[1]=NULL;
      array[1]=NULL;
      int  rc=ldap_modify_s(LDAP_HANDLE_,"cn=albatross, ou=users,
dc=company", array);
      if(rc != LDAP_SUCCESS)
      {
                cout<<"LDAP update failed: "<<ldap_err2string(rc)<<endl; 
      } 


There is no entry "SPAM" under user "albatross" so we expect this operation
to fail. Instead it adds this entry which is the effect we would expect from
mod_op LDAP_MOD_ADD but not from LDAP_MOD_REPLACE.


Dmitry