Merge pull request #66 from MichaelIT/master
Incompatable with openLDAP >=2.1.2
This commit is contained in:
commit
f3aad72b57
@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
@ -2522,8 +2546,8 @@ function pla_explode_dn($dn,$with_attributes=0) {
|
||||
$dn = addcslashes($dn,'<>+";');
|
||||
|
||||
# split the dn
|
||||
$result[0] = ldap_explode_dn(dn_escape($dn),0);
|
||||
$result[1] = ldap_explode_dn(dn_escape($dn),1);
|
||||
$result[0] = ldap_explode_dn_patch(dn_escape($dn),0);
|
||||
$result[1] = ldap_explode_dn_patch(dn_escape($dn),1);
|
||||
if (! $result[$with_attributes]) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning NULL - NO result.',1,0,__FILE__,__LINE__,__METHOD__);
|
||||
|
Loading…
Reference in New Issue
Block a user