--- horde-3.3.6/config/conf.xml.deref	2010-02-02 12:24:57.000000000 +0100
+++ horde-3.3.6/config/conf.xml	2010-02-02 12:54:01.000000000 +0100
@@ -326,6 +326,8 @@
       listing users on large directories"/>
       <configboolean name="ad" desc="Is this an AD server?">
       false</configboolean>
+      <configboolean name="deref" desc="LDAP deref?">
+      false</configboolean>
       <configstring name="uid" desc="The username search key (set to
       samaccountname for AD)"/>
       <configenum name="encryption" desc="The password hashing algorithm to
--- horde-3.3.6/lib/Horde/Group/ldap.php.deref	2010-02-02 15:32:14.000000000 +0100
+++ horde-3.3.6/lib/Horde/Group/ldap.php	2010-02-02 15:34:33.000000000 +0100
@@ -94,6 +94,15 @@
                     __FILE__, __LINE__, PEAR_LOG_ERR);
             }
         }
+        if (!empty($GLOBALS['conf']['auth']['params']['deref'])) {
+            if (!ldap_set_option($this->_ds, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS)) {
+                Horde::logMessage(
+                    sprintf('Unable to enable directory deref on this connection: [%d] %s',
+                            @ldap_errno($this->_ds),
+                            @ldap_error($this->_ds)),
+                    __FILE__, __LINE__, PEAR_LOG_ERR);
+            }
+        }
 
         if (isset($this->_params['binddn'])) {
             $bind = @ldap_bind($this->_ds, $this->_params['binddn'],
--- horde-3.3.6/lib/Horde/Auth/ldap.php.deref	2010-02-02 12:22:56.000000000 +0100
+++ horde-3.3.6/lib/Horde/Auth/ldap.php	2010-02-02 12:49:08.000000000 +0100
@@ -118,8 +118,16 @@
                             @ldap_error($this->_ds)),
                     __FILE__, __LINE__, PEAR_LOG_ERR);
             }
+        } 
+        if (!empty($this->_params['deref'])) {
+            if (!ldap_set_option($this->_ds, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS)) {
+                Horde::logMessage(
+                    sprintf('Unable to enable directory deref on this connection: [%d] %s',
+                            @ldap_errno($this->_ds),
+                            @ldap_error($this->_ds)),
+                    __FILE__, __LINE__, PEAR_LOG_ERR);
+            } 
         }
-
         if (isset($this->_params['binddn'])) {
             $bind = @ldap_bind($this->_ds, $this->_params['binddn'],
                                $this->_params['password']);