summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ab4a598)
raw | patch | inline | side by side (parent: ab4a598)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 29 Jun 2009 09:03:35 +0000 (09:03 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 29 Jun 2009 09:03:35 +0000 (09:03 +0000) |
instead of preg_replace, because it should avoid potential
problems with ',' in DNs
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13813 594d385d-05f5-0310-b6e9-bd551577e9d8
problems with ',' in DNs
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13813 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/fai/admin/fai/class_FAI.inc | patch | blob | history |
diff --git a/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc b/trunk/gosa-plugins/fai/admin/fai/class_FAI.inc
index e00cca4e6407271163184f374e533c4fa240774f..2a1dfe0da5cf6ff0a860b3ee8c163b9593e08cc8 100644 (file)
{
global $config;
$Current_DN = $dn;
+ $i = 0;
$tmp_dn = $Current_DN;
- $parent_dn = $tmp_dn;
+ $parent_dn = array();
/* special case partitions, as they don't start with cn= in their DN (schema bug?) */
$tmp_dn = preg_replace('/^FAIpartitionNr=/', 'cn=', $tmp_dn);
- while (preg_match('/^cn=/', $tmp_dn)){
- $parent_dn = $tmp_dn;
- $tmp_dn = preg_replace('/^cn=[^,.]*,/', '', $parent_dn);
+ $tmp_dn = gosa_ldap_explode_dn($tmp_dn);
+ while(preg_match('/^cn=/', $tmp_dn[$i])) {
+ $i++;
}
+ /* DN part does not start with cn= anymore, remove one from the counter to get the
+ last CN element */
+ $i--;
+
+ for ($i;$i<$tmp_dn['count'];$i++) {
+ $parent_dn[] = trim($tmp_dn[$i]);
+ }
+ $parent_dn = join($parent_dn, ',');
+
if ($parent_dn != $Current_DN){
$ldap = $config->get_ldap_link();
$ldap->cd($config->current['BASE']);
$ldap->cat($parent_dn);
-
- /* Check objectClasses and name to check if this is a release department */
if($ldap->count()){
return $parent_dn;
}