summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2014-06-24 14:19:42 +0200
committerThomas Bruederli <thomas@roundcube.net>2014-06-24 14:19:42 +0200
commit36a10247c0b05d518f4c2c8f7bf74e3181ea5050 (patch)
treea735e34f63c6ae8affe96c4ceb7ca22211ee547a /plugins
parentdfc9d7f20955c4d722b78f47a2a07d89592ed9a4 (diff)
parente306ac72fc0cc09ed3563d883fcc5bd3ff98dfdf (diff)
Merge branch 'master' of github.com:roundcube/roundcubemail
Diffstat (limited to 'plugins')
-rw-r--r--plugins/password/drivers/ldap.php11
-rw-r--r--plugins/password/drivers/ldap_simple.php15
2 files changed, 16 insertions, 10 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)) {
diff --git a/plugins/password/drivers/ldap_simple.php b/plugins/password/drivers/ldap_simple.php
index 3e167ea5b..3c19ccde5 100644
--- a/plugins/password/drivers/ldap_simple.php
+++ b/plugins/password/drivers/ldap_simple.php
@@ -168,14 +168,16 @@ class rcube_ldap_simple_password
*/
function search_userdn($rcmail, $ds)
{
- $search_user = $rcmail->config->get('password_ldap_searchDN');
- $search_pass = $rcmail->config->get('password_ldap_searchPW');
+ $search_user = $rcmail->config->get('password_ldap_searchDN');
+ $search_pass = $rcmail->config->get('password_ldap_searchPW');
+ $search_base = $rcmail->config->get('password_ldap_search_base');
+ $search_filter = $rcmail->config->get('password_ldap_search_filter');
- if (empty($search_user)) {
- return null;
+ if (empty($search_filter)) {
+ return false;
}
- $this->_debug("C: Bind $search_user, pass: **** [" . strlen($search_pass) . "]");
+ $this->_debug("C: Bind " . ($search_user ? $search_user : '[anonymous]'));
// Bind
if (!ldap_bind($ds, $search_user, $search_pass)) {
@@ -185,9 +187,6 @@ class rcube_ldap_simple_password
$this->_debug("S: OK");
- $search_base = $rcmail->config->get('password_ldap_search_base');
- $search_filter = $rcmail->config->get('password_ldap_search_filter');
-
$search_base = rcube_ldap_password::substitute_vars($search_base);
$search_filter = rcube_ldap_password::substitute_vars($search_filter);