build fixed

This commit is contained in:
Marc Wäckerlin
2017-02-26 21:28:18 +00:00
parent f088cad616
commit 473aaa322f
7 changed files with 15 additions and 11 deletions

View File

@@ -1,9 +1,7 @@
<?php
$realm = "MY REALM HERE";
$ldaphost = "my.ldap.host";
$base = "dc=my,dc=server,dc=com";
$userbase = "ou=people,".$base;
$groupbase = "ou=group,".$base;
$ldapbase = "dc=my,dc=server,dc=com";
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="'.$REALM.'"');
header('HTTP/1.0 401 Unauthorized');
@@ -17,7 +15,7 @@ if (!isset($_SERVER['PHP_AUTH_USER'])) {
or error_die("failed to set LDAP protocol version 3");
ldap_start_tls($ldapconn)
or error_die($ldapconn, "cannot start LDAP TLS");
$ldapbind = @ldap_bind($ldapconn, 'uid='.$tstusername.','.$userbase, $password)
$ldapbind = @ldap_bind($ldapconn, 'uid='.$tstusername.','.$ldapbase, $password)
or error_die("login failed for $username", '403 Forbidden');
$username = $tstuserbname;
}