summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2014-05-07 11:26:47 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2014-05-07 11:26:47 (GMT)
commitf4a07c96a1de7348441a4ca092f7a5dd5366870f (patch)
tree4d090eaea871e56dfa0de804f0e48ba5837cb340
parent9dd7e69e631b63c35f5c575e37548f3c7f0cd890 (diff)
downloadkolab-wap-f4a07c96a1de7348441a4ca092f7a5dd5366870f.tar.gz
Fix issue where it wasn't possible to update ldap record with modified objectclass (Bug #1921)
-rw-r--r--lib/ext/Net/LDAP3.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index dd3775f..7042c07 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -2173,19 +2173,25 @@ class Net_LDAP3
}
}
+ // Use ldap_modify() not ldap_mod_replace(), this is the only way to update entry
+ // in case of objectClass change (Bug #1921)
if (is_array($attributes['replace']) && !empty($attributes['replace'])) {
- $this->_debug("LDAP: C: Mod-Replace $subject_dn: " . json_encode($attributes['replace']));
+ $attrs = array_merge($attributes['replace'], $attributes['add']);
- $result = ldap_mod_replace($this->conn, $subject_dn, $attributes['replace']);
+ $this->_debug("LDAP: C: Modify $subject_dn: " . json_encode($attrs));
+
+ $result = ldap_modify($this->conn, $subject_dn, $attrs);
if ($result) {
$this->_debug("LDAP: S: OK");
}
else {
$this->_debug("LDAP: S: " . ldap_error($this->conn));
- $this->_warning("LDAP: Failed to replace attributes on $subject_dn: " . json_encode($attributes['replace']));
+ $this->_warning("LDAP: Failed to replace attributes on $subject_dn: " . json_encode($attrs));
return false;
}
+
+ unset($attributes['add'], $attributes['replace']);
}
if (is_array($attributes['del']) && !empty($attributes['del'])) {