FIX For better compatibility with Samba4 AD
This commit is contained in:
parent
03b540b948
commit
03fbd72d66
@ -55,6 +55,10 @@ class Ldap
|
||||
/**
|
||||
* Version du protocole ldap
|
||||
*/
|
||||
public $ldapProtocolVersion;
|
||||
/**
|
||||
* Server DN
|
||||
*/
|
||||
public $domain;
|
||||
/**
|
||||
* User administrateur Ldap
|
||||
@ -466,8 +470,6 @@ class Ldap
|
||||
*/
|
||||
public function modify($dn, $info, $user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::modify dn=".$dn." info=".join(',', $info));
|
||||
|
||||
// Check parameters
|
||||
@ -492,6 +494,10 @@ class Ldap
|
||||
$this->dump($dn, $info);
|
||||
|
||||
//print_r($info);
|
||||
// For better compatibility with Samba4 AD
|
||||
if ($this->serverType == "activedirectory") {
|
||||
unset($info['cn']); // For avoid error : Operation not allowed on RDN (Code 67)
|
||||
}
|
||||
$result=@ldap_modify($this->connection, $dn, $info);
|
||||
|
||||
if ($result)
|
||||
@ -520,8 +526,6 @@ class Ldap
|
||||
*/
|
||||
public function rename($dn, $newrdn, $newparent, $user, $deleteoldrdn = true)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::modify dn=".$dn." newrdn=".$newrdn." newparent=".$newparent." deleteoldrdn=".($deleteoldrdn?1:0));
|
||||
|
||||
// Check parameters
|
||||
@ -571,8 +575,6 @@ class Ldap
|
||||
*/
|
||||
public function update($dn, $info, $user, $olddn, $newrdn = false, $newparent = false)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::update dn=".$dn." olddn=".$olddn);
|
||||
|
||||
// Check parameters
|
||||
@ -589,7 +591,7 @@ class Ldap
|
||||
|
||||
if (! $olddn || $olddn != $dn)
|
||||
{
|
||||
if (! empty($olddn) && ! empty($newrdn) && ! empty($newparent) && $conf->global->LDAP_SERVER_PROTOCOLVERSION === '3')
|
||||
if (! empty($olddn) && ! empty($newrdn) && ! empty($newparent) && $this->ldapProtocolVersion === '3')
|
||||
{
|
||||
// This function currently only works with LDAPv3
|
||||
$result = $this->rename($olddn, $newrdn, $newparent, $user, true);
|
||||
@ -631,8 +633,6 @@ class Ldap
|
||||
*/
|
||||
public function delete($dn)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(get_class($this)."::delete Delete LDAP entry dn=".$dn);
|
||||
|
||||
// Check parameters
|
||||
|
||||
Loading…
Reference in New Issue
Block a user