mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-22 17:16:06 +00:00
Add default filters for users and groups
Some (all?) LDAP servers will just not respond if there is no filter, provide a sensible default.
This commit is contained in:
parent
bacf08fea6
commit
ed7f308b87
@ -696,11 +696,11 @@ $c->admin_email = 'calendar-admin@example.com';
|
||||
// 'networkTimeout' => 10, // timeout in seconds
|
||||
// 'baseDNUsers' => 'dc=example,dc=net', // where to look at valid user
|
||||
/* filter which must validate a user according to RFC4515, i.e.
|
||||
* surrounded by brackets */
|
||||
* surrounded by brackets. Default is (objectClass=*) */
|
||||
// 'filterUsers' => 'objectClass=kolabInetOrgPerson',
|
||||
/* where to look for groups */
|
||||
// 'baseDNGroups' => 'ou=divisions,dc=example,dc=net',
|
||||
/* filter with same rules as filterUsers */
|
||||
/* filter with same rules as filterUsers, and the same default. */
|
||||
// 'filterGroups' => 'objectClass=groupOfUniqueNames',
|
||||
/* /!\ "username" should be set and "modified" must be set
|
||||
* used to create the user based on their ldap properties */
|
||||
|
||||
@ -113,21 +113,36 @@ class ldapDriver
|
||||
break;
|
||||
}
|
||||
|
||||
// This is useful to see what is happening at a low level. I also
|
||||
// recommend tcpdump...
|
||||
//ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
|
||||
|
||||
//connect as root
|
||||
if (!ldap_bind($this->connect, (isset($config['bindDN']) ? $config['bindDN'] : null), (isset($config['passDN']) ? $config['passDN'] : null) ) ){
|
||||
$bindDN = isset($config['bindDN']) ? $config['bindDN'] : 'anonymous';
|
||||
$passDN = isset($config['passDN']) ? $config['passDN'] : 'anonymous';
|
||||
|
||||
dbg_error_log( "LDAP", i18n('drivers_ldap : Failed to bind to host %1$s on port %2$s with bindDN of %3$s'), $host, $port, $bindDN );
|
||||
$c->messages[] = i18n( 'drivers_ldap : Unable to bind to LDAP - check your configuration for bindDN and passDN, and that your LDAP server is reachable');
|
||||
$this->valid=false;
|
||||
return ;
|
||||
}
|
||||
$this->valid = true;
|
||||
//root to start search
|
||||
$this->baseDNUsers = is_string($config['baseDNUsers']) ? array($config['baseDNUsers']) : $config['baseDNUsers'];
|
||||
$this->filterUsers = (isset($config['filterUsers']) ? $config['filterUsers'] : null);
|
||||
$this->baseDNGroups = (isset($config['baseDNGroups']) ? (is_string($config['baseDNGroups']) ? array($config['baseDNGroups']) : $config['baseDNGroups']) : null);
|
||||
$this->filterGroups = (isset($config['filterGroups']) ? $config['filterGroups'] : null);
|
||||
|
||||
// root to start search
|
||||
$this->baseDNUsers =
|
||||
is_string($config['baseDNUsers']) ?
|
||||
array($config['baseDNUsers']) : $config['baseDNUsers'];
|
||||
$this->filterUsers =
|
||||
(isset($config['filterUsers']) ?
|
||||
$config['filterUsers'] : '(objectclass=*)');
|
||||
$this->baseDNGroups =
|
||||
(isset($config['baseDNGroups']) ?
|
||||
(is_string($config['baseDNGroups']) ?
|
||||
array($config['baseDNGroups']) : $config['baseDNGroups']) : null);
|
||||
$this->filterGroups =
|
||||
(isset($config['filterGroups']) ?
|
||||
$config['filterGroups'] : '(objectclass=*)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user