[Tickets #1100] NEW: change exim-ldap to qmail-ldap support

bugs at bugs.horde.org bugs at bugs.horde.org
Thu Jan 6 18:43:53 PST 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=1100
-----------------------------------------------------------------------
 Ticket     | 1100
 Created By | ian at mrzesty.net
 Summary    | change exim-ldap to qmail-ldap support
 Queue      | Forwards
 Version    | HEAD
 State      | New
 Priority   | 1. Low
 Type       | Enhancement
 Owners     | 
-----------------------------------------------------------------------


ian at mrzesty.net (2005-01-06 18:43) wrote:


also implement single LDAP user for updates

diff -ur forwards/config/conf.xml horde-3.0/forwards/config/conf.xml
--- forwards/config/conf.xml    2004-11-15 22:23:01.000000000 -0500
+++ horde-3.0/forwards/config/conf.xml  2004-12-27 13:09:06.899453548 -0500
@@ -100,6 +100,31 @@
     </configsection>
    </case>

+   <case name="ldap" desc="qmail-ldap based LDAP driver">
+    <configdescription>
+     If not using realms (multiple domains or virtual hosting) then there
is
+     only one possible default configuration.
+     Even if you are using realms/hosting, you have to set a default
+     configuration.  This may be overriden by realm/domain specific values
by
+     defining additional arrays, one per realm/domain, with the
realm/domain
+     name as the key instead of the key 'default'. This not possible with
this
+     interface though.
+    </configdescription>
+    <configsection name="params">
+     <configsection name="default">
+      <configstring name="host" desc="Hostname where the LDAP server is
running on">localhost</configstring>
+      <configinteger name="port" desc="Port that the LDAP server is
using">389</configinteger>
+      <configinteger name="version" required="false" desc="LDAP
version">3</configinteger>
+      <configstring name="basedn"
desc="Basedn">ou=mailaccount,dc=example,dc=com</configstring>
+      <configstring name="binddn" required="false" desc="Bind DN
string">cn=Manager,dc=example,dc=com</configstring>
+      <configstring name="bindpass" required="false" desc="Bind password
string"></configstring>
+      <configstring name="realm" required="false"
desc="Realm"></configstring>
+      <configstring name="uid" desc="The attribute that is searched for the
user ID">uid</configstring>
+      <configstring name="forwards" desc="The attribute that defines where
the mail should go">mailForwardingAddress</configstring>
+     </configsection>
+    </configsection>
+   </case>
+
    <case name="customsql" desc="Custom SQL based forwarding driver">
     <configsection name="params">
      <configsql switchname="driverconfig"/>
diff -ur forwards/lib/Driver/ldap.php
horde-3.0/forwards/lib/Driver/ldap.php
--- forwards/lib/Driver/ldap.php        2004-03-30 12:38:20.000000000 -0500
+++ horde-3.0/forwards/lib/Driver/ldap.php      2004-12-27
14:40:18.326271513 -0500
@@ -67,17 +67,13 @@
         }

         // Connect as the user.
-        $res = $this->_connect($userdn, $pass, $realm);
+        $res = $this->_connect($this->_params[$realm]['binddn'],
$this->_params[$realm]['bindpass'], $realm);
         if (is_a($res, 'PEAR_Error')) {
             $this->_error = $res->getMessage();
             $this->_error .= ' - ' .  _("Check your password");
@@ -86,7 +82,7 @@

         // Change the user's forwards.
         $newDetails[$this->_params[$realm]['forwards']] = $message;
-        $res = ldap_mod_replace($this->_ds, $userdn, $newDetails);
+        $res = ldap_mod_replace($this->_ds, $userdn, $newDetails) or
ldap_mod_add($this->_ds, $userdn, $newDetails);
         if (!$res) {
             $res = PEAR::raiseError(ldap_error($this->_ds));
         }
@@ -308,8 +304,8 @@
                             $this->_params[$realm]['version']);
         }

-        if (!is_null($userdn)) {
-            $result = @ldap_bind($this->_ds, $userdn, $password);
+        if (!is_null($this->_params[$realm]['binddn'])) {
+            $result = @ldap_bind($this->_ds,
$this->_params[$realm]['binddn'], $this->_params[$realm]['bindpass']);
         } else {
             $result = @ldap_bind($this->_ds);
         }




More information about the bugs mailing list