summaryrefslogtreecommitdiffstats
path: root/frontends/php/index.php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-23 10:30:10 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-05-23 10:30:10 +0000
commit1528814bf6b442cc01211b9f0b3f2adaadf970f4 (patch)
tree8fc3c0a9e980925d6d96313f3737cd3576b90c16 /frontends/php/index.php
parentb0a86ef20a92d1243c7e32510a81b70705980fa4 (diff)
downloadzabbix-1528814bf6b442cc01211b9f0b3f2adaadf970f4.tar.gz
zabbix-1528814bf6b442cc01211b9f0b3f2adaadf970f4.tar.xz
zabbix-1528814bf6b442cc01211b9f0b3f2adaadf970f4.zip
- [DEV-172] added support of Apache authentication (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5724 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/index.php')
-rw-r--r--frontends/php/index.php41
1 files changed, 31 insertions, 10 deletions
diff --git a/frontends/php/index.php b/frontends/php/index.php
index 0a02173c..14de05bc 100644
--- a/frontends/php/index.php
+++ b/frontends/php/index.php
@@ -44,7 +44,7 @@
$sessionid = get_cookie('zbx_sessionid', null);
if(isset($_REQUEST["reconnect"]) && isset($sessionid)){
- add_audit(AUDIT_ACTION_LOGOUT,AUDIT_RESOURCE_USER,"Manual Logout");
+ add_audit(AUDIT_ACTION_LOGOUT,AUDIT_RESOURCE_USER,'Manual Logout');
zbx_unsetcookie('zbx_sessionid');
DBexecute("delete from sessions where sessionid=".zbx_dbstr($sessionid));
@@ -55,10 +55,21 @@
// return;
}
- if(isset($_REQUEST["enter"])&&($_REQUEST["enter"]=="Enter")){
-
- $config = select_config();
+ $config = select_config();
+ if($config['authentication_type'] == ZBX_AUTH_HTTP){
+ if(isset($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_USER'])){
+ $_REQUEST['enter'] = 'Enter';
+ $_REQUEST['name'] = $_SERVER["PHP_AUTH_USER"];
+// $_REQUEST['password'] = $_SERVER["PHP_AUTH_PW"];
+ }
+ else{
+ access_deny();
+ }
+ }
+
+ if(isset($_REQUEST['enter'])&&($_REQUEST['enter']=='Enter')){
+
$name = get_request('name','');
$password = md5(get_request('password',''));
@@ -76,6 +87,9 @@
case ZBX_AUTH_LDAP:
$login = ldap_authentication($name,get_request('password',''));
break;
+ case ZBX_AUTH_HTTP:
+ $login = true;
+ break;
case ZBX_AUTH_INTERNAL:
default:
$alt_auth = ZBX_AUTH_INTERNAL;
@@ -91,11 +105,11 @@
' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
}
-// update internal pass if it's different
+/* 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']));
}
@@ -138,16 +152,23 @@
}
include_once "include/page_header.php";
-
+
if(isset($_REQUEST['message'])) show_error_message($_REQUEST['message']);
if(!isset($sessionid)){
- insert_login_form();
+ switch($config['authentication_type']){
+ case ZBX_AUTH_HTTP:
+ break;
+ case ZBX_AUTH_LDAP:
+ case ZBX_AUTH_INTERNAL:
+ default:
+ insert_login_form();
+ }
+
}
else{
- $logoff = new CLink('here', '?reconnect=1', 'styled');
echo '<div align="center" class="textcolorstyles">Welcome to ZABBIX! You are connected as <b>'.$USER_DETAILS['alias'].'</b>.</div>';
- }
+ }
?>
<?php