[imp] ldap search and UTF8
Robert Marchand
robert.marchand@UMontreal.CA
Tue, 05 Jun 2001 10:13:44 -0400 (EDT)
---------------------- multipart/mixed attachment
Hi,
Jarno Huuskonen send me a patch not long after my message. We
enhance it each on our own. I didn't post it because it is very local.
Our 'cn' attribute would include a comma, so I had to do something apart
from the UTF8 issue.
Patch follows.
As I said, you don't need all the modifications.
Here is a sample of server entry (as in config/ldap.php3):
$LDAPServers['Bottin_UdeM'] = new LDAPServer('Bottin_UdeM',
'Bottin UdeM - complet',
'dns_name',
'base_dn',
'sn',
'cn,mail,sn,givenname',
'is,is_strict,contains,begins,ends',
'',
'',
'mail',
'utf8',
100);
The two last items are the encoding (utf8 or none) and a limit for the
search (it doesn't work on our system but I left it there).
Good bye.
En réponse à goudal@enseirb.fr:
> > Hi all,
> >
> > we're going to have our LDAP server online soon and all data will
> be
> > coded with UTF8
> > instead of ascii. Does someone have a patch for IMP 2.2.4? I have
> made
> > some tests
> > and some research in the list and it is not supported yet it seems.
> >
> > If not a patch, what modifications do I need to make it work? I know
> I
> > should put some
> > utf8_decode function somewhere...
> >
> Hello, I saw this message on the imp mailing list. It does not seems
> that you
> got an answer, but did you find a solution ? I have the same problem
> with
> LDAP answers...
>
> f.g.
>
>
>
> --
> IMP mailing list: http://horde.org/imp/
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe@lists.horde.org
>
---------------------- multipart/mixed attachment
diff -cr imp-2.2.4/ldap.search.php3 /usr/local/apache/htdocs/horde/imp/ldap.search.php3
*** imp-2.2.4/ldap.search.php3 Mon Jun 4 14:59:20 2001
--- /usr/local/apache/htdocs/horde/imp/ldap.search.php3 Tue May 22 11:36:09 2001
***************
*** 242,248 ****
--- 242,255 ----
echo $lang->no_ldap_connection;
exit;
}
+ /* Jarno: Try to encode search string */
+ if ($lserver->encoding == 'utf8') $s_text = utf8_encode($s_text);
+ # Ceci requiert Openldap v2.xx
+ #if ($lserver->limit) {
+ # ldap_set_option($ds, LDAP_OPT_SIZELIMIT, $lserver->limit);
+ #}
+
if ($r) {
$normerr = error_reporting();
error_reporting(0);
***************
*** 293,298 ****
--- 300,307 ----
// $addr_list[2][] = $val['cn'][0]. ' <' .$val[$str_emailattr][0]. '>';
$addr_list[2][] = $val[$str_emailattr][0];
$addr_list[3][] = $val['cn'][0];
+ /* modif: RM */
+ $addr_list[4][] = $val['givenname'][0]. ' '. $val['sn'][0];
}
}
asort($addr_list[0]);
***************
*** 321,327 ****
while ( list( $key_addr, $val_addr ) = each ( $addr_list[0] ) ) {
if ( $addr_list[0][$key_addr] ) {
$email = explode('@', $addr_list[2][$key_addr]);
! $addr = htmlentities(imap_rfc822_write_address($email[0], $email[1], $addr_list[3][$key_addr]));
echo "\n<option value=\"" . $addr . '">' . $addr . '</option>';
}
}
--- 330,343 ----
while ( list( $key_addr, $val_addr ) = each ( $addr_list[0] ) ) {
if ( $addr_list[0][$key_addr] ) {
$email = explode('@', $addr_list[2][$key_addr]);
! /*$addr = htmlentities(imap_rfc822_write_address($email[0], $email[1], utf8_decode($addr_list[3][$key_addr])));*/
! /* Jarno: decode return value */
! /* modif RM*/
! if ($lserver->encoding == 'utf8') {
! $addr = htmlentities(imap_rfc822_write_address($email[0], $email[1], utf8_decode($addr_list[4][$key_addr])));
! } else {
! $addr = htmlentities(imap_rfc822_write_address($email[0], $email[1], $addr_list[3][$key_addr]));
! }
echo "\n<option value=\"" . $addr . '">' . $addr . '</option>';
}
}
diff -cr imp-2.2.4/lib/imp.lib /usr/local/apache/htdocs/horde/imp/lib/imp.lib
*** imp-2.2.4/lib/imp.lib Mon Jun 4 14:59:20 2001
--- /usr/local/apache/htdocs/horde/imp/lib/imp.lib Tue May 22 10:55:01 2001
***************
*** 265,273 ****
var $org;
var $emailattr;
var $ldap_prefix;
!
! function LDAPServer ($tag, $name, $server, $root, $sn, $attribs, $options, $org='', $prefix='', $emailattr='mail') {
$this->tag = $tag;
$this->name = $name;
$this->server = $server;
--- 265,275 ----
var $org;
var $emailattr;
var $ldap_prefix;
+ var $ldap_encoding;
+ var $ldap_limit;
! function LDAPServer ($tag, $name, $server, $root, $sn, $attribs, $options, $org='', $prefix='', $emailattr='mail',
! $encoding = '', $limit = '') {
$this->tag = $tag;
$this->name = $name;
$this->server = $server;
***************
*** 276,282 ****
$this->attribs = $attribs;
$this->options = $options;
$this->emailattr = $emailattr;
!
if ($org && $prefix) $this->root = "o=$org, c=$prefix";
// add name/label to parameters?
} // Constructor
--- 278,286 ----
$this->attribs = $attribs;
$this->options = $options;
$this->emailattr = $emailattr;
! $this->encoding = $encoding;
! $this->limit = $limit;
!
if ($org && $prefix) $this->root = "o=$org, c=$prefix";
// add name/label to parameters?
} // Constructor
---------------------- multipart/mixed attachment--
>From chuck@horde.org Date: Tue, 5 Jun 2001 10:13:31 -0400
Return-Path: <chuck@horde.org>
Mailing-List: contact imp-help@lists.horde.org; run by ezmlm
Delivered-To: mailing list imp@lists.horde.org
Received: (qmail 65254 invoked from network); 5 Jun 2001 14:15:13 -0000
Received: from 208-59-250-206.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com (HELO marina.horde.org) (208.59.250.206)
by horde.org with SMTP; 5 Jun 2001 14:15:13 -0000
Received: by marina.horde.org (Postfix, from userid 33)
id 1FD3039EE; Tue, 5 Jun 2001 10:13:31 -0400 (EDT)
Received: from 206.243.191.252 ( [206.243.191.252])
as user chuck@localhost by marina.horde.org with HTTP;
Tue, 5 Jun 2001 10:13:31 -0400
Message-ID: <991750411.3b1ce90b06b59@marina.horde.org>
Date: Tue, 5 Jun 2001 10:13:31 -0400
From: Chuck Hagenbuch <chuck@horde.org>
To: imp@lists.horde.org
References: <Pine.LNX.4.21.0106050904560.27550-100000@web.newworldinternet.com>
In-Reply-To: <Pine.LNX.4.21.0106050904560.27550-100000@web.newworldinternet.com>
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 2.3.7-cvs
Subject: Re: [imp] Error opening mail
Quoting rangerfox@rangerfox.com:
> I have switched over to IMP 2.3.6 and hore 1.3.3 and I'm running the
> latest cvs of PHP (4.0.7). When I login to my mailbox I get
> Warning: Unknown list entry type in request shutdown (0) in
> /usr/httpd/html/horde/lib/Horde.php on line 240
A couple of people have seen this; I'm pretty sure it's a PHP problem, but it
doesn't happen to me, so I can't shed much light. Anyone else have this, and
have you made it gone away?
-chuck
--
Charles Hagenbuch, <chuck@horde.org>
Black and white and grey, all the shades of truth.