diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 2ed4ceea0fb67439592bbb13dc17437d39aae4a1..b2085531dc7c755a38ee2de010ec39dad715f9da 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
function convert($dn)
{
if (SPECIALS_OVERRIDE == TRUE){
- return (preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
+ $tmp= preg_replace(array("/\\\\,/", "/\\\\2C/", "/\(/", "/\)/", "/\//"),
array("\001CO", "\001CO", "\001OB", "\001CB", "\001SL"),
- $dn));
+ $dn);
+ return (preg_replace('/,\s+/', ',', $tmp));
} else {
return ($dn);
}
/* Copy given attributes and sub-dns with attributes to destination dn
*/
- function copy_FAI_resource_recursive($sourcedn,$destinationdn,$type="branch",$is_first = true,$depth=0)
+ function copy_FAI_resource_recursive($sourcedn,$destinationdn,$destinationName,$type="branch",$is_first = true,$depth=0)
{
error_reporting(E_ALL);
}
}
+ /* Replace FAIdebianRelease with new release name */
+ if(in_array("FAIpackageList" , $attr['objectClass'])){
+ $attr['FAIdebianRelease'] = $destinationName;
+ }
+
/* Add entry */
$this->cd($destinationdn);
$this->cat($destinationdn);
$this->cd($basedn);
$item = $this->fetch($this->cat($dn));
if(!in_array("FAIbranch",$item['objectClass'])){
- $this->copy_FAI_resource_recursive($dn,str_replace($sourcedn,$destinationdn,$dn),$type,false,$depth);
+ $this->copy_FAI_resource_recursive($dn,str_replace($sourcedn,$destinationdn,$dn),$destinationName,$type,false,$depth);
}
}
}
@@ -930,12 +936,12 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
$attr = $encoded[0];
$value = base64_decode($encoded[1]);
/* Add linenumber */
- $data .= $current_line."#".$attr.":".$value."\n";
+ $data .= $current_line."#".base64_encode($attr.":".$value)."\n";
}
else
{
/* Add Linenumber */
- $data .= $current_line."#".$entry."\n";
+ $data .= $current_line."#".base64_encode($entry)."\n";
}
}
}
@@ -951,7 +957,7 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
foreach ( $all as $single) {
$lineone = split("\n",$single);
$ndn = split("#", $lineone[0]);
- $line = $ndn[1];
+ $line = base64_decode($ndn[1]);
$dnn = split (":",$line);
$current_line = $ndn[0];
@@ -1003,6 +1009,8 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
{
if($this->reconnect) $this->connect();
+
+
$ret = false;
$rows= split("\n",$str_attr);
$data= false;
@@ -1012,13 +1020,13 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
/* Check if we use Linenumbers (when import_complete_ldif is called we use
Linenumbers) Linenumbers are use like this 123#attribute : value */
if(!empty($row)) {
- if((strpos($row,"#")!=FALSE)&&(strpos($row,"#")<strpos($row,":"))) {
+ if(strpos($row,"#")!=FALSE) {
/* We are using line numbers
Because there is a # before a : */
$tmp1= split("#",$row);
$current_line= $tmp1[0];
- $row= $tmp1[1];
+ $row= base64_decode($tmp1[1]);
}
/* Split the line into attribute and value */
@@ -1046,7 +1054,6 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
}
}
}
-
/* If dn is an index of data, we should try to insert the data */
if(isset($data['dn'])) {
/* Creating Entry */
@@ -1054,7 +1061,7 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
/* Delete existing entry */
if($delete){
- $this->rmdir($data['dn']);
+ $this->rmdir_recursive($data['dn']);
}
/* Create missing trees */
@@ -1068,7 +1075,7 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
$ret = $this->modify($data);
}
}
-
+ show_ldap_error($this->get_error(),_("Ldap import failed"));
return($ret);
}