From e426ae262c22f75ebd403d9f9d32238f7d9a85af Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 04 Oct 2013 05:51:59 -0400
Subject: [PATCH] Search for user DN only if one of bind_dn, base_dn, groups_base_dn settings contains %dn variable
---
program/lib/Roundcube/rcube_ldap.php | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php
index 7857378..64288f9 100644
--- a/program/lib/Roundcube/rcube_ldap.php
+++ b/program/lib/Roundcube/rcube_ldap.php
@@ -289,7 +289,9 @@
$replaces = array('%dn' => '', '%dc' => $dc, '%d' => $d, '%fu' => $fu, '%u' => $u);
// Search for the dn to use to authenticate
- if ($this->prop['search_base_dn'] && $this->prop['search_filter']) {
+ if ($this->prop['search_base_dn'] && $this->prop['search_filter']
+ && (strstr($bind_dn, '%dn') || strstr($this->base_dn, '%dn') || strstr($this->groups_base_dn, '%dn'))
+ ) {
$search_bind_dn = strtr($this->prop['search_bind_dn'], $replaces);
$search_base_dn = strtr($this->prop['search_base_dn'], $replaces);
$search_filter = strtr($this->prop['search_filter'], $replaces);
--
Gitblit v1.9.1