summaryrefslogtreecommitdiff
path: root/plugins/password/drivers/ldap.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-06-24 12:03:17 +0200
committerAleksander Machniak <alec@alec.pl>2014-06-24 12:03:17 +0200
commit7706df99f03fb5e492c92994d8e36620406a7a1a (patch)
tree2412e59dba7ed90063e7f91cf5a56dce409016b8 /plugins/password/drivers/ldap.php
parent79b25df70e33d07a376fd10bd73c388c1908f063 (diff)
Allow anonymous LDAP searches
Diffstat (limited to 'plugins/password/drivers/ldap.php')
-rw-r--r--plugins/password/drivers/ldap.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php
index 739958ad7..cc62595b5 100644
--- a/plugins/password/drivers/ldap.php
+++ b/plugins/password/drivers/ldap.php
@@ -130,9 +130,10 @@ class rcube_ldap_password
*/
function search_userdn($rcmail)
{
+ $binddn = $rcmail->config->get('password_ldap_searchDN');
+ $bindpw = $rcmail->config->get('password_ldap_searchPW');
+
$ldapConfig = array (
- 'binddn' => $rcmail->config->get('password_ldap_searchDN'),
- 'bindpw' => $rcmail->config->get('password_ldap_searchPW'),
'basedn' => $rcmail->config->get('password_ldap_basedn'),
'host' => $rcmail->config->get('password_ldap_host'),
'port' => $rcmail->config->get('password_ldap_port'),
@@ -140,6 +141,12 @@ class rcube_ldap_password
'version' => $rcmail->config->get('password_ldap_version'),
);
+ // allow anonymous searches
+ if (!empty($binddn)) {
+ $ldapConfig['binddn'] = $binddn;
+ $ldapConfig['bindpw'] = $bindpw;
+ }
+
$ldap = Net_LDAP2::connect($ldapConfig);
if (PEAR::isError($ldap)) {