- Author: Chuck Hagenbuch chuck
- Branch: HEAD
- Tags: BEFORE_MERGE_3_1, BEFORE_MERGE_3_2, HORDE_3_2_RC1, HORDE_3_2_ALPHA
Add a quoteDN() method that attempts to ensure RFC 1485-compliant
quoting of LDAP DNs. This won't be relied on by Turba because it was
introduced too late, but it's here for new code to use and as the
reference implementation.
--TEST--
Horde_LDAP::quoteDN() tests
--FILE--
<?php
require_once dirname(__FILE__) . '/../LDAP.php';
echo Horde_LDAP::quoteDN(array(array('cn', 'John Smith'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', 'Smith, John'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', ' John Smith'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', 'John Smith '),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', 'John Smith'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', 'John+Smith'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
echo Horde_LDAP::quoteDN(array(array('cn', 'John "Bugsy" Smith'),
array('dc', 'example'),
array('dc', 'com'))) . "\n";
?>
--EXPECT--
cn=John Smith,dc=example,dc=com
cn="Smith, John",dc=example,dc=com
cn=" John Smith",dc=example,dc=com
cn="John Smith ",dc=example,dc=com
cn="John Smith",dc=example,dc=com
cn="John+Smith",dc=example,dc=com
cn="John \"Bugsy\" Smith",dc=example,dc=com