From b682f335f2c248d9979bd0a099acd7f504affe56 Mon Sep 17 00:00:00 2001 From: tokul Date: Mon, 1 Aug 2005 08:07:13 +0000 Subject: [PATCH] strip basedn from nickname. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9861 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/abook_ldap_server.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/functions/abook_ldap_server.php b/functions/abook_ldap_server.php index 72b94101..596360a6 100644 --- a/functions/abook_ldap_server.php +++ b/functions/abook_ldap_server.php @@ -389,9 +389,16 @@ class abook_ldap_server extends addressbook_backend { $row = $res[$i]; /* Extract data common for all e-mail addresses - * of an object. Use only the first name */ + * of an object. Use only the first name */ $nickname = $this->charset_decode($row['dn']); - // TODO: remove basedn from $nickname + + /** + * calculate length of basedn and remove it from nickname + * ignore whitespaces between RDNs + * Nicknames are shorter and still unique + */ + $basedn_len=strlen(preg_replace('/,\s*/',',',trim($this->basedn))); + $nickname=substr(preg_replace('/,\s*/',',',$nickname),0,(-1 - $basedn_len)); $fullname = $this->charset_decode($row['cn'][0]); -- 2.25.1