<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet href="http://bugs.horde.org/themes/feed-rss.xsl" type="text/xsl"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
  <title>change exim-ldap to qmail-ldap support</title>
  <pubDate>Fri, 04 Jul 2008 16:54:39 -0400</pubDate>
  <link>http://bugs.horde.org/ticket/1102</link>
  <atom:link rel="self" type="application/rss+xml" title="change exim-ldap to qmail-ldap support" href="http://bugs.horde.org/ticket/1102/rss" />
  <description>change exim-ldap to qmail-ldap support</description>

  
  
  <item>
   <title>
change exim-ldap setup to make it work with qmail-ldap

</title>
   <description>
change exim-ldap setup to make it work with qmail-ldap

diff -ur vacation/config/conf.xml horde-3.0/vacation/config/conf.xml
--- vacation/config/conf.xml    2004-11-10 14:20:07.000000000 -0500
+++ horde-3.0/vacation/config/conf.xml  2004-12-27 14:07:01.205803580 -0500
@@ -139,6 +139,38 @@
      &lt;/configsection&gt;
     &lt;/configsection&gt;
    &lt;/case&gt;
+   &lt;case name=&quot;ldap&quot; desc=&quot;qmail-ldap based LDAP driver&quot;&gt;
+    &lt;configdescription&gt;
+     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.
+    &lt;/configdescription&gt;
+    &lt;configsection name=&quot;params&quot;&gt;
+     &lt;configsection name=&quot;default&quot;&gt;
+      &lt;configstring name=&quot;host&quot; desc=&quot;Hostname where the LDAP server is running on&quot;&gt;localhost&lt;/configstring&gt;
+      &lt;configinteger name=&quot;port&quot; desc=&quot;Port that the LDAP server is using&quot;&gt;389&lt;/configinteger&gt;
+      &lt;configstring name=&quot;basedn&quot; desc=&quot;Basedn&quot;&gt;ou=qmail,dc=example,dc=com&lt;/configstring&gt;
+      &lt;configstring name=&quot;binddn&quot; required=&quot;false&quot; desc=&quot;DN to bind as (empty for anonymous)&quot;&gt;cn=Manager,dc=example,dc=com&lt;/configstring&gt;
+      &lt;configstring name=&quot;bindpass&quot; required=&quot;false&quot; desc=&quot;Bind DN password&quot;&gt;&lt;/configstring&gt;
+      &lt;configstring name=&quot;uid&quot; required=&quot;true&quot; desc=&quot;Username search attribute&quot;&gt;uid&lt;/configstring&gt;
+      &lt;configstring name=&quot;active&quot; required=&quot;true&quot; desc=&quot;Vacation Message Active attribute&quot;&gt;deliveryMode&lt;/configstring&gt;
+      &lt;configstring name=&quot;vacation&quot; desc=&quot;The attribute to search for. If it exists it defines the vacation message&quot;&gt;mailReplyText&lt;/configstring&gt;
+      &lt;configenum name=&quot;hordeauth&quot; desc=&quot;Should we log the user automatically
+      in with the username and password he uses to login to Horde?&quot;&gt;
+       &lt;values&gt;
+        &lt;value desc=&quot;No&quot;&gt;false&lt;/value&gt;
+        &lt;value desc=&quot;Yes, with the full username&quot;&gt;full&lt;/value&gt;
+        &lt;value desc=&quot;Yes, but with everything after the @ stripped from the
+        username&quot;&gt;true&lt;/value&gt;
+       &lt;/values&gt;
+      &lt;/configenum&gt;
+     &lt;/configsection&gt;
+    &lt;/configsection&gt;
+   &lt;/case&gt;
   &lt;/configswitch&gt;
  &lt;/configsection&gt;

diff -ur vacation/lib/Driver/ldap.php horde-3.0/vacation/lib/Driver/ldap.php
--- vacation/lib/Driver/ldap.php        2004-04-29 09:56:54.000000000 -0400
+++ horde-3.0/vacation/lib/Driver/ldap.php      2004-12-27 14:40:37.354157858 -0500
@@ -70,8 +70,8 @@
                                        $this-&gt;_params[$realm]['version']);
         }

-        if (!is_null($userdn)) {
-            $result = @ldap_bind($this-&gt;_ds, $userdn, $password);
+        if (!is_null($this-&gt;_params[$realm]['binddn'])) {
+            $result = @ldap_bind($this-&gt;_ds, $this-&gt;_params[$realm]['binddn'], $this-&gt;_params[$realm]['bindpass']);
         } else {
             $result = @ldap_bind($this-&gt;_ds);
         }
@@ -188,11 +188,11 @@

         // Prepare the message. \n-&gt;\n\n and UTF-8 encode.
         $message = str_replace(&quot;\r\n&quot;, &quot;\\n&quot;, $message);
-        $message = mb_convert_encoding($message, 'UTF-8', 'ISO-8859-1');
+        // $message = mb_convert_encoding($message, 'UTF-8', 'ISO-8859-1');

         // change the user's vacation.
         $newDetails[$this-&gt;_params[$realm]['vacation']] = $message;
-        $newDetails[$this-&gt;_params[$realm]['active']] = 'Y';
+        $newDetails[$this-&gt;_params[$realm]['active']] = 'reply';
         $res = ldap_mod_replace($this-&gt;_ds, $userdn, $newDetails);
         $attribs = array($this-&gt;_params[$realm]['vacation'], $this-&gt;_params[$realm]['active']);
         $value = $this-&gt;_getVacation($userdn, $attribs);
@@ -238,7 +238,7 @@

         // Prepare the message. \n-&gt;\n\n and UTF-8 encode.
         $vac['message'] = str_replace(&quot;\\\\n&quot;, &quot;\r\n&quot;, $vac['message']);
-        $vac['message'] = mb_convert_encoding($vac['message'], 'ISO-8859-1', 'UTF-8');
+        // $vac['message'] = mb_convert_encoding($vac['message'], 'ISO-8859-1', 'UTF-8');

         return $vac;
     }
@@ -250,16 +250,12 @@
         if (!$entry) {
             return false;
         }
-        $value = ldap_get_values($this-&gt;_ds, $entry, $attribs[0]);
-        if ($value['count'] == 0) {
-            return false;
-        }
+        $value = @ldap_get_values($this-&gt;_ds, $entry, $attribs[0]);
         $retval['message'] = $value[0];
-        $value = ldap_get_values($this-&gt;_ds, $entry, $attribs[1]);
-        if ($value['count'] == 0) {
-            return false;
-        }
+
+        $value = @ldap_get_values($this-&gt;_ds, $entry, $attribs[1]);
         $retval['vacation'] = $value[0];
+
         return $retval;
     }

@@ -302,8 +298,8 @@
         }

         // Set the vacation message to inactive.
-        $newDetails[$this-&gt;_params[$realm]['active']] = 'N';
-        $res = ldap_mod_replace($this-&gt;_ds, $userdn, $newDetails);
+        $newDetails[$this-&gt;_params[$realm]['active']] = array();
+        $res = @ldap_mod_del($this-&gt;_ds, $userdn, $newDetails);
         if (!$res) {
             $res = PEAR::raiseError(ldap_error($this-&gt;_ds));
         }
diff -ur vacation/lib/Driver.php horde-3.0/vacation/lib/Driver.php
--- vacation/lib/Driver.php     2004-09-01 13:32:24.000000000 -0400
+++ horde-3.0/vacation/lib/Driver.php   2004-12-27 13:56:32.627701155 -0500
@@ -94,12 +94,10 @@
         }

         // Check vacation flag.
-        if ($current_details['vacation'] === 'y' ||
-            $current_details['vacation'] === 'Y') {
-            return 'Y';
-        } elseif ($current_details['vacation'] === 'n' ||
-                  $current_details['vacation'] === 'N') {
+       if(empty($current_details['vacation']))
             return 'N';
+        if ($current_details['vacation'] === 'reply') {
+            return 'Y';
         } else {
             return false;
         }
diff -ur vacation/templates/main/main.inc horde-3.0/vacation/templates/main/main.inc
--- vacation/templates/main/main.inc    2004-11-22 15:33:51.000000000 -0500
+++ horde-3.0/vacation/templates/main/main.inc  2004-12-27 14:11:55.366324264 -0500
@@ -57,13 +57,6 @@

 &lt;div&gt;
 &lt;br /&gt;
-&lt;?php echo _(&quot;Subject:&quot;) ?&gt;
-&lt;br /&gt;
-&lt;input name=&quot;subject&quot; type=&quot;text&quot; size=&quot;70&quot; value=&quot;&lt;?php echo htmlspecialchars($cursubject) ?&gt;&quot;&gt;
-&lt;/div&gt;
-
-&lt;div&gt;
-&lt;br /&gt;
 &lt;?php echo _(&quot;Message:&quot;) ?&gt;
 &lt;br /&gt;
 &lt;textarea name=&quot;mess&quot; rows=&quot;8&quot; cols=&quot;70&quot;&gt;&lt;?php echo htmlspecialchars($curmessage) ?&gt;&lt;/textarea&gt;</description>
   <pubDate>Thu, 06 Jan 2005 21:47:28 -0500</pubDate>
   <link>http://bugs.horde.org/ticket/1102#t4272</link>
  </item>
  <item>
   <title>The patch is no longer valid for the current CVS HEAD code, </title>
   <description>The patch is no longer valid for the current CVS HEAD code, and contains far too much unnecessary core code changes.</description>
   <pubDate>Tue, 25 Oct 2005 06:12:46 -0400</pubDate>
   <link>http://bugs.horde.org/ticket/1102#t12919</link>
  </item>
  <item>
   <title>No feedback.</title>
   <description>No feedback.</description>
   <pubDate>Mon, 28 Nov 2005 10:23:43 -0500</pubDate>
   <link>http://bugs.horde.org/ticket/1102#t14220</link>
  </item>
  

 </channel>
</rss>
