From 6e506ece30752fb2fe733b7eadf4638862010dc9 Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Mon, 26 Oct 2009 22:09:49 +0000
Subject: [PATCH] =?UTF-8?q?Il=20y=20a=20visiblement=20des=20serveurs=20LDA?=
 =?UTF-8?q?P=20qui=20ne=20supportent=20pas=20que=20l'on=20fasse=20deux=20c?=
 =?UTF-8?q?onnect=20dans=20une=20m=C3=AAme=20session.=20On=20passe=20le=20?=
 =?UTF-8?q?descripteur=20de=20session=20LDAP=20en=20statique=20pour=20avoi?=
 =?UTF-8?q?r=20la=20paix.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/auth/ldap.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/ecrire/auth/ldap.php b/ecrire/auth/ldap.php
index 278aabe872..ecb58fa76a 100644
--- a/ecrire/auth/ldap.php
+++ b/ecrire/auth/ldap.php
@@ -66,6 +66,8 @@ function auth_ldap_dist ($login, $pass, $serveur='') {
  */
 function auth_ldap_connect($serveur='') {
 	include_spip('base/connect_sql');
+	static $connexions_ldap = array();
+	if (isset($connexions_ldap[$serveur])) return $connexions_ldap[$serveur]; 
 	$connexion = spip_connect($serveur);
 	if (!is_array($connexion['ldap'])) {
 		if ($connexion['authentification']['ldap']) {
@@ -75,9 +77,10 @@ function auth_ldap_connect($serveur='') {
 			if (isset($GLOBALS['ldap_link']))
 				$connexion['ldap'] = array('link' => $GLOBALS['ldap_link'],
 					'base' => $GLOBALS['ldap_base']);
-		}
+			else spip_log("connection LDAP $serveur mal definie dans $f");
+		} else spip_log("connection LDAP $serveur inconnue");
 	}
-	return $connexion['ldap'];
+	return $connexions_ldap[$serveur]=$connexion['ldap'];
 }
 
 /**
-- 
GitLab