summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/perm.inc.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-25 16:05:32 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-04-25 16:05:32 +0000
commit96c8765eb19e1dc34d16ab6ac9260b572c6e1aba (patch)
treea34e9489f965d91c6550721542199a9ef966d51c /frontends/php/include/perm.inc.php
parent26c11b74017649a63f34e2aeec68f946c6058a6c (diff)
downloadzabbix-96c8765eb19e1dc34d16ab6ac9260b572c6e1aba.tar.gz
zabbix-96c8765eb19e1dc34d16ab6ac9260b572c6e1aba.tar.xz
zabbix-96c8765eb19e1dc34d16ab6ac9260b572c6e1aba.zip
- [DEV-145] added Ldap authentication (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5657 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/perm.inc.php')
-rw-r--r--frontends/php/include/perm.inc.php37
1 files changed, 29 insertions, 8 deletions
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index 9576ba2f..c0692cf4 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -35,8 +35,7 @@
CHECK USER AUTHORISATION
*****************************************/
- function check_authorisation()
- {
+ function check_authorisation(){
global $page;
global $PHP_AUTH_USER,$PHP_AUTH_PW;
global $USER_DETAILS;
@@ -47,9 +46,9 @@
$sessionid = get_cookie("zbx_sessionid");
- if(!is_null($sessionid))
- {
- $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* FROM sessions s,users u'.
+ if(!is_null($sessionid)){
+ $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* '.
+ ' FROM sessions s,users u'.
' WHERE s.sessionid='.zbx_dbstr($sessionid).
' AND s.userid=u.userid'.
' AND ((s.lastaccess+u.autologout>'.time().') OR (u.autologout=0))'.
@@ -60,7 +59,8 @@
}
if(!$USER_DETAILS){
- $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.* FROM users u '.
+ $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.* '.
+ ' FROM users u '.
' WHERE u.alias='.zbx_dbstr(ZBX_GUEST_USER).
' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
if(!$USER_DETAILS){
@@ -103,8 +103,7 @@
"nodeid"=>0));
}
- if(!$login || isset($incorrect_session) || isset($missed_user_guest))
- {
+ if(!$login || isset($incorrect_session) || isset($missed_user_guest)){
if(isset($incorrect_session)) $message = "Session was ended, please relogin!";
else if(isset($missed_user_guest)){
$row = DBfetch(DBselect('SELECT count(u.userid) as user_cnt FROM users u'));
@@ -119,6 +118,28 @@
exit;
}
}
+
+/*****************************************
+ LDAP AUTHENTICATION
+*****************************************/
+function ldap_authentication($user,$passwd,$cnf=NULL){
+ if(is_null($cnf)){
+ $config = select_config();
+ foreach($config as $id => $value){
+ if(strpos($id,'ldap_') !== false){
+ $cnf[str_replace('ldap_','',$id)] = $config[$id];
+ }
+ }
+ }
+
+ $ldap = new CLdap($cnf);
+ $ldap->connect();
+
+ $result = $ldap->checkPass($user,$passwd);
+
+return $result;
+}
+
/***********************************************
CHECK USER ACCESS TO SYSTEM STATUS