I try to update novell edir informations via ldap.
Everything works fine except for the cn property.
With each update try I get an additional entry added to the list.
A var_dump of the read entries gives me: (snipped)
["cn"]=> array(8) { ["count"]=> int(7) [0]=> string(4) "Code" [1]=> string(1) "a" [2]=> string(2) "XX" [3]=> string(1) " " [4]=> string(3) "bbb" [5]=> string(7) "aasdasd" [6]=> string(4) "CCCC" } [14]=> string(2) "cn"
If I look in the ldap browser I get: aaa; XX; ; bbb; aasdasd; CCCC
How do I get rid of all the entries and always only replace the one?
I expected, a ldap_mod_replace would only replace values instead of adding some.
Here's the piece of code so far:
- Code: Select all
$ds = ldap_connect($LDAP_SERVER);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($ds) {
$r=ldap_bind($ds,$LDAP_USER,$LDAP_PASS);
$ldap_info['sn']=$lastname;
$ldap_info['givenname']=$givenname;
$ldap_info['mail']=$email;
$ldap_info['cn']=array($ldaploginname,$company);
$ldap_info['street']=$street;
$ldap_info['postalcode']=$postcode;
$ldap_info['physicaldeliveryofficename']=$city;
$ldap_info['preferredlanguage']=$prefsprache;
if (@ldap_mod_replace($ds, $ldapdn, $ldap_info)) {
?>
<table><tr><td class="border_message">Update</td></tr></table>
<?
} else {
?>
<table><tr><td class="border_error">Error</td></tr></table>
<?
}
}
ldap_close($ds);