mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-24 17:36:39 +00:00
Allow the filterUser to be specified with or without brackets around it.
This commit is contained in:
parent
3084924a80
commit
6c872407f7
@ -153,7 +153,17 @@ function LDAP_check($username, $password ){
|
||||
if ( $ldapDriver->valid ) {
|
||||
$mapping = $c->authenticate_hook['config']['mapping_field'];
|
||||
$attributs=array_values($mapping);
|
||||
$filter="(& $ldapDriver->filterUsers (".$mapping["username"]."=$username))";
|
||||
|
||||
// If the config contains a filter that starts with a ( then believe
|
||||
// them and don't modify it, otherwise wrap the filter.
|
||||
$filter_munge = "";
|
||||
if ( preg_match( '/^\(/', $ldapDriver->filterUsers ) ) {
|
||||
$filter_munge = $ldapDriver->filterUsers;
|
||||
} else {
|
||||
$filter_munge = "($ldapDriver->filterUsers)";
|
||||
}
|
||||
|
||||
$filter="(&$filter_munge(".$mapping["username"]."=$username))";
|
||||
dbg_error_log( "LDAP", "checking user %s for password %s against LDAP",$username,$password );
|
||||
$valid = $ldapDriver->requestUser($filter,$attributs,$password);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user