[Tickets #764] NEW: Ldap driver does not encode the DN to charset

bugs at bugs.horde.org bugs at bugs.horde.org
Thu Nov 4 06:22:29 PST 2004


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

Ticket URL: http://bugs.horde.org/ticket/?id=764
-----------------------------------------------------------------------
 Ticket     | 764
 Created By | brendan.bank at imap4all.com
 Summary    | Ldap driver does not encode the DN to charset
 Queue      | Turba
 Version    | HEAD
 State      | Unconfirmed
 Priority   | 2. Medium
 Type       | Bug
 Owners     | 
-----------------------------------------------------------------------


brendan.bank at imap4all.com (2004-11-04 06:22) wrote:

Hi,

When you add ldap entries to an ldap database the DN is not converted to the
correct character set. (if charset is configured).

If a DN contains the common name (cn) cn=Cañigueral Bagóa,ou=addressbook...
This should be converted to cn=Albert Cañigueral Bagó,ou=addressbook...

The current code does not do this and I've patched the LDAP driver to do
this:

===================================================================
RCS file: ./turba/lib/Driver/ldap.php,v
retrieving revision 1.1
diff -C 4 -r1.1 ./turba/lib/Driver/ldap.php
*** ./turba/lib/Driver/ldap.php 2004/11/04 13:56:38     1.1
--- ./turba/lib/Driver/ldap.php 2004/11/04 14:19:29
***************
*** 5,13 ****
   * $Horde: turba/lib/Driver/ldap.php,v 1.53 2004/09/18 22:57:32 mdjukic
Exp $
   *
   * @author  Chuck Hagenbuch <chuck at horde.org>
   * @author  Jon Parise <jon at csh.rit.edu>
!  * @version $Revision: 1.1 $
   * @since   Turba 0.0.1
   * @package Turba
   */
  class Turba_Driver_ldap extends Turba_Driver {
--- 5,13 ----
   * $Horde: turba/lib/Driver/ldap.php,v 1.53 2004/09/18 22:57:32 mdjukic
Exp $
   *
   * @author  Chuck Hagenbuch <chuck at horde.org>
   * @author  Jon Parise <jon at csh.rit.edu>
!  * @version $Revision: 1.2 $
   * @since   Turba 0.0.1
   * @package Turba
   */
  class Turba_Driver_ldap extends Turba_Driver {
***************
*** 293,300 ****
--- 293,301 ----
                          $newrdn .= $param . '=' . $attributes[$param] .
',';
                      }
                  }
                  $newrdn = substr($newrdn, 0, -1);
+                 $newrdn = String::convertCharset($newrdn,
NLS::getCharset(), $this->_params['charset']);
              } else {
                  return PEAR::raiseError(_("Missing DN in LDAP source
configuration."));
              }
  
***************
*** 366,373 ****
--- 367,375 ----
              }
          }
  
          $dn .= $this->_params['root'];
+         $dn = String::convertCharset($dn, NLS::getCharset(),
$this->_params['charset']);
          return $dn;
      }
  
      /**





More information about the bugs mailing list