mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
avoid error on ldap bind when session has expired
git-svn-id: http://www.observium.org/svn/observer/trunk@596 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -26,8 +26,10 @@ if($_COOKIE['username'] && $_COOKIE['password']){
|
|||||||
|
|
||||||
$auth_success = 0;
|
$auth_success = 0;
|
||||||
|
|
||||||
if ($config['auth_mechanism'] == "mysql" || !$config['auth_mechanism'])
|
if ($_SESSION['username'])
|
||||||
{
|
{
|
||||||
|
if ($config['auth_mechanism'] == "mysql" || !$config['auth_mechanism'])
|
||||||
|
{
|
||||||
$encrypted = md5($_SESSION['password']);
|
$encrypted = md5($_SESSION['password']);
|
||||||
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username']."' AND `password`='".$encrypted."'";
|
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username']."' AND `password`='".$encrypted."'";
|
||||||
$query = mysql_query($sql);
|
$query = mysql_query($sql);
|
||||||
@@ -35,9 +37,9 @@ if ($config['auth_mechanism'] == "mysql" || !$config['auth_mechanism'])
|
|||||||
if($row['username'] && $row['username'] == $_SESSION['username']) {
|
if($row['username'] && $row['username'] == $_SESSION['username']) {
|
||||||
$auth_success = 1;
|
$auth_success = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($config['auth_mechanism'] == "ldap")
|
else if ($config['auth_mechanism'] == "ldap")
|
||||||
{
|
{
|
||||||
$ds=@ldap_connect($config['auth_ldap_server'],$config['auth_ldap_port']);
|
$ds=@ldap_connect($config['auth_ldap_server'],$config['auth_ldap_port']);
|
||||||
if ($ds)
|
if ($ds)
|
||||||
{
|
{
|
||||||
@@ -46,11 +48,12 @@ else if ($config['auth_mechanism'] == "ldap")
|
|||||||
$auth_success = 1;
|
$auth_success = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
echo "ERROR: no valid auth_mechanism defined.";
|
echo "ERROR: no valid auth_mechanism defined.";
|
||||||
exit();
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($auth_success) {
|
if ($auth_success) {
|
||||||
|
Reference in New Issue
Block a user