From 2d08ec91ca8fb429da389b3107f3982565e8ca3b Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 30 Nov 2011 08:10:45 -0500
Subject: [PATCH] - Add possibility to do LDAP bind before searching for bind DN. In deployments where anonymous binds to and/or searches on an LDAP tree are not allowed, and where the LDAP address book(s) have been configured to use the user-specific bind credentials, rcube_ldap.php needs to bind using service credentials in order to be able to find the user's bind dn.
---
program/include/rcube_ldap.php | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php
index 58e2ca9..4d65bfa 100644
--- a/program/include/rcube_ldap.php
+++ b/program/include/rcube_ldap.php
@@ -236,6 +236,10 @@
$replaces = array('%dn' => '', '%dc' => $dc, '%d' => $d, '%fu' => $fu, '%u' => $u);
if ($this->prop['search_base_dn'] && $this->prop['search_filter']) {
+ if (!empty$this->prop['search_bind_dn']) && !empty($this->prop['search_bind_pw'])) {
+ $this->bind($this->prop['search_bind_dn'], $this->prop['search_bind_pw']);
+ }
+
// Search for the dn to use to authenticate
$this->prop['search_base_dn'] = strtr($this->prop['search_base_dn'], $replaces);
$this->prop['search_filter'] = strtr($this->prop['search_filter'], $replaces);
--
Gitblit v1.9.1