[Tickets #6518] Possible format failure in dn (export in ldif)

bugs at horde.org bugs at horde.org
Sat Mar 22 14:33:34 UTC 2008


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

Ticket URL: http://bugs.horde.org/ticket/6518
-----------------------------------------------------------------------
 Ticket             | 6518
 Created By         | herbert at linuxhacker.at
 Summary            | Possible format failure in dn (export in ldif)
 Queue              | Turba
 Version            | 2.2-RC3
 Type               | Bug
 State              | Unconfirmed
 Priority           | 1. Low
 Milestone          | 
 Patch              | 
 Owners             | 
-----------------------------------------------------------------------


herbert at linuxhacker.at (2008-03-22 10:33) wrote:

If the name containing an Umlaut, then the exported ldif data looks like:

    dn: cn=SGVyYmVydCBNw7xzdGVybWFubg==,mail=herbert at linuxhacker.at

I think, it should be:

  dn:: Y249SGVyYmVydCBNw7xzdGVybWFubmhlcmJlcnRAbGludXhoYWNrZXIuYXQ=

This patch works for me:

--- lib/Data/ldif.php.orig1     2008-03-22 13:24:49.000000000 +0100
+++ lib/Data/ldif.php   2008-03-22 13:55:50.000000000 +0100
@@ -192,26 +192,20 @@
                     // Store cn and mail separately for use in record dn
                     if
(!$this->_is_safe_string($row[$mozillaTurbaMap[$value]])) {
                         $recordData .= $value . ':: ' .
base64_encode($row[$mozillaTurbaMap[$value]]) ."\n";
-                        if ($value == 'cn') {
-                            $recordCn =
base64_encode($row[$mozillaTurbaMap[$value]]);
-                        }
-                        if ($value == 'mail') {
-                            $recordMail =
base64_encode($row[$mozillaTurbaMap[$value]]);
-                        }
                     } else {
                         $recordData .= $value . ': ' .
$row[$mozillaTurbaMap[$value]] ."\n";
-                        if ($value == 'cn') {
-                            $recordCn = $row[$mozillaTurbaMap[$value]];
-                        }
-                        if ($value == 'mail') {
-                            $recordMail =
$row[$mozillaTurbaMap[$value]];
-                        }
                     }
                 }
             }

-            $export .= 'dn: cn=' . $recordCn . ',mail=' . $recordMail .
"\n"
-                . "objectclass: top\n"
+            $dn = 'cn=' .  $row[$mozillaTurbaMap['cn']] . 
$row[$mozillaTurbaMap['mail']];
+           if (!($this->_is_safe_string($row[$mozillaTurbaMap['cn']]) &&
+               $this->_is_safe_string($row[$mozillaTurbaMap['cn']]))) {
+               $export .= 'dn:: ' . base64_encode($dn) . "\n";
+           } else {
+               $export .= 'dn: ' . $dn  . "\n";
+            }
+           $export .= "objectclass: top\n"
                 . "objectclass: person\n"
                 . "objectclass: organizationalPerson\n"
                 . "objectclass: inetOrgPerson\n"






More information about the bugs mailing list