Update functions.php
Since openLDAP >=2.1.2,ldap_explode_dn turns unprintable chars (in the ASCII sense, UTF8 encoded) into \<hexcode>.
This commit is contained in:
parent
733a10a1c5
commit
7569423f11
@ -2487,6 +2487,30 @@ function draw_chooser_link($form,$element,$include_choose_text=true,$rdn='none')
|
|||||||
printf('<span class="x-small"><a href="%s" title="%s">%s</a></span>',$href,$title,_('browse'));
|
printf('<span class="x-small"><a href="%s" title="%s">%s</a></span>',$href,$title,_('browse'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* http://php.net/manual/en/function.ldap-explode-dn.php#34724
|
||||||
|
* fixed for:
|
||||||
|
* Keep attention on UTF8 encoded DNs. Since openLDAP >=2.1.2
|
||||||
|
* ldap_explode_dn turns unprintable chars (in the ASCII sense, UTF8
|
||||||
|
* encoded) into \<hexcode>.
|
||||||
|
*/
|
||||||
|
function ldap_explode_dn_patch( $dn, $with_attrib ) {
|
||||||
|
$result = ldap_explode_dn( $dn, $with_attrib );
|
||||||
|
if (! $result ) return null;
|
||||||
|
# translate hex code into ascii again
|
||||||
|
foreach ( $result as $key => $value ) {
|
||||||
|
$result[ $key ] = preg_replace_callback(
|
||||||
|
"/\\\([0-9A-Fa-f]{2})/",
|
||||||
|
function ( $matches) {
|
||||||
|
return chr( hexdec( $matches[1] ) );
|
||||||
|
},
|
||||||
|
$value
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ( $result );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explode a DN into an array of its RDN parts.
|
* Explode a DN into an array of its RDN parts.
|
||||||
*
|
*
|
||||||
@ -2522,8 +2546,8 @@ function pla_explode_dn($dn,$with_attributes=0) {
|
|||||||
$dn = addcslashes($dn,'<>+";');
|
$dn = addcslashes($dn,'<>+";');
|
||||||
|
|
||||||
# split the dn
|
# split the dn
|
||||||
$result[0] = ldap_explode_dn(dn_escape($dn),0);
|
$result[0] = ldap_explode_dn_patch(dn_escape($dn),0);
|
||||||
$result[1] = ldap_explode_dn(dn_escape($dn),1);
|
$result[1] = ldap_explode_dn_patch(dn_escape($dn),1);
|
||||||
if (! $result[$with_attributes]) {
|
if (! $result[$with_attributes]) {
|
||||||
if (DEBUG_ENABLED)
|
if (DEBUG_ENABLED)
|
||||||
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
|
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
|
||||||
|
Loading…
Reference in New Issue
Block a user