X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fsetup%2Fclass_setupStep_Migrate.inc;h=e43d1a15c435a0fbd4f0580fa27f3dc0880f0f04;hb=4d183ead927cd3ecd80cf8b143ec0e51b4936ca4;hp=20d563b5f9a1b90b81cc8f53df2a9058f8f9676d;hpb=18ddf97c7467b397a389cbb0cec81cc7302c5fa0;p=gosa.git
diff --git a/gosa-core/setup/class_setupStep_Migrate.inc b/gosa-core/setup/class_setupStep_Migrate.inc
index 20d563b5f..e43d1a15c 100644
--- a/gosa-core/setup/class_setupStep_Migrate.inc
+++ b/gosa-core/setup/class_setupStep_Migrate.inc
@@ -94,6 +94,7 @@ class Step_Migrate extends setup_step
var $check_gidNumbers = array();
var $check_gidNumbers_dialog = FALSE;
+ var $group_list = array();
function Step_Migrate()
{
@@ -126,7 +127,6 @@ class Step_Migrate extends setup_step
$this->checks['deps_visible']['STATUS'] = FALSE;
$this->checks['deps_visible']['STATUS_MSG']= "";
$this->checks['deps_visible']['ERROR_MSG'] = "";
- $this->check_organizationalUnits();
$this->checks['users_visible']['TITLE'] = _("Checking for invisible users");
$this->checks['users_visible']['STATUS'] = FALSE;
@@ -151,6 +151,7 @@ class Step_Migrate extends setup_step
$this->checks['outside_groups']['STATUS_MSG']= "";
$this->checks['outside_groups']['ERROR_MSG'] = "";
$this->search_outside_groups();
+ $this->check_organizationalUnits();
$this->checks['outside_winstations']['TITLE'] = _("Checking for windows workstations outside the winstation tree");
$this->checks['outside_winstations']['STATUS'] = FALSE;
@@ -158,13 +159,13 @@ class Step_Migrate extends setup_step
$this->checks['outside_winstations']['ERROR_MSG'] = "";
$this->search_outside_winstations();
- $this->checks['uidNumber_usage']['TITLE'] = _("Checking for duplicate uid numbers");
+ $this->checks['uidNumber_usage']['TITLE'] = _("Checking for duplicated UID numbers");
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
$this->checks['uidNumber_usage']['STATUS_MSG']= "";
$this->checks['uidNumber_usage']['ERROR_MSG'] = "";
$this->check_uidNumber();
- $this->checks['gidNumber_usage']['TITLE'] = _("Checking for duplicate gid numbers");
+ $this->checks['gidNumber_usage']['TITLE'] = _("Checking for duplicate GID numbers");
$this->checks['gidNumber_usage']['STATUS'] = FALSE;
$this->checks['gidNumber_usage']['STATUS_MSG']= "";
$this->checks['gidNumber_usage']['ERROR_MSG'] = "";
@@ -176,15 +177,18 @@ 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"));
+ $res = $ldap->search("(&(objectClass=posixAccount)(uidNumber=*))",array("dn","uidNumber"));
if(!$res){
$this->checks['uidNumber_usage']['STATUS'] = FALSE;
$this->checks['uidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
@@ -225,13 +229,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 +281,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 +342,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']);
@@ -365,6 +378,7 @@ class Step_Migrate extends setup_step
}
$this->outside_groups = array();
+ $this->groups_list = array();;
while($attrs = $ldap->fetch()){
$group_db_base = preg_replace("/^[^,]+,".normalizePreg($group_ou)."+,/i","",$attrs['dn']);
@@ -378,6 +392,7 @@ class Step_Migrate extends setup_step
$attrs['ldif'] = "";
$this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
}
+ $this->group_list[] = $attrs['dn'];
}
if(count($this->outside_groups)){
@@ -399,13 +414,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 +494,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 +574,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 +627,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,18 +682,18 @@ 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,/",
+ $skip_dns = array("/".$cv['peopleou']."/","/".$cv['groupou']."/","/^ou=people,/","/^ou=groups,/","/^ou=sudoers,/",
"/(,|)ou=configs,/","/(,|)ou=systems,/",
"/(,|)ou=apps,/","/(,|)ou=mime,/","/(,|)ou=devices/","/^ou=aclroles,/","/^ou=incoming,/",
"/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
@@ -700,6 +720,17 @@ class Step_Migrate extends setup_step
foreach($this->deps_to_migrate as $key => $attrs){
$dn = $attrs['dn'];
$skip = false;;
+
+ /* Check if this object is an application release object
+ e.g. groups-> application menus.
+ */
+ if(preg_match("/^.*,[ ]*cn=/",$dn)){
+ $cn_dn = preg_replace("/^.*,[ ]*cn=/","cn=",$dn);
+ if(in_array($cn_dn,$this->group_list)){
+ $skip = true;
+ }
+ }
+
foreach($skip_dns as $skip_dn){
if(preg_match($skip_dn,$dn)){
$skip = true;
@@ -736,16 +767,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 +823,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 +930,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 +1010,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,21 +1029,18 @@ 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'];
}
- $methods = @passwordMethod::get_available_methods();
- $p_m = $methods[$cv['encryption']];
- $p_c = new $p_m(array());
- $hash = $p_c->generate_hash($pw2);
+ $hash = passwordMethod::make_hash($pw2, $cv['encryption']);
$new_user=array();
$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 +1073,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 +1123,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 +1172,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,19 +1622,21 @@ 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']);
+ $ldap->set_size_limit(1);
$res = $ldap->search("(objectClass=*)");
+ $ldap->set_size_limit(0);
$err = ldap_errno($ldap->cid);
if( !$res ||
@@ -1663,16 +1701,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 +1728,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 +1786,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 +1833,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 +1894,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 +1917,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']);
@@ -1916,7 +1955,9 @@ class Step_Migrate extends setup_step
msg_dialog::display(_("LDAP error"), sprintf(_("Copy '%s' to '%s' failed:")."
%s", LDAP::fix($source), LDAP::fix($destination), $ldap->get_error()), ERROR_DIALOG);
}else{
$res = $ldap->rmDir($source);
- show_ldap_error($ldap->get_error(),_("Problem copying DNs"));
+ if (!$ldap->success()){
+ msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $source, LDAP_DEL, get_class()));
+ }
/* Object is copied, so update its references */
foreach($ogs_to_fix as $dn => $data){