added escapeDN()

This commit is contained in:
Roland Gruber 2008-09-04 17:21:29 +00:00
parent f20f468dbb
commit b7c17b5801
1 changed files with 14 additions and 0 deletions

View File

@ -511,5 +511,19 @@ function get_preg($argument, $regexp) {
return false; return false;
} }
/**
* Escapes any special characters in an LDAP DN.
*
* @param String $dn DN
* @return String escaped DN
*/
function escapeDN($dn) {
return str_replace(
array(')', '(', ' ', '*'),
array('\\29', '\\28', '\\20', '\\2a'),
$dn
);
}
?> ?>