From 4fa022c550378f328409050aad4ea68178a919b9 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 27 Jan 2021 15:39:12 +0100 Subject: [PATCH] deco / reco LDAP --- .../src/Cadoles/CoreBundle/Service/ldapService.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php index 3122fe53..a0833093 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Service/ldapService.php @@ -45,6 +45,8 @@ class ldapService } public function connect() { + $this->disconnect(); + if($this->connection){ return $this->connection; } else { @@ -82,11 +84,8 @@ class ldapService } public function rename($oldDN, $newDN, $parentDN = '', $deleteOldDN = true){ - $connection = $this->connect(); - $result = ldap_rename($connection, $oldDN, $newDN, $parentDN, $deleteOldDN); - if(!$result) $this->ldapError(); return $result; } @@ -124,8 +123,10 @@ class ldapService } public function disconnect(){ - $connection = $this->connect(); - ldap_unbind($connection); + if($this->connection) { + ldap_unbind($this->connection); + $this->connection=null; + } } public function ldapError(){