Skip to content
Snippets Groups Projects
Commit 904377f5 authored by Nathan Neulinger's avatar Nathan Neulinger
Browse files

some fix for getUserData in the LDAP auth backend

darcs-hash:20060131222058-effc9-0d09141c02e3698329d038af90588b553fd6a44b.gz
parent c0f9af6d
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
class auth_ldap extends auth_basic { class auth_ldap extends auth_basic {
var $cnf = null; var $cnf = null;
var $con = null; var $con = null;
var $bound = false;
/** /**
* Constructor * Constructor
...@@ -78,6 +79,7 @@ class auth_ldap extends auth_basic { ...@@ -78,6 +79,7 @@ class auth_ldap extends auth_basic {
} }
return false; return false;
} }
$this->bound = true;
return true; return true;
}else{ }else{
// See if we can find the user // See if we can find the user
...@@ -96,6 +98,7 @@ class auth_ldap extends auth_basic { ...@@ -96,6 +98,7 @@ class auth_ldap extends auth_basic {
} }
return false; return false;
} }
$this->bound = true;
return true; return true;
} }
...@@ -128,6 +131,18 @@ class auth_ldap extends auth_basic { ...@@ -128,6 +131,18 @@ class auth_ldap extends auth_basic {
global $conf; global $conf;
if(!$this->_openLDAP()) return false; if(!$this->_openLDAP()) return false;
if(!$this->bound){
if($this->cnf['binddn'] && $this->cnf['bindpw']){
// use superuser credentials
if(!@ldap_bind($this->con,$this->cnf['binddn'],$this->cnf['bindpw'])){
if($this->cnf['debug'])
msg('LDAP bind as superuser: '.htmlspecialchars(ldap_error($this->con)),0);
return false;
}
}
$this->bound = true;
}
$info['user'] = $user; $info['user'] = $user;
$info['server'] = $this->cnf['server']; $info['server'] = $this->cnf['server'];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment