From 6f26110c7db229bfa9c9c00d9579b68e55bf7593 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Tue, 3 May 2011 12:22:04 +0000 Subject: [PATCH] patches from lenwe (remove crappy tiny if and fix auth) git-svn-id: http://www.observium.org/svn/observer/trunk@2221 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/authenticate.inc.php | 18 +++++++++++------- poller.php | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/html/includes/authenticate.inc.php b/html/includes/authenticate.inc.php index d58e9c79f1..fa014a24eb 100644 --- a/html/includes/authenticate.inc.php +++ b/html/includes/authenticate.inc.php @@ -31,11 +31,6 @@ if (isset($_GET['logout']) && $_SESSION['authenticated']) $auth_message = "Logged Out"; } -if(isset($config['auth_mechanism']) and $config['auth_mechanism'] == 'http-auth' and !isset($_GET['logout'])){ - $_GET['username'] = ''; - $_GET['password'] = ''; -} - if (isset($_GET['username']) && isset($_GET['password'])) { $_SESSION['username'] = mres($_GET['username']); @@ -65,9 +60,18 @@ else $auth_success = 0; -if (isset($_SESSION['username'])) +if (isset($_SESSION['username']) or ($config['auth_mechanism'] == 'http-auth' and !isset($_GET['logout']))) { - if (authenticate($_SESSION['username'],$_SESSION['password'])) + if($config['auth_mechanism'] == 'http-auth') + { + $authenticateResult = authenticate(false,false); + } + else + { + $authenticateResult = authenticate($_SESSION['username'],$_SESSION['password']); + } + + if ($authenticateResult) { $_SESSION['userlevel'] = get_userlevel($_SESSION['username']); $_SESSION['user_id'] = get_userid($_SESSION['username']); diff --git a/poller.php b/poller.php index 2cfa7f62dc..82d1254cd2 100755 --- a/poller.php +++ b/poller.php @@ -88,9 +88,11 @@ if (isset($options['d'])) echo("Starting polling run:\n\n"); $polled_devices = 0; if(!isset($query)) +{ $device_query = mysql_query("SELECT `device_id` FROM `devices` WHERE `disabled` = 0 $where ORDER BY `device_id` ASC"); -else +} else { $device_query = mysql_query($query); +} print mysql_error(); while ($device = mysql_fetch_assoc($device_query))