summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fcd51da)
raw | patch | inline | side by side (parent: fcd51da)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 Nov 2008 16:10:43 +0000 (16:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 4 Nov 2008 16:10:43 +0000 (16:10 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12905 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_ldap.inc | patch | blob | history | |
gosa-core/include/class_plugin.inc | patch | blob | history |
index a0c46a7cc6de9d16ee098c506bd0b41569e23df7..1c8b758f287860581b6285bbf18ba288b20f3b0d 100644 (file)
/* Function to replace all problematic characters inside a DN by \001XX, where
\001 is decoded to chr(1) [ctrl+a]. It is not impossible, but very unlikely
that this character is inside a DN.
-
+
Currently used codes:
- , => CO
- \2C => CO
- ( => OB
- ) => CB
- / => SL */
+ , => CO
+ \2C => CO
+ ( => OB
+ ) => CB
+ / => SL */
static function convert($dn)
{
- if (SPECIALS_OVERRIDE === TRUE){
- return preg_replace('/,\s+/', ',', str_replace(array('\\\\,', '\\\\2C', '\(/', '/\)', '\/'),
- array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"), $dn));
+ if (SPECIALS_OVERRIDE == TRUE){
+ $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
+ array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
+ $dn);
+ return (preg_replace('/,\s+/', ',', $tmp));
} else {
return ($dn);
}
servers seem to take it the correct way. */
static function fix($dn)
{
- if (SPECIALS_OVERRIDE === TRUE){
- return (str_replace(array('\001CO', '\001OB', '\001CB', '\001SL'),
- array('\,', '(', ')', '/'), $dn));
+ if (SPECIALS_OVERRIDE == TRUE){
+ return (preg_replace(array("/\001CO/", "/\001OB/", "/\001CB/", "/\001SL/"),
+ array("\,", "(", ")", "/"),
+ $dn));
} else {
return ($dn);
}
}
-
/* Function to fix problematic characters in DN's that are used for search
requests. I.e. member=.... */
static function prepare4filter($dn)
{
- return normalizeLdap(str_replace('\\\\', '\\\\\\', LDAP::fix($dn)));
+ return normalizeLdap(str_replace('\\\\', '\\\\\\', LDAP::fix($dn)));
}
parent => ou=department,dc=...
dest_rdn => cn=herbert
*/
- $parent = @LDAP::fix(preg_replace("/^[^,]+,/","", @LDAP::convert($dest)));
- $dest_rdn = @LDAP::fix(preg_replace("/,.*$/","",@LDAP::convert($dest)));
+ $parent = preg_replace("/^[^,]+,/","", $dest);
+ $dest_rdn = preg_replace("/,.*$/","",$dest);
if($this->hascon){
if ($this->reconnect) $this->connect();
- $r= ldap_rename($this->cid,$source,$dest_rdn,$parent,TRUE);
+ $r= ldap_rename($this->cid,@LDAP::fix($source), @LDAP::fix($dest_rdn),@LDAP::fix($parent),TRUE);
$this->error = ldap_error($this->cid);
/* Check if destination dn exists, if not the
index 95abb82d8865340d6565f5fd9f85ea6fbb67e250..dee53fbb0e430cf55c139e40fba865d2404c849c 100644 (file)
/* Try to move the source entry to the destination position */
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",@LDAP::convert($dst_dn)));
+ $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dst_dn));
if (!$ldap->rename_dn($src_dn,$dst_dn)){
msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $src_dn, "", get_class()));