diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-25 16:05:32 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-04-25 16:05:32 +0000 |
| commit | 96c8765eb19e1dc34d16ab6ac9260b572c6e1aba (patch) | |
| tree | a34e9489f965d91c6550721542199a9ef966d51c /frontends/php/index.php | |
| parent | 26c11b74017649a63f34e2aeec68f946c6058a6c (diff) | |
| download | zabbix-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/index.php')
| -rw-r--r-- | frontends/php/index.php | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/frontends/php/index.php b/frontends/php/index.php index 2d25791f..f469e6df 100644 --- a/frontends/php/index.php +++ b/frontends/php/index.php @@ -56,16 +56,36 @@ // return; } - if(isset($_REQUEST["enter"])&&($_REQUEST["enter"]=="Enter")) - { - $name = get_request("name",""); - $password = md5(get_request("password","")); + if(isset($_REQUEST["enter"])&&($_REQUEST["enter"]=="Enter")){ + + $config = select_config(); + + $name = get_request('name',''); + $password = md5(get_request('password','')); + + switch($config['authentication_type']){ + case ZBX_AUTH_LDAP: + $login = ldap_authentication($name,get_request('password','')); + break; + case ZBX_AUTH_INTERNAL: + default: + $alt_auth = ZBX_AUTH_INTERNAL; + $login = true; + } - $login = $row = DBfetch(DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.url,u.refresh '. + if($login){ + $login = $row = DBfetch(DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.url,u.refresh,u.passwd '. ' FROM users u, users_groups ug, usrgrp g '. ' WHERE u.alias='.zbx_dbstr($name). - ' AND u.passwd='.zbx_dbstr($password). + ((ZBX_AUTH_INTERNAL==$config['authentication_type'])?' AND u.passwd='.zbx_dbstr($password):''). ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID))); + } + +// update internal pass if it's different + if($login && ($row['passwd']!=$password) && (ZBX_AUTH_INTERNAL!=$config['authentication_type'])){ + DBexecute('UPDATE users SET passwd='.zbx_dbstr($password).' WHERE userid='.zbx_dbstr($row['userid'])); + } + if($login){ $login = (check_perm2login($row['userid']) && check_perm2system($row['userid'])); } @@ -80,9 +100,9 @@ add_audit(AUDIT_ACTION_LOGIN,AUDIT_RESOURCE_USER,"Correct login [".$name."]"); if(empty($row["url"])){ - global $USER_DETAILS; - $USER_DETAILS["alias"] = $row['alias']; + $USER_DETAILS['alias'] = $row['alias']; $USER_DETAILS['userid'] = $row['userid']; + $row["url"] = get_profile('web.menu.view.last','index.php'); unset($USER_DETAILS); } |
