diff --git a/config/example-config.php b/config/example-config.php index ace96dd7..2a11b701 100644 --- a/config/example-config.php +++ b/config/example-config.php @@ -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 */ diff --git a/inc/drivers_ldap.php b/inc/drivers_ldap.php index 68d1f9e7..51e023d5 100644 --- a/inc/drivers_ldap.php +++ b/inc/drivers_ldap.php @@ -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=*)'); } /**