mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-18 23:42:17 +00:00
This commit is contained in:
+13
-12
@@ -34,6 +34,7 @@ function get_uid()
|
||||
return strtolower(trim($_SERVER['REMOTE_USER']));
|
||||
// fuer Testzwecke
|
||||
//return 'oesi';
|
||||
//return 'pam';
|
||||
}
|
||||
|
||||
function crlf()
|
||||
@@ -343,45 +344,45 @@ function checkalias($alias)
|
||||
function checkldapuser($username,$password)
|
||||
{
|
||||
if($connect=@ldap_connect(LDAP_SERVER))
|
||||
{
|
||||
{
|
||||
// bind to ldap connection
|
||||
if(($bind=@ldap_bind($connect)) == false)
|
||||
{
|
||||
print "bind:__FAILED__<br>\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// search for user
|
||||
if (($res_id = ldap_search( $connect, LDAP_BASE_DN, "uid=$username")) == false)
|
||||
if (($res_id = ldap_search( $connect, LDAP_BASE_DN, "uid=$username")) == false)
|
||||
{
|
||||
print "failure: search in LDAP-tree failed<br>";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ldap_count_entries($connect, $res_id) != 1)
|
||||
|
||||
if (ldap_count_entries($connect, $res_id) != 1)
|
||||
{
|
||||
print "failure: username $username found more than once<br>\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (( $entry_id = ldap_first_entry($connect, $res_id))== false)
|
||||
|
||||
if (( $entry_id = ldap_first_entry($connect, $res_id))== false)
|
||||
{
|
||||
print "failur: entry of searchresult couln't be fetched<br>\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (( $user_dn = ldap_get_dn($connect, $entry_id)) == false)
|
||||
|
||||
if (( $user_dn = ldap_get_dn($connect, $entry_id)) == false)
|
||||
{
|
||||
print "failure: user-dn coulnd't be fetched<br>\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Authentifizierung des User */
|
||||
if (($link_id = @ldap_bind($connect, $user_dn, $password)) == false)
|
||||
if (($link_id = @ldap_bind($connect, $user_dn, $password)) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
@ldap_close($connect);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user