From 93eb6c3e682954b5874de02f60d4e69a8ed48dfd Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 31 Dec 2007 14:45:14 +0000 Subject: [PATCH] Fix: debugage authentification ldap --- htdocs/lib/ldap.class.php | 1 + htdocs/main.inc.php | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/htdocs/lib/ldap.class.php b/htdocs/lib/ldap.class.php index 961d26caea5..fb4aba8b978 100644 --- a/htdocs/lib/ldap.class.php +++ b/htdocs/lib/ldap.class.php @@ -446,6 +446,7 @@ class Ldap $this->result = @ldap_bind( $this->connection,$checkDn,$pass); if ( $this->result) { // Connected OK - login credentials are fine! + $this->ldapUserDN = $checkDn; return true; } else { /* Login failed. Return false, together with the error code and text from diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d8cf7bdae92..d8b2b71e6e9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -311,20 +311,15 @@ if (! isset($_SESSION["dol_login"])) $ldap->serverPort=$ldapport; $ldap->ldapProtocolVersion=$ldapversion; $ldap->serverType=$ldapservertype; - //$ldap->searchUser=$ldapadminlogin; - //$ldap->searchPassword=$ldapadminpass; $ldap->searchUser=$usertotest; $ldap->searchPassword=$passwordtotest; if ($ldapdebug) dolibarr_syslog("Authentification LDAP --> Server:".join(',',$ldap->server).", Port:".$ldap->serverPort.", Protocol:".$ldap->ldapProtocolVersion.", Type:".$ldap->serverType.", Admin:".$ldap->searchUser.", Pass:".$ldap->searchPassword); + $resultCheckUserDN = $ldap->checkPass($usertotest,$passwordtotest); + if ($resultCheckUserDN) $ldap->searchUser = $ldap->ldapUserDN; + $result=$ldap->connect_bind(); - //$resultCheck=$ldap->checkPass($usertotest,$passwordtotest); - print $ldap->ldapErrorCode.'
'; - print $ldap->ldapErrorText.'
'; - print 'domain:'.$ldap->ldapDebugDomain.'
'; - print 'DN:'.$ldap->ldapDebugDN.'
'; - //print 'result:'.$resultCheck.'
'; if ($result > 0) {