Skip to content
Snippets Groups Projects
Commit 48bd7330 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

ad auth: do not connect to AD server in constructor FS#1791

Ignore-this: 5b5b6e67b2800c0ecde8b65de303c4df

darcs-hash:20091102141333-6e07b-70ea837064d771c088b4e0000021778b5b8178c5.gz
parent d9e6a3cb
No related branches found
No related tags found
No related merge requests found
......@@ -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 :
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