fixed formatting of DN with escaped commas
This commit is contained in:
parent
d991ec578c
commit
b0d786c86e
|
@ -1053,6 +1053,7 @@ function getAbstractDN($dn) {
|
|||
if ($dn == '') {
|
||||
return '';
|
||||
}
|
||||
$dn = str_replace('\\,', '\\2C', $dn);
|
||||
$parts = explode(',', $dn);
|
||||
for ($i = 0; $i < sizeof($parts); $i++) {
|
||||
$subparts = explode('=', $parts[$i]);
|
||||
|
@ -1060,7 +1061,8 @@ function getAbstractDN($dn) {
|
|||
$parts[$i] = $subparts[1];
|
||||
}
|
||||
}
|
||||
return implode(' > ', $parts);
|
||||
$abstractDn = implode(' > ', $parts);
|
||||
return str_replace(array('\\2C', '\\,'), array(',', ','), $abstractDn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -135,4 +135,13 @@ class AccountTest extends PHPUnit_Framework_TestCase {
|
|||
$this->assertEquals('cn=test\\2C user,ou=People,o=test,c=de', convertCommaEscaping('cn=test\\, user,ou=People,o=test,c=de'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests getAbstractDN().
|
||||
*/
|
||||
function testGetAbstractDN() {
|
||||
$this->assertEquals('test > test > de', getAbstractDN('cn=test,o=test,c=de'));
|
||||
$this->assertEquals('test,user > test > de', getAbstractDN('cn=test\\,user,o=test,c=de'));
|
||||
$this->assertEquals('test,user > test > de', getAbstractDN('cn=test\\2Cuser,o=test,c=de'));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue