Permalink
Browse files

fix bug#290

git-svn-id: http://svn.php.net/repository/pear/packages/Net_LDAP/trunk@145011 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 82b4efd commit 2efd9a034854c654e1d48006c47d312dd66ebcd5 Jan Wagner committed Nov 28, 2003
Showing with 11 additions and 8 deletions.
  1. +11 −8 LDAP/Entry.php
View
@@ -115,6 +115,7 @@ function Net_LDAP_Entry($link = null, $dn = null, $attributes = null)
$this->updateCheck['newEntry'] = true;
}
}
+
/**
* Set the reasourcelink to the ldapserver.
*
@@ -243,9 +244,9 @@ function add($attr = array())
*
* @param string DN
*/
- function dn($newdn="")
+ function dn($newdn = '')
{
- if ($newdn == "") {
+ if ($newdn == '') {
return $this->_dn;
}
@@ -443,12 +444,14 @@ function update ($ldapObject = null)
if (@ldap_get_option( $this->_link, LDAP_OPT_PROTOCOL_VERSION, $version) && $version != 3) {
return $this->raiseError("Moving or renaming an dn is only supported in LDAP V3!", 80);
}
- // ldap_rename ( resource link_identifier, string dn, string newrdn, string newparent, bool deleteoldrdn)
- $newparent = ldap_explode_dn($this->_dn,0);
- // remove the first part
- array_pop($newparent);
- if (!@ldap_rename( $this->_link,$this->_olddn,$this->_dn,$newparent,true) ){
- return $this->raiseError("DN not renamed: " . ldap_error($this->_link),ldap_errno($this->_link));
+
+ $newparent = ldap_explode_dn($this->_dn, 0);
+ unset($newparent['count']);
+ $relativeDn = array_shift($newparent);
+ $newparent = join(',', $newparent);
+
+ if (!@ldap_rename($this->_link, $this->_olddn, $relativeDn, $newparent, true)) {
+ return $this->raiseError("DN not renamed: " . ldap_error($this->_link), ldap_errno($this->_link));
}
}

0 comments on commit 2efd9a0

Please sign in to comment.