[Tickets #1102] NEW: change exim-ldap to qmail-ldap support
bugs at bugs.horde.org
bugs at bugs.horde.org
Thu Jan 6 18:47:29 PST 2005
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=1102
-----------------------------------------------------------------------
Ticket | 1102
Created By | ian at mrzesty.net
Summary | change exim-ldap to qmail-ldap support
Queue | Vacation
Version | HEAD
State | New
Priority | 1. Low
Type | Enhancement
Owners |
-----------------------------------------------------------------------
ian at mrzesty.net (2005-01-06 18:47) wrote:
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 @@
</configsection>
</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>
+ <configstring name="basedn"
desc="Basedn">ou=qmail,dc=example,dc=com</configstring>
+ <configstring name="binddn" required="false" desc="DN to bind as
(empty for anonymous)">cn=Manager,dc=example,dc=com</configstring>
+ <configstring name="bindpass" required="false" desc="Bind DN
password"></configstring>
+ <configstring name="uid" required="true" desc="Username search
attribute">uid</configstring>
+ <configstring name="active" required="true" desc="Vacation Message
Active attribute">deliveryMode</configstring>
+ <configstring name="vacation" desc="The attribute to search for. If
it exists it defines the vacation message">mailReplyText</configstring>
+ <configenum name="hordeauth" desc="Should we log the user
automatically
+ in with the username and password he uses to login to Horde?">
+ <values>
+ <value desc="No">false</value>
+ <value desc="Yes, with the full username">full</value>
+ <value desc="Yes, but with everything after the @ stripped from
the
+ username">true</value>
+ </values>
+ </configenum>
+ </configsection>
+ </configsection>
+ </case>
</configswitch>
</configsection>
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->_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);
}
@@ -188,11 +188,11 @@
// Prepare the message. \n->\n\n and UTF-8 encode.
$message = str_replace("\r\n", "\\n", $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->_params[$realm]['vacation']] = $message;
- $newDetails[$this->_params[$realm]['active']] = 'Y';
+ $newDetails[$this->_params[$realm]['active']] = 'reply';
$res = ldap_mod_replace($this->_ds, $userdn, $newDetails);
$attribs = array($this->_params[$realm]['vacation'],
$this->_params[$realm]['active']);
$value = $this->_getVacation($userdn, $attribs);
@@ -238,7 +238,7 @@
// Prepare the message. \n->\n\n and UTF-8 encode.
$vac['message'] = str_replace("\\\\n", "\r\n", $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->_ds, $entry, $attribs[0]);
- if ($value['count'] == 0) {
- return false;
- }
+ $value = @ldap_get_values($this->_ds, $entry, $attribs[0]);
$retval['message'] = $value[0];
- $value = ldap_get_values($this->_ds, $entry, $attribs[1]);
- if ($value['count'] == 0) {
- return false;
- }
+
+ $value = @ldap_get_values($this->_ds, $entry, $attribs[1]);
$retval['vacation'] = $value[0];
+
return $retval;
}
@@ -302,8 +298,8 @@
}
// Set the vacation message to inactive.
- $newDetails[$this->_params[$realm]['active']] = 'N';
- $res = ldap_mod_replace($this->_ds, $userdn, $newDetails);
+ $newDetails[$this->_params[$realm]['active']] = array();
+ $res = @ldap_mod_del($this->_ds, $userdn, $newDetails);
if (!$res) {
$res = PEAR::raiseError(ldap_error($this->_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 @@
<div>
<br />
-<?php echo _("Subject:") ?>
-<br />
-<input name="subject" type="text" size="70" value="<?php echo
htmlspecialchars($cursubject) ?>">
-</div>
-
-<div>
-<br />
<?php echo _("Message:") ?>
<br />
<textarea name="mess" rows="8" cols="70"><?php echo
htmlspecialchars($curmessage) ?></textarea>
More information about the bugs
mailing list