[#1100] change exim-ldap to qmail-ldap support
Summary change exim-ldap to qmail-ldap support
Queue Forwards
Queue Version HEAD
Type Enhancement
State Rejected
Priority 1. Low
Owners
Requester ian (at) mrzesty (dot) net
Created 01/06/2005 (1221 days ago)
Due
Updated 11/28/2005 (895 days ago)
Assigned
Resolved 11/28/2005 (895 days ago)
Attachments
Milestone
Patch

History
11/28/2005 Jan Schneider Comment #3
State ⇒ Rejected
Reply to this comment
No feedback.
10/22/2005 Jan Schneider Comment #2
State ⇒ Feedback
Reply to this comment
This won't work. You can't have two configsections with the same name.
01/06/2005 ian (at) mrzesty (dot) net Comment #1
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ change exim-ldap to qmail-ldap support
Queue ⇒ Forwards
Reply to this comment

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);
         }