--- ldap.php.orig 2006-05-02 16:53:10.000000000 +0200
+++ ldap.php 2006-05-22 15:27:20.463441074 +0200
@@ -290,15 +290,8 @@
/* Check if we need to rename the object. */
if ($this->_params['version'] == 3 &&
String::lower($this->_makeKey($attributes)) != String::lower($object_id)) {
- if (isset($this->_params['dn']) && is_array($this->_params['dn']) && count($this->_params['dn'])) {
- $pairs = array();
- foreach ($this->_params['dn'] as $param) {
- if (isset($attributes[$param])) {
- $pairs[] = array($param, $attributes[$param]);
- }
- }
- $newrdn = $this->_quoteDN($pairs);
- } else {
+ $newrdn = $this->_makeRDN($attributes);
+ if ($newrdn == '') {
return PEAR::raiseError(_("Missing DN in LDAP source configuration."));
}
@@ -351,17 +344,17 @@
}
/**
- * Build a DN based on a set of attributes and what attributes
- * make a DN for the current source.
+ * Build a RDN based on a set of attributes and what attributes
+ * make a RDN for the current source.
*
* @param array $attributes The attributes (in driver keys) of the
* object being added.
*
- * @return string The DN for the new object.
+ * @return string The RDN for the new object.
*/
- function _makeKey($attributes)
+ function _makeRDN($attributes)
{
- $dn = '';
+ $rdn = '';
if (is_array($this->_params['dn'])) {
$pairs = array();
foreach ($this->_params['dn'] as $param) {
@@ -369,10 +362,23 @@
$pairs[] = array($param, $attributes[$param]);
}
}
- $dn = $this->_quoteDN($pairs);
+ $rdn = $this->_quoteDN($pairs);
}
+ return $rdn;
+ }
- return $dn . ',' . $this->_params['root'];
+ /**
+ * Build a DN based on a set of attributes and what attributes
+ * make a DN for the current source.
+ *
+ * @param array $attributes The attributes (in driver keys) of the
+ * object being added.
+ *
+ * @return string The DN for the new object.
+ */
+ function _makeKey($attributes)
+ {
+ return $this->_makeRDN($attributes) . ',' . $this->_params['root'];
}
/**