From: hickert Date: Wed, 26 Mar 2008 08:50:03 +0000 (+0000) Subject: Updated setup to use multiplexer X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dcbef5c90333d5a9602445f0cacabdb03ed8c13b;p=gosa.git Updated setup to use multiplexer git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9984 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/setup/class_setupStep_Config2.inc b/gosa-core/setup/class_setupStep_Config2.inc index ecf986f83..450fe81e1 100644 --- a/gosa-core/setup/class_setupStep_Config2.inc +++ b/gosa-core/setup/class_setupStep_Config2.inc @@ -93,12 +93,14 @@ class Step_Config2 extends setup_step $this->mail_methods = $this->get_available_mail_classes(); /* On first call check for rid/sid base */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $ldap->cd($cv['base']); $ldap->search("(objectClass=sambaDomain)",array("dn")); if($ldap->count()){ diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc index 1001e8770..ed52e7cd5 100644 --- a/gosa-core/setup/class_setupStep_Migrate.inc +++ b/gosa-core/setup/class_setupStep_Migrate.inc @@ -176,13 +176,16 @@ class Step_Migrate extends setup_step */ function check_uidNumber() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $ldap->cd($cv['base']); $res = $ldap->search("uidNumber=*",array("dn","uidNumber")); if(!$res){ @@ -225,13 +228,16 @@ class Step_Migrate extends setup_step */ function check_gidNumber() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $ldap->cd($cv['base']); $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber")); if(!$res){ @@ -274,13 +280,16 @@ class Step_Migrate extends setup_step */ function search_outside_winstations() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Get winstation ou */ if($cv['generic_settings']['wws_ou_active']) { $winstation_ou = $cv['generic_settings']['ws_ou']; @@ -332,13 +341,16 @@ class Step_Migrate extends setup_step */ function search_outside_groups() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $group_ou = $cv['groupou']; $ldap->cd($cv['base']); @@ -399,13 +411,15 @@ class Step_Migrate extends setup_step */ function search_outside_users() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); @@ -477,13 +491,16 @@ class Step_Migrate extends setup_step */ function check_ldap_permissions() { + /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Create dummy entry */ $name = "GOsa_setup_text_entry_".session_id().rand(0,999999); @@ -554,16 +571,16 @@ class Step_Migrate extends setup_step $old = $this->users_to_migrate; $this->users_to_migrate = array(); - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Get all invisible users */ $ldap->cd($cv['base']); @@ -607,16 +624,16 @@ class Step_Migrate extends setup_step { $this->show_details= $only_ldif; - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Add gosaAccount objectClass to the selected users */ foreach($this->users_to_migrate as $key => $dep){ @@ -662,16 +679,16 @@ class Step_Migrate extends setup_step $old = $this->deps_to_migrate; $this->deps_to_migrate = array(); - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Skip GOsa internal departments */ $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/^ou=people,/","/^ou=groups,/", "/(,|)ou=configs,/","/(,|)ou=systems,/", @@ -736,16 +753,16 @@ class Step_Migrate extends setup_step { $this->show_details= $only_ldif; - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Add gosaDepartment objectClass to each selected entry */ foreach($this->deps_to_migrate as $key => $dep){ @@ -792,13 +809,13 @@ class Step_Migrate extends setup_step { /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); - /* Search for gosaAcls */ + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); $res = $ldap->cat($cv['base']); @@ -899,19 +916,22 @@ class Step_Migrate extends setup_step /* Get collected configuration settings */ $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + /* On first call check for rid/sid base */ + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Get current base attributes */ $ldap->cd($cv['base']); $ldap->cat($cv['base'],array("dn","objectClass","gosaAclEntry")); $attrs = $ldap->fetch(); /* Add acls for the selcted user to the base */ + $attrs_new = array(); $attrs_new['objectClass'] = array("gosaACL"); for($i = 0; $i < $attrs['objectClass']['count']; $i ++){ @@ -976,15 +996,16 @@ class Step_Migrate extends setup_step return false; } - - /* Establish ldap connection */ + /* On first call check for rid/sid base */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Get current base attributes */ $ldap->cd($cv['base']); @@ -994,7 +1015,7 @@ class Step_Migrate extends setup_step } if($cv['peopledn'] == "cn"){ - $dn = "cn=System Administrator,".$people_ou.$cv['base']; + $dn = "cn=System Administrator-".$uid.",".$people_ou.$cv['base']; }else{ $dn = "uid=".$uid.",".$people_ou.$cv['base']; } @@ -1008,7 +1029,7 @@ class Step_Migrate extends setup_step $new_user['objectClass']= array("top","person","gosaAccount","organizationalPerson","inetOrgPerson"); $new_user['givenName'] = "System"; $new_user['sn'] = "Administrator"; - $new_user['cn'] = "System Administrator"; + $new_user['cn'] = "System Administrator-".$uid; $new_user['uid'] = $uid; $new_user['userPassword'] = $hash; @@ -1041,12 +1062,14 @@ class Step_Migrate extends setup_step { /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $ldap->cd($cv['base']); /* Check if there was a destination department posted */ @@ -1089,12 +1112,13 @@ class Step_Migrate extends setup_step { /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); /* Check if there was a destination department posted */ @@ -1137,12 +1161,13 @@ class Step_Migrate extends setup_step { /* Establish ldap connection */ $cv = $this->parent->captured_values; - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); /* Check if there was a destination department posted */ @@ -1586,16 +1611,16 @@ class Step_Migrate extends setup_step */ function checkBase($just_check = TRUE) { - /* Get collected setup informations */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Check if root object exists */ $ldap->cd($cv['base']); $res = $ldap->search("(objectClass=*)"); @@ -1663,16 +1688,15 @@ class Step_Migrate extends setup_step function get_user_list() { - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); - + + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); $ldap->search("(objectClass=gosaAccount)",array("dn")); @@ -1691,12 +1715,14 @@ class Step_Migrate extends setup_step $people_ou = trim($cv['peopleou']); /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); /***************** * If people ou is NOT empty @@ -1747,16 +1773,16 @@ class Step_Migrate extends setup_step function get_all_winstation_ous() { - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Get winstation ou */ if($cv['generic_settings']['wws_ou_active']) { $winstation_ou = $cv['generic_settings']['ws_ou']; @@ -1794,16 +1820,16 @@ class Step_Migrate extends setup_step function get_all_group_ous() { - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + $group_ou = trim($cv['groupou']); if(!empty($group_ou)){ $group_ou = trim($group_ou); @@ -1855,15 +1881,15 @@ class Step_Migrate extends setup_step function get_group_list() { - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + + $ldap = new ldapMultiplexer($ldap_l); $ldap->cd($cv['base']); $ldap->search("(objectClass=posixGroup)",array("dn")); @@ -1878,16 +1904,16 @@ class Step_Migrate extends setup_step function move($source,$destination) { - /* Get collected configuration settings */ - $cv = $this->parent->captured_values; - /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $cv = $this->parent->captured_values; + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Update object references in gosaGroupOfNames */ $ogs_to_fix = array(); $ldap->cd($cv['base']); diff --git a/gosa-core/setup/class_setupStep_Schema.inc b/gosa-core/setup/class_setupStep_Schema.inc index 63b6ce473..0899c7792 100644 --- a/gosa-core/setup/class_setupStep_Schema.inc +++ b/gosa-core/setup/class_setupStep_Schema.inc @@ -68,12 +68,14 @@ class Step_Schema extends setup_step $cv = $this->parent->captured_values; /* Establish ldap connection */ - $ldap = new LDAP($cv['admin'], + $ldap_l = new LDAP($cv['admin'], $cv['password'], $cv['connection'], FALSE, $cv['tls']); + $ldap = new ldapMultiplexer($ldap_l); + /* Check if root object exists */ $ldap->cd($cv['base']); $res = $ldap->search("(objectClass=*)");