From 4fbd84febfede39a89692dc72bab07083250fbdd Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 19 Dec 2012 21:02:22 +0000 Subject: [PATCH] Remove a redundant check and change from text to boolean. --- includes/checkauth.php | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/includes/checkauth.php b/includes/checkauth.php index 2545b6cbd4..ed5fdff3d2 100644 --- a/includes/checkauth.php +++ b/includes/checkauth.php @@ -79,24 +79,22 @@ session_start(); $username = check_str($_REQUEST["username"]); //ldap authentication - if ($_SESSION["ldap"]["authentication"]["text"] == "true") { + if ($_SESSION["ldap"]["authentication"]["boolean"] == "true") { //use ldap to validate the user credentials - if ($_SESSION["ldap"]["authentication"]["text"] == "true") { - if (strlen(check_str($_REQUEST["domain_name"])) > 0) { - $domain_name = check_str($_REQUEST["domain_name"]); - } - $ad = ldap_connect("ldap://".$_SESSION["ldap"]["server_host"]["text"].":".$_SESSION["ldap"]["server_port"]["numeric"]) - or die("Couldn't connect to AD!"); - ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3); - $bd = ldap_bind($ad,$username."@".$domain_name,check_str($_REQUEST["password"])); - if ($bd) { - //echo "success\n"; - $auth_failed = false; - } - else { - //echo "failed\n"; - $auth_failed = true; - } + if (strlen(check_str($_REQUEST["domain_name"])) > 0) { + $domain_name = check_str($_REQUEST["domain_name"]); + } + $ad = ldap_connect("ldap://".$_SESSION["ldap"]["server_host"]["text"].":".$_SESSION["ldap"]["server_port"]["numeric"]) + or die("Couldn't connect to AD!"); + ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3); + $bd = ldap_bind($ad,$username."@".$domain_name,check_str($_REQUEST["password"])); + if ($bd) { + //echo "success\n"; + $auth_failed = false; + } + else { + //echo "failed\n"; + $auth_failed = true; } //check to see if the user exists