summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Neulinger <nneul@umr.edu>2006-01-31 23:20:58 +0100
committerNathan Neulinger <nneul@umr.edu>2006-01-31 23:20:58 +0100
commit904377f5a44da9b49a2411f801d39361cc885438 (patch)
treed426c2a281e31429223867ab6f17df9fa9356506
parentc0f9af6d02ac1aebd4c0ce700f81d28a75170017 (diff)
downloadrpg-904377f5a44da9b49a2411f801d39361cc885438.tar.gz
rpg-904377f5a44da9b49a2411f801d39361cc885438.tar.bz2
some fix for getUserData in the LDAP auth backend
darcs-hash:20060131222058-effc9-0d09141c02e3698329d038af90588b553fd6a44b.gz
-rw-r--r--inc/auth/ldap.class.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/inc/auth/ldap.class.php b/inc/auth/ldap.class.php
index ac067c888..f59800476 100644
--- a/inc/auth/ldap.class.php
+++ b/inc/auth/ldap.class.php
@@ -11,6 +11,7 @@
class auth_ldap extends auth_basic {
var $cnf = null;
var $con = null;
+ var $bound = false;
/**
* Constructor
@@ -78,6 +79,7 @@ class auth_ldap extends auth_basic {
}
return false;
}
+ $this->bound = true;
return true;
}else{
// See if we can find the user
@@ -96,6 +98,7 @@ class auth_ldap extends auth_basic {
}
return false;
}
+ $this->bound = true;
return true;
}
@@ -128,6 +131,18 @@ class auth_ldap extends auth_basic {
global $conf;
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['server'] = $this->cnf['server'];