summaryrefslogtreecommitdiff
path: root/inc/auth
diff options
context:
space:
mode:
authorAndreas Gohr <gohr@cosmocode.de>2009-11-02 15:13:33 +0100
committerAndreas Gohr <gohr@cosmocode.de>2009-11-02 15:13:33 +0100
commit48bd73305937722d43671a18e6e8b89626cf1264 (patch)
tree67ca15fca6793ce09e02a99f634e42b7ea18cb74 /inc/auth
parentd9e6a3cb751a0715197451f06c12091fec2b0679 (diff)
downloadrpg-48bd73305937722d43671a18e6e8b89626cf1264.tar.gz
rpg-48bd73305937722d43671a18e6e8b89626cf1264.tar.bz2
ad auth: do not connect to AD server in constructor FS#1791
Ignore-this: 5b5b6e67b2800c0ecde8b65de303c4df darcs-hash:20091102141333-6e07b-70ea837064d771c088b4e0000021778b5b8178c5.gz
Diffstat (limited to 'inc/auth')
-rw-r--r--inc/auth/ad.class.php27
1 files changed, 20 insertions, 7 deletions
diff --git a/inc/auth/ad.class.php b/inc/auth/ad.class.php
index 05c4c1f8e..f1440969a 100644
--- a/inc/auth/ad.class.php
+++ b/inc/auth/ad.class.php
@@ -81,13 +81,6 @@ class auth_ad extends auth_basic {
$opts['domain_controllers'] = array_map('trim',$opts['domain_controllers']);
$opts['domain_controllers'] = array_filter($opts['domain_controllers']);
- // connect
- try {
- $this->adldap = new adLDAP($opts);
- } catch (adLDAPException $e) {
- $this->success = false;
- }
-
// we currently just handle authentication, so no capabilities are set
}
@@ -106,6 +99,7 @@ class auth_ad extends auth_basic {
$_SERVER['REMOTE_USER'] == $user &&
$this->cnf['sso']) return true;
+ if(!$this->_init()) return false;
return $this->adldap->authenticate($user, $pass);
}
@@ -129,6 +123,8 @@ class auth_ad extends auth_basic {
*/
function getUserData($user){
global $conf;
+ if(!$this->_init()) return false;
+
//get info for given user
$result = $this->adldap->user_info($user);
@@ -171,6 +167,23 @@ class auth_ad extends auth_basic {
return $sName;
}
+
+ /**
+ * Initialize the AdLDAP library and connect to the server
+ */
+ function _init(){
+ if(!is_null($this->adldap)) return true;
+
+ // connect
+ try {
+ $this->adldap = new adLDAP($opts);
+ return true;
+ } catch (adLDAPException $e) {
+ $this->success = false;
+ $this->adldap = null;
+ }
+ return false;
+ }
}
//Setup VIM: ex: et ts=4 enc=utf-8 :