LDAP authentication adjust the username remove the @ domain_name as part of the username.

This commit is contained in:
Mark Crane
2012-12-14 21:57:29 +00:00
parent a956e9ae1d
commit 3993ff0c28
+1 -2
View File
@@ -84,12 +84,11 @@ session_start();
if ($_SESSION["ldap"]["authentication"]["text"] == "true") { if ($_SESSION["ldap"]["authentication"]["text"] == "true") {
if (strlen(check_str($_REQUEST["domain_name"])) > 0) { if (strlen(check_str($_REQUEST["domain_name"])) > 0) {
$domain_name = check_str($_REQUEST["domain_name"]); $domain_name = check_str($_REQUEST["domain_name"]);
$username .= "@".$domain_name;
} }
$ad = ldap_connect("ldap://".$_SESSION["ldap"]["server_host"]["text"].":".$_SESSION["ldap"]["server_port"]["numeric"]) $ad = ldap_connect("ldap://".$_SESSION["ldap"]["server_host"]["text"].":".$_SESSION["ldap"]["server_port"]["numeric"])
or die("Couldn't connect to AD!"); or die("Couldn't connect to AD!");
ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
$bd = ldap_bind($ad,$username,check_str($_REQUEST["password"])); $bd = ldap_bind($ad,$username."@".$domain_name,check_str($_REQUEST["password"]));
if ($bd) { if ($bd) {
//echo "success\n"; //echo "success\n";
$auth_failed = false; $auth_failed = false;