[Tickets #2529] NEW: Problems with "cn", "name" and ldap (patch)

bugs@bugs.horde.org bugs at bugs.horde.org
Tue Aug 30 00:36:21 PDT 2005


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=2529
-----------------------------------------------------------------------
 Ticket             | 2529
 Created By         | horde at olen.net
 Summary            | Problems with "cn", "name" and ldap (patch)
 Queue              | Turba
 Version            | FRAMEWORK_3
 State              | Unconfirmed
 Priority           | 1. Low
 Type               | Bug
 Owners             | 
-----------------------------------------------------------------------


horde at olen.net (2005-08-30 00:36) wrote:

Because I prefer to separate firstname and lastname in my address book, I
have the following in my "sources.php":

        'name' => array('fields' => array('firstname', 'lastname'),
                        'format' => '%s %s'),
        'firstname' => 'givenname',
        'lastname' => 'sn',

This leads to a problem where cn is not set when I add a new contact, and
this again leads to an object violation.
So I added this patch, to create the cn from givenname and sn if it does not
exist:
There should probably be some sort of checking if sn and givenname is set,
but as they are marked as required per default, I believe this is taken care
of elsewhere.

--- turba/lib/Driver/ldap.php.orig      2005-08-30 08:55:35.000000000 +0200
+++ turba/lib/Driver/ldap.php   2005-08-30 08:59:52.000000000 +0200
@@ -219,6 +219,11 @@
         $dn = $attributes['dn'];
         unset($attributes['dn']);

+        /* If the CN does not exist, create it from SN and GIVENNAME */
+        if (!$attributes['cn']) {
+            $attributes['cn'] = $attributes['givenname'] . " " .
$attributes['sn'];
+        }
+
         /* Put the objectClass into the attributes array. */
         if (!is_array($this->_params['objectclass'])) {
             $attributes['objectclass'] = $this->_params['objectclass'];





More information about the bugs mailing list