From c9d1e4dcf1b7ae5bc5a29b2a655d7654992e8705 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 24 May 2007 13:09:05 +0000 Subject: [PATCH] Fixed Admin group and user creation, in case of empty group and or user ou git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6469 594d385d-05f5-0310-b6e9-bd551577e9d8 --- setup/class_setupStep_Migrate.inc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc index cf487a90b..3daa0e3c6 100644 --- a/setup/class_setupStep_Migrate.inc +++ b/setup/class_setupStep_Migrate.inc @@ -882,7 +882,13 @@ class Step_Migrate extends setup_step } }else{ - $new_group_dn = "cn=GOsa Administrators,".$cv['groupou'].",".$cv['base']; + + $group_ou = trim($cv['groupou']); + if(!empty($group_ou)){ + $group_ou = trim($group_ou).","; + } + + $new_group_dn = "cn=GOsa Administrators,".$group_ou.$cv['base']; $new_group_attrs['objectClass'] = array("gosaObject","posixGroup"); $new_group_attrs['cn'] = "GOsa Administrators"; $new_group_attrs['gosaSubtreeACL'] = ":all"; @@ -945,11 +951,16 @@ class Step_Migrate extends setup_step /* Get current base attributes */ $ldap->cd($cv['base']); - + + $people_ou = trim($cv['peopleou']); + if(!empty($people_ou)){ + $people_ou = trim($people_ou).","; + } + if($cv['peopledn'] == "cn"){ - $dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base']; + $dn = "cn=System Administrator,".$people_ou.$cv['base']; }else{ - $dn = "uid=".$uid.",".$cv['peopleou'].",".$cv['base']; + $dn = "uid=".$uid.",".$people_ou.$cv['base']; } $methods = @passwordMethod::get_available_methods_if_not_loaded(); @@ -966,7 +977,6 @@ class Step_Migrate extends setup_step $new_user['userPassword'] = $hash; $ldap->cd($cv['base']); - $ldap->cat($dn,array("dn")); if($ldap->count()){ print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."), -- 2.30.2