From 8a237c6020861b40d845598145e79efdf0446fcd Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 9 May 2007 10:28:30 +0000 Subject: [PATCH] Added new setup routine. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6317 594d385d-05f5-0310-b6e9-bd551577e9d8 --- html/index.php | 11 +- html/setup.php | 207 ++- html/themes/default/style.css | 265 ++++ ihtml/themes/default/setup_headers.tpl | 25 + include/class_config.inc | 3 +- include/class_ldap.inc | 252 +++- include/class_password-methods.inc | 2 +- include/class_pluglist.inc | 2 +- include/functions.inc | 5 +- include/functions_setup.inc | 1208 ---------------- setup/class_setup.inc | 320 +++++ setup/class_setupStep.inc | 130 ++ setup/class_setupStep_Checks.inc | 318 +++++ setup/class_setupStep_Config1.inc | 244 ++++ setup/class_setupStep_Config2.inc | 268 ++++ setup/class_setupStep_Config3.inc | 195 +++ setup/class_setupStep_Feedback.inc | 274 ++++ setup/class_setupStep_Finish.inc | 143 ++ setup/class_setupStep_Language.inc | 76 + setup/class_setupStep_Ldap.inc | 192 +++ setup/class_setupStep_License.inc | 82 ++ setup/class_setupStep_Migrate.inc | 1805 ++++++++++++++++++++++++ setup/class_setupStep_Schema.inc | 243 ++++ setup/class_setupStep_Welcome.inc | 71 + setup/license.txt | 147 ++ setup/main.inc | 35 + setup/setup.tpl | 4 + setup/setup_checks.tpl | 122 ++ setup/setup_config1.tpl | 213 +++ setup/setup_config2.tpl | 238 ++++ setup/setup_config3.tpl | 235 +++ setup/setup_feedback.tpl | 144 ++ setup/setup_finish.tpl | 23 + setup/setup_frame.tpl | 46 + setup/setup_language.tpl | 13 + setup/setup_ldap.tpl | 135 ++ setup/setup_license.tpl | 7 + setup/setup_migrate.tpl | 394 ++++++ setup/setup_schema.tpl | 40 + setup/setup_welcome.tpl | 37 + 40 files changed, 6840 insertions(+), 1334 deletions(-) create mode 100644 ihtml/themes/default/setup_headers.tpl delete mode 100644 include/functions_setup.inc create mode 100644 setup/class_setup.inc create mode 100644 setup/class_setupStep.inc create mode 100644 setup/class_setupStep_Checks.inc create mode 100644 setup/class_setupStep_Config1.inc create mode 100644 setup/class_setupStep_Config2.inc create mode 100644 setup/class_setupStep_Config3.inc create mode 100644 setup/class_setupStep_Feedback.inc create mode 100644 setup/class_setupStep_Finish.inc create mode 100644 setup/class_setupStep_Language.inc create mode 100644 setup/class_setupStep_Ldap.inc create mode 100644 setup/class_setupStep_License.inc create mode 100644 setup/class_setupStep_Migrate.inc create mode 100644 setup/class_setupStep_Schema.inc create mode 100644 setup/class_setupStep_Welcome.inc create mode 100644 setup/license.txt create mode 100644 setup/main.inc create mode 100644 setup/setup.tpl create mode 100644 setup/setup_checks.tpl create mode 100644 setup/setup_config1.tpl create mode 100644 setup/setup_config2.tpl create mode 100644 setup/setup_config3.tpl create mode 100644 setup/setup_feedback.tpl create mode 100644 setup/setup_finish.tpl create mode 100644 setup/setup_frame.tpl create mode 100644 setup/setup_language.tpl create mode 100644 setup/setup_ldap.tpl create mode 100644 setup/setup_license.tpl create mode 100644 setup/setup_migrate.tpl create mode 100644 setup/setup_schema.tpl create mode 100644 setup/setup_welcome.tpl diff --git a/html/index.php b/html/index.php index f7c0fb079..80446f1f2 100644 --- a/html/index.php +++ b/html/index.php @@ -97,7 +97,7 @@ $_SESSION['errorsAlreadyPosted']= array(); $_SESSION['LastError'] = ""; /* Check if we need to run setup */ -if (!file_exists(CONFIG_DIR."/gosa.conf")){ +if (!file_exists(CONFIG_DIR."/".CONFIG_FILE)){ header("location:setup.php"); exit(); } @@ -112,14 +112,14 @@ if(isset($_POST['javascript']) && $_POST['javascript'] == "true") { $_SESSION['js']= FALSE; } -/* Check if gosa.conf is accessible */ -if (!is_readable(CONFIG_DIR."/gosa.conf")){ - echo sprintf(_("GOsa configuration %s/gosa.conf is not readable. Aborted."), CONFIG_DIR); +/* Check if CONFIG_FILE is accessible */ +if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ + echo sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE); exit(); } /* Parse configuration file */ -$config= new config(CONFIG_DIR."/gosa.conf", $BASE_DIR); +$config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR); $_SESSION['DEBUGLEVEL']= $config->data['MAIN']['DEBUGLEVEL']; if ($_SERVER["REQUEST_METHOD"] != "POST"){ @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config"); @@ -214,7 +214,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){ $config->data['MAIN']['SCHEMA_CHECK'] = "true"; } if(isset($config->data['MAIN']['SCHEMA_CHECK'])&&preg_match("/true/i",$config->data['MAIN']['SCHEMA_CHECK'])){ - require_once("functions_setup.inc"); $recursive = (isset($config->current['RECURSIVE']) && $config->current['RECURSIVE'] == "true"); $tls = (isset($config->current['TLS']) && $config->current['TLS'] == "true"); diff --git a/html/setup.php b/html/setup.php index 3320ffd20..5adc78a6d 100644 --- a/html/setup.php +++ b/html/setup.php @@ -1,27 +1,59 @@ '; echo ' location = "setup.php?js=true";'; @@ -32,68 +64,33 @@ if (!isset($_GET['js']) && !isset($_SESSION['js'])){ $_SESSION['js']= TRUE; } -/* Load required includes */ -require_once ("../include/php_setup.inc"); -require_once ("functions.inc"); -require_once ("functions_setup.inc"); - -// Save the Post Data (back and forward button) -foreach ($_POST as $key => $val){ - $_SESSION['ldapconf'][$key] = $val; -} - -/* Don't call setup if gosa.conf exists */ -if (file_exists(CONFIG_DIR."/gosa.conf")){ - header("location:index.php"); - exit(); -} - -// Check if theres the example -if (!file_exists(CONFIG_TEMPLATE_DIR."/gosa.conf")){ - echo "error example of gosa.conf not present!"; -} - -// No Errors occured yet -$_SESSION['errors']= ""; +/* Attribute initialization, reset errors */ $_SESSION['errors'] = ""; $_SESSION['errorsAlreadyPosted']= array(); $_SESSION['LastError'] = ""; - -// Print out gosa.conf -//if(isset($_SESSION['classes'])) print "\$_SESSION['classes']=ok"; -//if(isset($_SESSION['ldapconf'])) print "\$_SESSION['ldapconf']=ok"; -//if(isset($_POST['getconf'])) print "\$_POST['getconf']=ok"; - -if (( - isset($_SESSION['classes']) && - isset($_SESSION['ldapconf']) && - ( - isset($_POST['getconf']) || isset($_GET['getconfig']) ))){ - echo parse_contrib_conf(); - exit; -} - -/* Set detected samba version */ -if (isset($classes['samba2'])) { - $samba= "3"; +/* Set template compile directory */ +if (isset ($config->data['MAIN']['COMPILE'])){ + $smarty->compile_dir= $config->data['MAIN']['COMPILE']; } else { - $samba= "2"; + $smarty->compile_dir= '/var/spool/gosa/'; } -/* Set template compile directory */ -$smarty->compile_dir= '/var/spool/gosa'; -/* Check for compile directory */ -if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ - print_red(_("Directory '%s' specified as smarty compile directory is not accessible, please check existence and rights of this directory!"), $smarty->compile_dir); - echo $_SESSION['errors']; - exit(); + +/* Get posted language */ +if(!isset($_SESSION['lang'])){ + $_SESSION['lang'] = get_browser_language(); +} +if(isset($_POST['lang_selected'])){ + if($_POST['lang_selected'] != ""){ + $_SESSION['lang'] = $_POST['lang_selected']; + }else{ + $_SESSION['lang'] = get_browser_language(); + } } -/* Language setup */ -$lang= get_browser_language(); -header("Content-type: text/html; charset=UTF-8"); +$lang = $_SESSION['lang']; $lang.=".UTF-8"; putenv("LANGUAGE="); putenv("LANG=$lang"); @@ -106,53 +103,35 @@ $domain = 'messages'; bindtextdomain($domain, "$BASE_DIR/locale"); textdomain($domain); -if ($_SERVER["REQUEST_METHOD"] != "POST"){ - // @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); -} - -/* Fill template with required values */ -$smarty->assign ('date', gmdate("D, d M Y H:i:s")); -if(isset ($_POST['next'])){ - $next = $_POST['next']; -} else { - $next = 1; -} +/* Call setup */ +$display = ""; +require_once("../setup/main.inc"); -if(isset($_POST['back'])) { - $next = $next -2 ; -} +/* Print_out last ErrorMessage repeated string. */ +print_red(NULL); -if($next < 1){ - $next = 1; -} +$smarty->assign("date", date("l, dS F Y H:i:s O")); +$header= "".$smarty->fetch(get_template_path('setup_headers.tpl')); +/* show web frontend */ +$smarty->assign("contents" , $display); +$smarty->assign("navigation", $_SESSION['setup']->get_navigation_html()); +$smarty->assign("header", $_SESSION['setup']->get_header_html()); +$smarty->assign("bottom", $_SESSION['setup']->get_bottom_html()); -// How this works - -// Every functioon called below, has two modes -// If the parameter is false, we only test if this function -// is called witout an error -// Is the return value = false, then there was an error -// and we call this func again, to output the error - -// I hope this will work fine ^^ -if((show_setup_page1(false))||($next == 1)) { - show_setup_page1(); -} elseif((show_setup_page2(false))||($next==2)) { - show_setup_page2(); -} elseif((show_setup_page3(false))||($next==3)) { - show_setup_page3(); -} elseif((show_setup_page4(false))||($next==4)) { - show_setup_page4(); -} -// This is called to test if we have an administrative Group with a User in it -elseif((!create_user_for_setup(false))) { - create_user_for_setup(); +if ($error_collector != ""){ + $smarty->assign("php_errors", $error_collector.""); +} else { + $smarty->assign("php_errors", ""); } -// this is the last Page which shows the downloadable conf file -else { - show_setup_page5(); +if (isset($_SESSION['errors'])){ + $smarty->assign("errors", $_SESSION['errors']); +}else{ + $smarty->assign("errors" , ""); } +$smarty->assign("version",get_gosa_version()); + +echo $header.$smarty->fetch("../setup/setup_frame.tpl"); // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/html/themes/default/style.css b/html/themes/default/style.css index b63fbcc43..e0f264b80 100644 --- a/html/themes/default/style.css +++ b/html/themes/default/style.css @@ -1135,4 +1135,269 @@ td.container_:hover,div.container_:hover { } +/********* + * Setup + *********/ + +/* The body style */ +body.setup_body { + margin-left:0px; + margin-right:0px; + margin-top:0px; + margin-bottom:0px; + color:#00008F; + font-family:arial,helvetica,sans-serif; + font-size:12px; + background-color: white; + background-image: none; +} + +/* The setup complete setup dialog */ +div.setup_dialog { + background-color:#FFF; + text-align: left; +} + +/* Header col */ +div.setup_header { + background-color: #A9FBA6; + height:30px; + padding:4px 5px 2px 5px; + border-bottom: 1px solid #999; +} + +div.setup_menu { + background-color: #F8F8F8; + padding:4px 5px 4px 5px; + border-bottom: 1px solid #B0B0B0; +} + +/* Setup content header container */ +div.setup_plug_header_container { +} + +/* Setup content container */ +div.setup_contents_container { +} +/* Setup footer */ +div.setup_bottom { + clear: left; + background-color:#DDDDDD; + border-top: solid 1px red; +} + +/******* + + + + + + + + +********/ + +/* Header col */ +div.setup_plug_header { + padding: 10px; + border-bottom: solid 1px #D0D0D0; + background-color: #E0E0F0; + border: 10px solid #FFFFFF; + +} + +/* Content col */ +div.setup_contents { + margin-right:2px; + background-color:white; + width:80%; + margin-left:20%; + border:1px solid #AAAAAA; + padding:2px; +} + +/* default.*/ +div.default { + padding: 2px; + vertical-align: middle; +} + +/* Navigation col */ +div.setup_navigation { + width:19%; + background-color:white; + padding-left: 2px; + padding-right: 2px; + border:1px solid #AAAAAA; + float:left; +} + + +/* Navigation title */ +div.setup_navigation_title { + font-size: 1.2em; + font-weight: bold; + text-decoration:none; + width:100%; + padding-top:8px; + padding-bottom:8px; + border-top:1px dashed #AAAAAA; +} + +/* The box used for each setup step */ +a.navigation_element, div.navigation_element { + text-decoration:none; + padding-top:8px; + padding-bottom:8px; + border-top:1px dashed #AAAAAA; + width:100%; +} + +/* The box used for each setup step */ +a.navigation_element_active, div.navigation_element_active { + text-decoration:none; + width:100%; + padding-top:8px; + padding-bottom:8px; + border-top:1px dashed #AAAAAA; + background-color:#F0F0F0; +} + +/* An enabled setup step will use this style in navigation*/ +div.navigation_title_active { + font-size: 1.2em; + background-color:#F0F0F0; + font-weight: bold; + cursor: default; + padding: 3px; +} + +/* Disabled setup steps */ +div.navigation_title_disabled { + font-size: 1.2em; + font-weight: bold; + padding: 3px; + cursor: default; + text-decoration:none; + color: #AAAAAA; +} + +/* Disabled setup steps */ +div.navigation_title_inactive { + font-size: 1.2em; + font-weight: bold; + text-decoration:none; + cursor: pointer; + padding: 3px; +} + +/* The style for the info of an active setup */ +div.navigation_info { + font-size: 1em; + color: black; + padding: 4px 4px 3px 23px; + margin: 0px; + cursor: default; +} + +/* + Setup step 2 styles +*/ + +/* used to hide display info div */ +div.solution_visible { + display: block; + width: 100%; + text-align:left; +} + +/* Container headline */ +h2.step2_container_title { + background-color:#F0F0F0; + border: solid 1px #CCCCCC; + width:100%; + padding:3px; +} + +/* Container for name and status */ +div.step2_entry_container { + padding:3px; + width:99%; + cursor:default; +} + +/* Container for name and status, when status is failed */ +div.step2_entry_container_info { + padding:3px; + border: 1px dashed #AAAAAA; + width:99%; + cursor:default; +} + +/* Text shown for each entry */ +div.step2_entry_name { + float:left; + padding-bottom:4px; + vertical-align: middle; +} + +/* Status container */ +div.step2_entry_status { + float:none; + text-align:right; + padding-bottom:4px; + vertical-align: middle; +} + +/* Status failed */ +div.step2_failed { + color:red; + padding-bottom:4px; +} + +/* Status failed but not necessary for setup */ +div.step2_warning { + color:orange; + padding-bottom:4px; +} + +/* Status successful */ +div.step2_successful { + color:green; +} + +/* Text used in info div. */ +div.step2_failed_text { + background-repeat: no-repeat; + padding-left: 25px; +} + +/* Text used in info div. On warnings */ +div.step2_warning_text{ + background-repeat: no-repeat; + padding-left: 25px; +} +/* + Setup step 4 styles +*/ + +li.step4_name, div.step4_name { + float:left; + width:20%; + height:2.0em; +} + +li.step4_value, div.step4_value { + float:left; + width:50%; + height:2.0em; +} + +ul.step4_container, div.step4_container { + height:2.0em; + margin-top:2px; + margin-left:2px; + margin-right:2px; +} + diff --git a/ihtml/themes/default/setup_headers.tpl b/ihtml/themes/default/setup_headers.tpl new file mode 100644 index 000000000..95605b49c --- /dev/null +++ b/ihtml/themes/default/setup_headers.tpl @@ -0,0 +1,25 @@ + + + + + {if isset($title)}{$title}{else}GOsa{/if} + + + + + + + + + + + + + + + + + + + + diff --git a/include/class_config.inc b/include/class_config.inc index c85268234..6a8e23b64 100644 --- a/include/class_config.inc +++ b/include/class_config.inc @@ -68,7 +68,8 @@ class config { $xmldata= fread($fh, 100000); fclose($fh); if(!xml_parse($this->parser, chop($xmldata))){ - print_red(sprintf(_("XML error in gosa.conf: %s at line %d"), + print_red(sprintf(_("XML error in %s: %s at line %d"), + CONFIG_FILE, xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser))); echo $_SESSION['errors']; diff --git a/include/class_ldap.inc b/include/class_ldap.inc index ea5d4f756..4ee33cbab 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -660,7 +660,150 @@ class LDAP{ } } + function create_missing_trees($target) + { + global $config; + + $real_path= substr($target, 0, strlen($target) - strlen($this->basedn) -1 ); + + if ($target == $this->basedn){ + $l= array("dummy"); + } else { + $l= array_reverse(gosa_ldap_explode_dn($real_path)); + } + unset($l['count']); + $cdn= $this->basedn; + $tag= ""; + + /* Load schema if available... */ + $classes= $this->get_objectclasses(); + + foreach ($l as $part){ + if ($part != "dummy"){ + $cdn= "$part,$cdn"; + } + + /* Ignore referrals */ + $found= false; + foreach($this->referrals as $ref){ + $base= preg_replace('!^[^:]+://[^/]+/([^?]+).*$!', '\\1', $ref['URL']); + if ($base == $cdn){ + $found= true; + break; + } + } + if ($found){ + continue; + } + + $this->cat ($cdn); + $attrs= $this->fetch(); + + /* Create missing entry? */ + if (count ($attrs)){ + /* Catch the tag - if present */ + if (isset($attrs['gosaUnitTag'][0])){ + $tag= $attrs['gosaUnitTag'][0]; + } + + } else { + $type= preg_replace('/^([^=]+)=.*$/', '\\1', $cdn); + $param= preg_replace('/^[^=]+=([^,]+),.*$/', '\\1', $cdn); + + $na= array(); + + /* Automatic or traditional? */ + if(count($classes)){ + + /* Get name of first matching objectClass */ + $ocname= ""; + foreach($classes as $class){ + if (isset($class['MUST']) && $class['MUST'] == "$type"){ + + /* Look for first classes that is structural... */ + if (isset($class['STRUCTURAL'])){ + $ocname= $class['NAME']; + break; + } + + /* Look for classes that are auxiliary... */ + if (isset($class['AUXILIARY'])){ + $ocname= $class['NAME']; + } + } + } + + /* Bail out, if we've nothing to do... */ + if ($ocname == ""){ + print_red(sprintf(_("Autocreation of subtree failed. No objectClass found for attribute '%s'."), $type)); + echo $_SESSION['errors']; + exit; + } + + /* Assemble_entry */ + if ($tag != ""){ + $na['objectClass']= array($ocname, "gosaAdministrativeUnitTag"); + } else { + $na['objectClass']= array($ocname); + } + if (isset($classes[$ocname]['AUXILIARY'])){ + $na['objectClass'][]= $classes[$ocname]['SUP']; + } + if ($type == "dc"){ + /* This is bad actually, but - tell me a better way? */ + $na['objectClass'][]= 'locality'; + } + $na[$type]= $param; + if (is_array($classes[$ocname]['MUST'])){ + foreach($classes[$ocname]['MUST'] as $attr){ + $na[$attr]= "filled"; + } + } + + } else { + + /* Use alternative add... */ + switch ($type){ + case 'ou': + if ($tag != ""){ + $na["objectClass"]= array("organizationalUnit", "gosaAdministrativeUnitTag"); + $na["gosaUnitTag"]= $tag; + } else { + $na["objectClass"]= "organizationalUnit"; + } + $na["ou"]= $param; + break; + case 'dc': + if ($tag != ""){ + $na["objectClass"]= array("dcObject", "top", "locality", "gosaAdministrativeUnitTag"); + $na["gosaUnitTag"]= $tag; + } else { + $na["objectClass"]= array("dcObject", "top", "locality"); + } + $na["dc"]= $param; + break; + default: + print_red(sprintf(_("Autocreation of type '%s' is currently not supported. Please report to the GOsa team."), $type)); + echo $_SESSION['errors']; + exit; + } + + } + $this->cd($cdn); + $this->add($na); + show_ldap_error($this->get_error(), sprintf(_("Creating subtree '%s' failed."),$cdn)); + if (!preg_match('/success/i', $this->error)){ + return FALSE; + } + } + } + + return TRUE; + } + + + function create_missing_trees_old($target) { /* Ignore create_missing trees if the base equals target */ if ($target == $this->basedn){ @@ -1133,7 +1276,7 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec } - function get_objectclasses() + function get_objectclasses_old() { $objectclasses = array(); @@ -1166,6 +1309,97 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec } + function get_objectclasses() + { + $objectclasses = array(); + +# Get base to look for schema + $sr = @ldap_read ($this->cid, NULL, "objectClass=*", array("subschemaSubentry")); + if(!$sr){ + $sr = @ldap_read ($this->cid, "", "objectClass=*", array("subschemaSubentry")); + } + + $attr = @ldap_get_entries($this->cid,$sr); + if (!isset($attr[0]['subschemasubentry'][0])){ + return array(); + } + + /* Get list of objectclasses and fill array */ + $nb= $attr[0]['subschemasubentry'][0]; + $objectclasses= array(); + $sr= ldap_read ($this->cid, $nb, "objectClass=*", array("objectclasses")); + $attrs= ldap_get_entries($this->cid,$sr); + if (!isset($attrs[0])){ + return array(); + } + foreach ($attrs[0]['objectclasses'] as $val){ + if (preg_match('/^[0-9]+$/', $val)){ + continue; + } + $name= "OID"; + $pattern= split(' ', $val); + $ocname= preg_replace("/^.* NAME\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $val); + $objectclasses[$ocname]= array(); + + foreach($pattern as $chunk){ + switch($chunk){ + + case '(': + $value= ""; + break; + + case ')': if ($name != ""){ + $objectclasses[$ocname][$name]= $this->value2container($value); + } + $name= ""; + $value= ""; + break; + + case 'NAME': + case 'DESC': + case 'SUP': + case 'STRUCTURAL': + case 'ABSTRACT': + case 'AUXILIARY': + case 'MUST': + case 'MAY': + if ($name != ""){ + $objectclasses[$ocname][$name]= $this->value2container($value); + } + $name= $chunk; + $value= ""; + break; + + default: $value.= $chunk." "; + } + } + + } + + return $objectclasses; + } + + function value2container($value) + { + /* Set emtpy values to "true" only */ + if (preg_match('/^\s*$/', $value)){ + return true; + } + + /* Remove ' and " if needed */ + $value= preg_replace('/^[\'"]/', '', $value); + $value= preg_replace('/[\'"] *$/', '', $value); + + /* Convert to array if $ is inside... */ + if (preg_match('/\$/', $value)){ + $container= preg_split('/\s*\$\s*/', $value); + } else { + $container= chop($value); + } + + return ($container); + } + function log($string) { if (isset($_SESSION['config'])){ @@ -1190,6 +1424,22 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec } + function get_naming_contexts($server, $admin= "", $password= "") + { + /* Build LDAP connection */ + $ds= ldap_connect ($server); + if (!$ds) { + die ("Can't bind to LDAP. No check possible!"); + } + ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); + $r= ldap_bind ($ds, $admin, $password); + + /* Get base to look for naming contexts */ + $sr = @ldap_read ($ds, "", "objectClass=*", array("+")); + $attr= @ldap_get_entries($ds,$sr); + + return ($attr[0]['namingcontexts']); + } } diff --git a/include/class_password-methods.inc b/include/class_password-methods.inc index 2755134f1..6d8dc0e3a 100644 --- a/include/class_password-methods.inc +++ b/include/class_password-methods.inc @@ -201,7 +201,7 @@ function generate_smb_nt_hash($password) $hash= current($ar); if ($hash == "") { - print_red (_("Setting for SMBHASH in gosa.conf is incorrect! Can't change Samba password.")); + print_red (sprintf(_("Setting for SMBHASH in %s is incorrect! Can't change Samba password."),CONFIG_FILE)); } else { diff --git a/include/class_pluglist.inc b/include/class_pluglist.inc index 89d55749e..93cd00afd 100644 --- a/include/class_pluglist.inc +++ b/include/class_pluglist.inc @@ -113,7 +113,7 @@ class pluglist { /* Read information from class variable */ if (!isset($info['CLASS'])){ - print_red(_("Your gosa.conf information has changed partly. Please convert it using the contributed script fix_config.sh!")); + print_red(sprintf(_("Your %s information has changed partly. Please convert it using the contributed script fix_config.sh!"),CONFIG_FILE)); echo $_SESSION['errors']; exit; } diff --git a/include/functions.inc b/include/functions.inc index 04a9d91d1..eb5c3304d 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -20,6 +20,7 @@ /* Configuration file location */ define ("CONFIG_DIR", "/etc/gosa"); +define ("CONFIG_FILE", "gosa.conf"); define ("CONFIG_TEMPLATE_DIR", "../contrib/"); define ("HELP_BASEDIR", "/var/www/doc/"); @@ -476,7 +477,7 @@ function add_lock ($object, $user) $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64_encode($object)."))", array("gosaUser")); if (!preg_match("/Success/i", $ldap->error)){ - print_red (sprintf(_("Can't set locking information in LDAP database. Please check the 'config' entry in gosa.conf! LDAP server says '%s'."), $ldap->get_error())); + print_red (sprintf(_("Can't set locking information in LDAP database. Please check the 'config' entry in %s! LDAP server says '%s'."),CONFIG_FILE, $ldap->get_error())); return; } @@ -557,7 +558,7 @@ function get_lock ($object) $ldap->cd ($config->current['CONFIG']); $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser")); if (!preg_match("/Success/i", $ldap->error)){ - print_red (_("Can't get locking information in LDAP database. Please check the 'config' entry in gosa.conf!")); + print_red (sprintf(_("Can't get locking information in LDAP database. Please check the 'config' entry in %s!"),CONFIG_FILE)); return(""); } diff --git a/include/functions_setup.inc b/include/functions_setup.inc deleted file mode 100644 index 3cd14af18..000000000 --- a/include/functions_setup.inc +++ /dev/null @@ -1,1208 +0,0 @@ -"; - - foreach ($table as $key => $values){ - $msg = $values['msg']; - $message.= "$msg"; - - if($values['status']) { - $message.=" - true"; - } else { - $message.=" - false"; - } - } - $message.=""; - - return $message; -} - - -function is_schema_readable($server, $admin, $password, $follow_referrals=FALSE, $tls=FALSE) -{ - $ldap = new LDAP($admin, $password, $server, $follow_referrals, $tls); - $tmp = $ldap->get_objectclasses(); - - if(count($tmp)){ - return(true); - } - return(false); -} - -function schema_check($server, $admin, $password, $follow_referrals=FALSE, $tls=FALSE, $aff=0, $CalledByIndexPhP=false) -{ - global $config; - - $messages= array(); - $required_classes= array( - "gosaObject" => array("version" => "2.4"), - "gosaAccount" => array("version" => "2.4"), - "gosaLockEntry" => array("version" => "2.4"), - "gosaCacheEntry" => array("version" => "2.4"), - "gosaDepartment" => array("version" => "2.4"), - - "goFaxAccount" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), - "goFaxSBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), - "goFaxRBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), - - "gosaUserTemplate" => array("version" => "2.4", "class" => "posixAccount","file" => "nis.schema"), - "gosaMailAccount" => array("version" => "2.4", "class" => "mailAccount","file" => "gosa+samba3.schema"), - "gosaProxyAccount" => array("version" => "2.4", "class" => "proxyAccount","file" => "gosa+samba3.schema"), - "gosaApplication" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), - "gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), - - "GOhard" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), - "gotoTerminal" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), - "goServer" => array("version" => "2.4","class" => "server","file" => "goserver.schema"), - "goTerminalServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), - "goShareServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), - "goNtpServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), - "goSyslogServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), - "goLdapServer" => array("version" => "2.4"), - "goCupsServer" => array("version" => "2.4", "class" => array("posixAccount", "terminals"),), - "goImapServer" => array("version" => "2.4", "class" => array("mailAccount", "mailgroup"),"file" => "gosa+samba3.schema"), - "goKrbServer" => array("version" => "2.4"), - "goFaxServer" => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"), - ); - - /* Get objectclasses */ - $ldap = new LDAP($admin,$password, $server, $follow_referrals, $tls); - $objectclasses = $ldap->get_objectclasses(); - if(count($objectclasses) == 0){ - return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE))); - } - - /* Walk through objectclasses and check if they are needed or not */ - foreach ($required_classes as $key => $value){ - if (isset($value['class'])){ - if (!is_array($value['class'])){ - $classes= array($value['class']); - } else { - $classes= $value['class']; - } - - /* Check if we are using the class that requires */ - foreach($classes as $class){ - if (!isset($objectclasses[$key])){ - $messages[$key]['msg']= sprintf(_("Optional objectclass '%s' required by plugin '%s' is not present in LDAP setup"), $key, $class); - $messages[$key]['status'] = FALSE; - } else { - if (!check_schema_version($objectclasses[$key], $value['version'])){ - $messages[$key]['msg']= sprintf(_("Optional objectclass '%s' required by plugin '%s' does not have version %s"), $key, $class, $value['version']); - $messages[$key]['needonstartup'] = TRUE; - $messages[$key]['status'] =FALSE; - }else { - if(!isset($affich2[$class])){ - $affich2[$class]['msg'] = sprintf(_("Support for '%s' enabled"), $class)." ".$value['file'].""; - $affich2[$class]['status']= TRUE; - } - } - } - - } - } else { - /* Required class */ - if (!isset($objectclasses[$key])){ - $messages[$key]['msg']= sprintf(_("Required objectclass '%s' is not present in LDAP setup"), $key); - $messages[$key]['status'] = FALSE; - } else { - if (!check_schema_version($objectclasses[$key], $value['version'])){ - $messages[$key]['msg']= sprintf(_("Required objectclass '%s' does not have version %s"), $key, $value['version']); - $messages[$key]['status'] = FALSE; - $messages[$key]['needonstartup'] = TRUE; - } - - } - } - } - - /* Check for correct samba parameters */ - if (!isset($objectclasses['sambaSamAccount'])){ - $messages['samba3']['msg']= _("SAMBA 3 support disabled, no schema seems to be installed"); - $affich['samba3']['msg']= $messages['samba3']['msg']."gosa+samba3.schema"; - $messages['samba3']['status']= FALSE; - $affich['samba3']['status']= FALSE; - }else{ - $affich['samba3']['msg']= _("SAMBA 3 support enabled")."gosa+samba3.schema"; - $affich['samba3']['status']= TRUE; - } - - if (!isset($objectclasses['sambaAccount'])){ - $messages['samba2']['msg']= _("SAMBA 2 support disabled, no schema seems to be installed"); - $affich['samba2']['msg']= $messages['samba2']['msg']."samba.schema"; - $messages['samba2']['status']= FALSE; - $affich['samba2']['status']= FALSE; - }else{ - $affich['samba2']['msg']= _("SAMBA 2 support enabled")."samba.schema"; - $affich['samba2']['status']= TRUE; - } - - /* Check pureftp/dns/ */ - if (!isset($objectclasses['PureFTPdUser'])){ - $messages['pureftp']['msg']= _("Support for pureftp disabled, no schema seems to be installed"); - $affich['pureftp']['msg']= $messages['pureftp']['msg']."pureftpd.schema"; - $messages['pureftp']['status']= FALSE; - $affich['pureftp']['status']= FALSE; - }else{ - $affich['pureftp']['msg']= _("Support for pureftp enabled")."pureftpd.schema"; - $affich['pureftp']['status']= TRUE; - } - - if (!isset($objectclasses['gosaWebdavAccount'])){ - $messages['webdav']['msg']= _("Support for WebDAV disabled, no schema seems to be installed"); - $affich['webdav']['msg']= $messages['webdav']['msg'].""; - $messages['webdav']['status']= FALSE; - $affich['webdav']['status']= FALSE; - }else{ - $affich['webdav']['msg']=_("Support for WebDAV enabled")."gosa+samba3.schema"; - $affich['webdav']['status']= TRUE; - } - - if (!isset($objectclasses['phpgwAccount'])){ - $messages['phpgroupware']['msg']= _("Support for phpgroupware disabled, no schema seems to be installed"); - $affich['phpgroupware']['msg']= $messages['phpgroupware']['msg']."phpgwaccount.schema"; - $messages['phpgroupware']['status']= FALSE; - $affich['phpgroupware']['status']= FALSE; - }else{ - $affich['phpgroupware']['msg']= _("Support for phpgroupware enabled")."phpgwaccount.schema"; - $affich['phpgroupware']['status']= TRUE; - } - - if (!isset($objectclasses['trustAccount'])){ - $messages['trustAccount']['msg']= _("Support for trustAccount disabled, no schema seems to be installed"); - $affich['trustAccount']['msg']= $messages['trustAccount']['msg']."trust.schema"; - $messages['trustAccount']['status']= FALSE; - $affich['trustAccount']['status']= FALSE; - }else{ - $affich['trustAccount']['msg']= _("Support for trustAccount enabled")."trust.schema"; - $affich['trustAccount']['status']= TRUE; - } - - if (!isset($objectclasses['goFonAccount'])){ - $messages['phoneaccount']['msg']= _("Support for gofon disabled, no schema seems to be installed"); - $affich['phoneaccount']['msg']= $messages['phoneaccount']['msg']."gofon.schema"; - $messages['phoneaccount']['status']= FALSE; - $affich['phoneaccount']['status']= FALSE; - }else{ - $affich['phoneaccount']['msg']= _("Support for gofon enabled")."gofon.schema"; - $affich['phoneaccount']['status']= true; - } - - if (!isset($objectclasses['nagiosContact'])){ - $messages['nagioscontact']['msg']= _("Support for nagios disabled, no schema seems to be installed"); - $affich['nagioscontact']['msg']= $messages['nagioscontact']['msg']."nagios.schema"; - $messages['nagioscontact']['status']= FALSE; - $affich['nagioscontact']['status']= FALSE; - }else{ - $affich['nagioscontact']['msg']= _("Support for nagios enabled")."nagios.schema"; - $affich['nagioscontact']['status']= true; - } - - if ((!isset($objectclasses['apple-user'])) || (!isset($objectclasses['mount'])) ){ - $messages['netatalk']['msg']= _("Support for netatalk disabled, no schema seems to be installed"); - $affich['netatalk']['msg']= $messages['netatalk']['msg']."apple.schema"; - $messages['netatalk']['status']= FALSE; - $affich['netatalk']['status']= FALSE; - }else{ - $affich['netatalk']['msg']= _("Support for netatalk enabled")."apple.schema"; - $affich['netatalk']['status']= true; - } - - /* Fix for PHP Fehler "Undefined index: ldapconf" - * Ablaufverfolgung[1]: Funktion schema_check Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230) - */ - if((isset($_SESSION['ldapconf']['mail_methods']))&&(isset($_SESSION['ldapconf']))){ - if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")&&(!$CalledByIndexPhP)){ - if(!isset($objectclasses['kolabInetOrgPerson'])) { - $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus"); - $affich['kolab']['msg']=$messages['kolab']['msg']."kolab2.schema"; - $tmp= array_flip($_SESSION['ldapconf']['mail_methods']); - $_SESSION['ldapconf']['mail']=$tmp['cyrus']; - $messages['kolab']['status']= FALSE; - $affich['kolab']['status']= FALSE; - }else{ - $affich['kolab']['msg']=_("Support for Kolab enabled")."gofon.schema"; - $affich['kolab']['status']= TRUE; - } - } - } - if($aff==0){ - return ($messages); - } else { - return(array_merge($affich,$affich2)); - } -} - - -function check(&$faults, $message, $description, $test, $required= TRUE) -{ - $msg= " -
$message"; - if ($test){ - $msg.= _("OK")."
"; - } else { - if (!$required){ - $msg.=""._("Ignored")."
"; - } else { - $msg.=""._("Failed")."
"; - $faults++; - } - } - $msg.= "
$description

"; - - return $msg; -} - -function perform_php_checks(&$faults) -{ - global $check_globals; - - $faults= 0; - $msg= ""; - - $msg.= "

"._("PHP setup inspection")."

"; - - $msg.= check ( $faults, _("Checking for PHP version (>=4.1.0)"), - _("PHP must be of version 4.1.0 or above for some functions and known bugs in PHP language."), - version_compare(phpversion(), "4.1.0")>=0); - - $msg.= check ( $faults, _("Checking if register_globals is set to 'off'"), - _("register_globals is a PHP mechanism to register all global varibales to be accessible from scripts without changing the scope. This may be a security risk. GOsa will run in both modes."), - $check_globals == 0, FALSE); - - $msg.= check ( $faults, _("PHP session.gc_maxlifetime (>= 86400 seconds)."), - _("PHP uses this value for the garbage collector to delete old sessions, setting this value to one day will prevent loosing session and cookie before they really timeout."), - ini_get("session.gc_maxlifetime") >= 86400,FALSE); - - $msg.= check ( $faults, _("Checking for ldap module"), - _("This is the main module used by GOsa and therefore really required."), - is_callable('ldap_bind')); - - $msg.= check ( $faults, _("Checking for XML functions"), - _("XML functions are required to parse the configuration file."), - is_callable('xml_parser_create')); - - $msg.= check ( $faults, _("Checking for gettext support"), - _("Gettext support is required for internationalized GOsa."), - is_callable('bindtextdomain')); - - $msg.= check ( $faults, _("Checking for iconv support"), - _("This module is used by GOsa to convert samba munged dial informations and is therefore required."), - is_callable('iconv')); - - $msg.= check ( $faults, _("Checking for mhash module"), - _("To use SSHA encryption, you'll need this module. If you are just using crypt or md5 encryption, ignore this message. GOsa will run without it."), - is_callable('mhash'), FALSE); - - $msg.= check ( $faults, _("Checking for imap module"), - _("The IMAP module is needed to communicate with the IMAP server. It gets status informations, creates and deletes mail users."), - is_callable('imap_open')); - - $msg.= check ( $faults, _("Checking for getacl in imap"), - _("The getacl support is needed for shared folder permissions. The standard IMAP module is not capable of reading acl's. You need a recend PHP version for this feature."), - is_callable('imap_getacl'), FALSE); - - $msg.= check ( $faults, _("Checking for mysql module"), - _("MySQL support is needed for reading GOfax reports from databases."), - is_callable('mysql_query'), FALSE); - - $msg.= check ( $faults, _("Checking for cups module"), - _("In order to read available printers from IPP protocol instead of printcap files, you've to install the CUPS module."), - is_callable('cups_get_dest_list'), FALSE); - - $msg.= check ( $faults, _("Checking for kadm5 module"), - _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network."), - is_callable('kadm5_init_with_password'), FALSE); - - $msg.= check ( $faults, _("Checking for snmp Module"), - _("Simple Network Management Protocol (SNMP) is required for client monitoring."), - is_callable('snmpget'), FALSE); - - return ($msg); -} - -function get_link($function_name) { - $result= "$function_name"; - - return $result; -} - -function perform_additional_function_checks(&$faults) { - global $check_globals; - - $faults= 0; - $msg= ""; - $functions= array(); - - $functions_list= '../include/functions_list.inc'; - - /* Make sure that we can read the file */ - if(is_readable($functions_list)) { - /* Open filehandle */ - $fh= fopen($functions_list,'rb'); - if($fh!=null) { - $functions= eval(fread($fh,filesize($functions_list))); - } - } - - $msg.= "

"._("PHP detailed function inspection")."

"; - /* Only print message, if function is not callable */ - foreach($functions as $key => $fn_name) { - if(!is_callable($fn_name)) { - $msg.= check ($faults, sprintf(_("Checking for function %s"), "".get_link($fn_name).""), - sprintf(_("The function %s is used by GOsa. There is no information if it's optional or required yet."), "".get_link($fn_name).""), - is_callable($fn_name), false); - } - } - return $msg; -} - -function perform_additional_checks(&$faults) -{ - $ret = NULL; - /* Programm check */ - $msg= "

"._("Checking for some additional programms")."

"; - - /* Image Magick */ - $query= "LC_ALL=C LANG=C convert -help"; - $output= shell_exec ($query); - if ($output != ""){ - $lines= split ("\n", $output); - $version= preg_replace ("/^Version: (.+Magick) ([^\s]+).*/", "\\1 \\2", $lines[0]); - list($prog, $version) = split(" ", $version); - list($major, $minor,$minor2)= split("\.", $version); - if (preg_match('/GraphicsMagick/', $prog)) { - $msg.= check ( $faults, _("Checking for GraphicsMagick (>=1.1.2)"), - _("GraphicsMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."), - ($major > 1 || ($major == 1 && $minor >= 1) || ($major == 1 && $minor == 1 && $minor2 >= 2) ) ); - } else { - $msg.= check ( $faults, _("Checking for ImageMagick (>=5.4.0)"), - _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."), - ($major > 5 || ($major == 5 && $minor >= 4))); - } - } else { - $msg.= check ( $faults, _("Checking imagick module for PHP"), - _("Imagick is used to convert user supplied images to fit the suggested size and the unified JPEG format from PHP script."), function_exists('imagick_blob2image'), TRUE); - } - - /* Check for fping */ - $query= "LC_ALL=C LANG=C fping -v 2>&1"; - $output= shell_exec ($query); - $have_fping= preg_match("/^fping:/", $output); - $msg.= check ( $faults, _("Checking for fping utility"), - _("The fping utility is only used if you've got a thin client based terminal environment running."), - $have_fping, FALSE); - - /* Check for smb hash generation tool */ - $query= "mkntpwd 2>&1"; - $output= shell_exec ($query); - $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output); - $alt = 0; - - if (!$have_mkntpwd){ - $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;" &>/dev/null'; - system ($query, $ret); - $alt= ($ret == 0); - } - - $msg.= check ( $faults, _("Checking for a way to generate LM/NT password hashes"), - _("In order to use SAMBA 2/3, you've to install some additional packages to generate password hashes."), - ($have_mkntpwd || $alt)); - - /* seesio.auto_start should be off, in order to without trouble*/ - $session_auto_start = ini_get('session.auto_start'); - $implicit_flush = ini_get('implicit_flush'); - $max_execution_time = ini_get('max_execution_time'); - $memory_limit = ini_get('memory_limit'); - $expose_php = ini_get('expose_php'); - $magic_quotes_gpc = ini_get('magic_quotes_gpc'); - $register_globals = ini_get('register_globals'); - - /* auto_register */ - $msg.= check ( $faults, _("php.ini check -> session.auto_register"), - _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini must be set to 'Off'."), (!$session_auto_start['local_value'])); - - /* implicit_flush */ - $msg.= check ( $faults, _("php.ini check -> implicit_flush"), - _("This option influences the Output handling. Turn this Option off, to increase performance."), - !$implicit_flush['local_value'],0,false); - - /* max_execution_time */ - if($max_execution_time['local_value'] < 30 ){ - $max_execution_time['local_value']=false; - } - $msg.= check ( $faults, _("php.ini check -> max_execution_time"), - _("The Execution time should be at least 30 seconds, because some actions may consume more time."), - $max_execution_time['local_value'],0,false); - - /* memory_limit */ - if($memory_limit['local_value'] < 16 ){ - $memory_limit['local_value']=false; - } - $msg.= check ( $faults, _("php.ini check -> memory_limit"), - _("GOsa needs at least 16MB of memory, less will cause unpredictable errors! Increase it for larger setups."), - !$implicit_flush['local_value'],0,false); - - /* expose_php */ - $msg.= check ( $faults, _("php.ini check -> expose_php"), - _("Increase the server security by setting expose_php to 'off'. PHP won't send any Information about the server you are running in this case."), - !$implicit_flush['local_value'],0,false); - - /* magic_quotes_gpc */ - $msg.= check ( $faults, _("php.ini check -> magic_quotes_gpc"), - _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."), - $magic_quotes_gpc['local_value'],0,false); - - return $msg; -} - - -function parse_contrib_conf() -{ - - $str = ""; - $used_samba_version = 0; - $query = ""; - $fp = false; - $output = ""; - $needridbase_sid = false; - $pwdhash = ""; - $replacements = array(); - $ldapconf = $_SESSION['ldapconf']; // The Installation information - $classes = $_SESSION['classes']; // Class information needed to define which features are enabled - $possible_plugins = array(); - - /* Which samba version do we use? */ - if(isset($classes['samba3'])){ - $used_samba_version = 2; - } else { - $used_samba_version = 3; - } - - /* Look for samba password generation method */ - if(file_exists("/usr/bin/mkntpasswd")){ - $pwdhash = "/usr/bin/mkntpasswd"; - } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){ - $pwdhash= "mkntpwd"; - } else { - $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"'; - } - - - /* Define which variables will be replaced */ - $replacements['{LOCATIONNAME}'] = $ldapconf['location']; - $replacements['{SAMBAVERSION}'] = $used_samba_version; - $replacements['{LDAPBASE}'] = $ldapconf['base']; - $replacements['{LDAPADMIN}'] = $ldapconf['admin']; - $replacements['{UIDBASE}'] = $ldapconf['uidbase']; - $replacements['{DNMODE}'] = $ldapconf['peopledn']; - $replacements['{LDAPHOST}'] = $ldapconf['uri']; - $replacements['{PASSWORD}'] = $ldapconf['password']; - $replacements['{CRYPT}'] = $ldapconf['arr_cryptkeys'][$ldapconf['arr_crypts']]; - $replacements['{SID}'] = ""; - $replacements['{RIDBASE}'] = ""; - if($ldapconf['mail'] != "disabled"){ - $replacements['{MAILMETHOD}'] = $ldapconf['mail_methods'][$ldapconf['mail']]; - } - $replacements['{SMBHASH}'] = $pwdhash; - $replacements['{GOVERNMENTMODE}']= "false"; - $replacements['{kolabAccount}'] = ""; - $replacements['{servKolab}'] = ""; - $replacements['{errorlvl}'] = $ldapconf['errorlvl']; - - /* This array contains all preg_replace syntax to delete all unused plugins - THE kEY MUST BE THE CLASSNAME so we can check it with $ldapconf['classes'] */ - - $possible_plugins['fonreport'][] = "'\n.*.*\n'i"; - $possible_plugins['phoneaccount'][]= "'\n.*.*\n'i"; - $possible_plugins['logview'][] = "'\n.*.*\n'i"; - $possible_plugins['pureftp'][] = "'\n.*.*\n'i"; - $possible_plugins['webdav'][] = "'\n.*.*\n'i"; - $possible_plugins['phpgroupware'][]= "'\n.*.*\n'i"; - $possible_plugins['netatalk'][0] = "'\n.*.*\n'i"; - $possible_plugins['netatalk'][1] = "'\n.*.*\n'i"; - - /*Header information - Needed to send the generated gosa.conf to the browser */ - header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); - header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - header("Cache-Control: no-cache"); - header("Pragma: no-cache"); - header("Cache-Control: post-check=0, pre-check=0"); - header("Content-type: text/plain"); - - if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) || - preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){ - header('Content-Disposition: filename="gosa.conf"'); - } else { - header('Content-Disposition: attachment; filename="gosa.conf"'); - } - - if(!$fp=fopen(CONFIG_TEMPLATE_DIR."/gosa.conf","r")) { - echo "Can't open file ".CONFIG_TEMPLATE_DIR."/gosa.conf"; - } else { - while(!feof($fp)) { - $str.= fread($fp,512); - } - - if($ldapconf['mail_methods'][$ldapconf['mail']]=="kolab") { - $replacements['{kolabAccount}'] ="\n "; - $replacements['{servKolab}'] =""; - } - - if($used_samba_version == 2) { - /* Do nothing for samba 2... */ - } else { - /* Create LDAP connection, to check if there's a domain - object defined in the LDAP schema */ - $ldap= new LDAP($ldapconf['admin'], $ldapconf['password'], $ldapconf['uri']); - - /* Try to find a Samba Domain Objekt */ - $ldap->search("(objectClass=sambaDomain)"); - - /* Something found ??? so we need to define ridbase an SID by ourselfs */ - if($ldap->count()< 1) { - $replacements['{SID}']= "sid=\"123412-11\""; - $replacements['{RIDBASE}']= "ridbase=\"1000\""; - } - } - - /* Data readed, types replaced, samba version detected and checked if - we need to add SID and RIDBASE. Check if there is an ivbbentry in - the LDAP tree, in this case we will set the governmentmode to true. - Create LDAP connection, to check if theres a domain Objekt definen - in the LDAP schema. */ - if(!isset($ldap)){ - $ldap= new LDAP($ldapconf['admin'], $ldapconf['password'], $ldapconf['uri']); - } - - /* Try to find a Samba Domain Objekt */ - $ldap->search("(objectClass=ivbbentry)"); - - /* Something found ??? so we need to define ridbase an SID by ourselfs */ - if($ldap->count()> 0) { - $replacements['{GOVERNMENTMODE}']= "true"; - } - - /* Replace all colleted information with placeholder */ - foreach($replacements as $key => $val) { - $str = preg_replace("/".$key."/",$val,$str); - } - - if($ldapconf['mail'] == "disabled"){ - $str = str_replace("mailMethod=\"{MAILMETHOD}\"","",$str); - } - - /* Remove all unused plugins */ - foreach(array_keys($possible_plugins) as $akey) { - if(array_key_exists($akey,$classes)) { - foreach($possible_plugins[$akey] as $key=>$val) { - $str = preg_replace($val,"\n",$str); - } - } - } - } - - return ((($str))); -} - - -/* Show setup_page 1 */ -function show_setup_page1($withoutput = true) -{ - $faults = false; - $faults2 = false; - $smarty = get_smarty(); - $smarty->assign ("content", get_template_path('setup_introduction.tpl')); - $smarty->assign ("tests", perform_php_checks($faults)); - $smarty->assign ("detailed_tests", perform_additional_function_checks($faults2)); - - $faults = $faults || $faults2; - - /* This var is true if anything went wrong */ - if ($faults){ - $smarty->assign("mode", "disabled"); - } - - /* This line displays the template only if (withoutput is set) */ - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - - if (isset($_SESSION['errors'])){ - $smarty->assign("errors", $_SESSION['errors']); - } - - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - - return ($faults); -} - - -/* Show setup_page 2 */ -function show_setup_page2($withoutput = true) -{ - $faults = false; - $smarty = get_smarty(); - $smarty->assign ("content", get_template_path('setup_step2.tpl')); - $smarty->assign ("tests", perform_additional_checks($faults)); - - if ($faults) { - $smarty->assign("mode", "disabled"); - } - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - if (isset($_SESSION['errors'])) { - $smarty->assign("errors", $_SESSION['errors']); - } - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - - return ($faults); -} - - -function show_setup_page3($withoutput = true) -{ - $ds = NULL; - $smarty = get_smarty(); - - /* Take the Post oder the Sessioin saved data */ - if(isset($_POST['uri'])){ - $uri = $_POST['uri']; - } elseif(isset($_SESSION['ldapconf']['uri'])){ - $uri = $_SESSION['ldapconf']['uri']; - } - - /* If Page called first time, field is empty */ - if((!isset($uri))||(empty($uri))){ - $uri = "ldap://localhost:389"; - } - - /* if isset $uri save it to session */ - if(isset($uri)) { - $_SESSION['ldapconf']['uri'] = $uri; - $smarty->assign ("uri", validate($uri)); - } - - /* No error till now */ - $fault = false; - - if (!$ds = @ldap_connect (validate($uri))) { - $fault =true; - - /* Output the Error */ - if($withoutput) { - print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa.")); - $smarty->assign ("uri", validate($uri)); - $smarty->assign ("content", get_template_path('setup_step3.tpl')); - } - } else { - /* Try to bind the connection */ - ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); - - /* if we can't bind , print error */ - if (!$r = @ldap_bind ($ds)) { - $fault = true; - - /* Output the Error */ - if($withoutput) { - print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa.")); - $smarty->assign ("content", get_template_path('setup_step3.tpl')); - $smarty->assign ("uri", validate($uri)); - } - } else { - $fault = false; - } - } - - $smarty->assign ("content", get_template_path('setup_step3.tpl')); - - /* Load Header */ - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - - /* Set Errors to Smarty */ - if (isset($_SESSION['errors'])) { - $smarty->assign("errors", $_SESSION['errors']); - } - - /* Print out Template */ - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - - return ($fault); -} - - -function show_setup_page4($withoutput = true) -{ - $smarty= get_smarty(); - $checkvars = array("location", "admin", "password", "peopleou", "base", - "peopledn", "arr_crypts", "uidbase","errorlvl"); - - $fault = false; - $uri = $_SESSION['ldapconf']['uri']; - $ldapconf = $_SESSION['ldapconf']; - $arr_crypts= array(); - $temp = ""; - - /* check POST data */ - if(isset($_POST['check'])) { - - /* Check if all needed vars are submitted */ - foreach($checkvars as $key) { - if($key == "peopleou"){ - continue; - } - if($key == "groupou"){ - continue; - } - - if((isset($_POST[$key]))&&(!empty($_POST[$key]))) { - $_SESSION['ldapconf'][$key] = $_POST[$key]; - } else { - if($withoutput) { - print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key)); - } - $fault = true; - } - } - } - - /* Transfer base */ - if(isset($_POST['base'])){ - $_SESSION['ldapconf']['base']= $_POST['base']; - } - - // ? - if(!isset($_SESSION['ldapconf']['base'])){ - $_SESSION['ldapconf']['base']= $base; - } - - if(!isset($_SESSION['ldapconf']['base'])){ - $_SESSION['ldapconf']['base']= $base; - } - require_once("class_password-methods.inc"); - - if(!isset($_SESSION['ldapconf']['arr_cryptkeys'])) { - require_once("class_password-methods.inc"); - $tmp= passwordMethod::get_available_methods_if_not_loaded(); - $_SESSION['ldapconf']['arr_cryptkeys']= $tmp['name']; - } - - if(!isset($_SESSION['ldapconf']['mail_methods'])) { - $_SESSION['ldapconf']['mail_methods']=array(); - $temp = get_available_mail_classes(); - $_SESSION['ldapconf']['mail_methods']= $temp['name']; - } - - /* If there are some empty vars in ldapconnect - - these values also represent out default values */ - if(!$ds = @ldap_connect (validate($uri))){ - $fault = true; - if($withoutput){ - print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa.")); - } - } elseif(!@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){ - $fault = true; - if($withoutput){ - print_red (_("Can't set ldap protocol version 3.")); - } - } elseif(!$r= @ldap_bind ($ds)){ - $fault = true; - if($withoutput){ - print_red (_("Could not bind to the specified LDAP server! Please make sure that it is reachable for GOsa.")); - } - } else { - $sr= @ldap_search ($r, NULL, "objectClass=*", array("namingContexts")); - $attr= @ldap_get_entries($ds,$sr); - - if((empty($attr))) { - - if($withoutput){ -# print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice")); - } - - } else { - $base= $attr[0]['dn']; - } - } - - if(!isset($_SESSION['ldapconf']['base'])){ - $_SESSION['ldapconf']['base']= $base; - } - if(!isset($_SESSION['ldapconf']['admin'])){ - $_SESSION['ldapconf']['admin']= "cn=ldapadmin,".$base; - } - if(!isset($_SESSION['ldapconf']['peopleou'])){ - $_SESSION['ldapconf']['peopleou']= "ou=people"; - } - if(!isset($_SESSION['ldapconf']['groupou'])){ - $_SESSION['ldapconf']['groupou']= "ou=groups"; - } - if(!isset($_SESSION['ldapconf']['peopledn'])){ - $_SESSION['ldapconf']['peopledn']= "cn"; - } - if(!isset($_SESSION['ldapconf']['password'])){ - $_SESSION['ldapconf']['password']= ""; - } - if(!isset($_SESSION['ldapconf']['location'])){ - $_SESSION['ldapconf']['location']= "Example"; - } - if(!isset($_SESSION['ldapconf']['uidbase'])){ - $_SESSION['ldapconf']['uidbase']= "1000"; - } - if(!isset($_SESSION['ldapconf']['mail'])){ - $_SESSION['ldapconf']['mail']= 0; - } - if(!isset($_SESSION['ldapconf']['follow_referrals'])){ - $_SESSION['ldapconf']['follow_referrals']= FALSE; - } - if(!isset($_SESSION['ldapconf']['tls'])){ - $_SESSION['ldapconf']['tls']= FALSE; - } - - $tmp= array_flip($_SESSION['ldapconf']['arr_cryptkeys']); - if(!isset($_SESSION['ldapconf']['arr_crypts'])){ - $_SESSION['ldapconf']['arr_crypts'] = $tmp['md5']; - } - - $smarty->assign("arr_cryptkeys",$_SESSION['ldapconf']['arr_cryptkeys']); - $smarty->assign("mail_methods", $_SESSION['ldapconf']['mail_methods']); - - foreach($_SESSION['ldapconf'] as $key => $val) { - $smarty->assign($key,$val); - } - - if(isset($_POST['check']) || (isset($_POST['admin'])) && isset($_POST['password'])) { - $ldap= new LDAP($_SESSION['ldapconf']['admin'], - $_SESSION['ldapconf']['password'], - $_SESSION['ldapconf']['uri'], - $_SESSION['ldapconf']['follow_referrals'], - $_SESSION['ldapconf']['tls']); - - $m= schema_check($_SESSION['ldapconf']['uri'], - $_SESSION['ldapconf']['admin'], - $_SESSION['ldapconf']['password'], - $_SESSION['ldapconf']['follow_referrals'], - $_SESSION['ldapconf']['tls']); - - $_SESSION['classes']= $m; - - //TODO: Ask user for referrals and TLS config options during setup. They are initialized to false at the moment: - $ldapconf['follow_referrals'] = false; - $ldapconf['tls'] = false; - if(!is_schema_readable($ldapconf['uri'], $ldapconf['admin'], $ldapconf['password'], $ldapconf['follow_referrals'], $ldapconf['tls'])){ - if($withoutput){ - print_red(_("Can't read schema informations, GOsa needs to know your schema setup. Please verify that it is readable for GOsa")); - } - $fault=true; - } - - - - if ($ldap->error != "Success") { - if($withoutput) { - print_red(sprintf(_("Can't log into LDAP server. Reason was: %s."), $ldap->get_error())); - } - $fault = true; - } - } - - /* Set smarty output */ - $smarty->assign ("content", get_template_path('setup_step4.tpl')); - $smarty->assign ("peopledns", array("cn", "uid")); - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - if(isset($_SESSION['errors'])) { - $smarty->assign("errors", $_SESSION['errors']); - } - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - - return ($fault); -} - - -function show_setup_page5($withoutput=true) -{ - /* Get ldapconf */ - $ldapconf= $_SESSION['ldapconf']; - - /* get smarty */ - $smarty = get_smarty(); - - if(isset($_SESSION['classes'])){ - $classes = $_SESSION['classes']; - } - - $info= posix_getgrgid(posix_getgid()); - $smarty->assign("webgroup", $info['name']); - $smarty->assign("path", CONFIG_DIR); - $message= ""; - - //TODO:Ask user for referral and TLS config options during setup. They are initialized to false at the moment: - $ldapconf['follow_referrals'] = false; - $ldapconf['tls'] = false; - - $m= schema_check($ldapconf['uri'], $ldapconf['admin'], $ldapconf['password'], $ldapconf['follow_referrals'], $ldapconf['tls'], 1); - - if($withoutput) { - $smarty->assign ("schemas", view_schema_check($m)); - $smarty->assign ("content", get_template_path('setup_finish.tpl')); - } - - /* Output templates... */ - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - if (isset($_SESSION['errors'])) { - $smarty->assign("errors", $_SESSION['errors']); - } - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - - return(true); -} - - -function create_user_for_setup($withoutput=true) -{ - global $samba; - - $ldapconf = $_SESSION['ldapconf']; - $smarty = get_smarty(); - - $need_to_create_group = false; - $need_to_create_user = false; - - $str_there=""; - - if(isset($_SESSION['classes'])){ - $classes= $_SESSION['classes']; - } - - /* Everything runns perfect ... - So we do a last test on this page - is there a user with ACLs :all which will be able to adminsitrate GOsa - We check that, if this user or group is missing we ask for creating them */ - $ldap= new LDAP($_SESSION['ldapconf']['admin'], $_SESSION['ldapconf']['password'], $_SESSION['ldapconf']['uri']); - - /* Now we are testing for a group, with the rights :all */ - $ldap->cd($ldapconf['base']); - $ldap->search("(&(objectClass=gosaObject)(gosaSubtreeACL=:all))"); - - $group_cnt = $ldap->count(); - $data = $ldap->fetch(); - - /* We need to create administrative user and group because there was no group found */ - if($group_cnt < 1) { - - $need_to_create_group = true; - $need_to_create_user = true; - - /* Output error */ -# if(($withoutput)&&(!isset($_POST['new_admin']))){ -# print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!")); -# } - } else { - - $need_to_create_group = false; - $ldap->clearResult(); - - /* We found an Administrative Group, is there a user too ? */ - if(isset($data['memberUid'][0])) { - $str = "uid=".$data['memberUid']['0']; - $ldap->search("(&(objectClass=gosaAccount)(objectClass=person)(".$str."))"); - $data2 = $ldap->fetch(); - - /* We must create a user */ - if (($ldap->count() < 1)||(!isset($data2))) { - $need_to_create_user = true; -# if(($withoutput)&&(!isset($_POST['new_admin']))){ -# print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!")); -# } - }else { - $need_to_create_user = false; - } - } else { - $need_to_create_user=true; -# if(($withoutput)&&(!isset($_POST['new_admin']))){ -# print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!")); -# } - } - } - - if(!($need_to_create_user&&$need_to_create_group)) - return(true); - - /* We need to create a new user with group */ - if(isset($_POST['new_admin'])) - { - - /* Adjust password attributes according to the samba version */ - if (isset($classes['samba3'])) { - $samba= "2"; - $lmPassword = "lmPassword"; - $ntPassword = "ntPassword"; - } else { - $samba= "3"; - $lmPassword = "sambaLMPassword"; - $ntPassword = "sambaNtPassword"; - } - - /* Nothing submitted */ - if(((empty($_POST['admin_name']))||(empty($_POST['admin_pass'])))) { - return(true); - } - - if($need_to_create_user) { - /* We have the order to create an Admin */ - /* Define the user we are going to create */ - $dn= "cn=".$_POST['admin_name'].",".$ldapconf['peopleou'].",".$ldapconf['base']; - $arr['objectClass'][0] ="person"; - $arr['objectClass'][1] ="organizationalPerson"; - $arr['objectClass'][2] ="inetOrgPerson"; - $arr['objectClass'][3] ="gosaAccount"; - $arr['uid'] = $_POST['admin_name']; - $arr['cn'] = $_POST['admin_name']; - $arr['sn'] = $_POST['admin_name']; - $arr['givenName'] = "GOsa main administrator"; - $arr[$lmPassword] = "10974C6EFC0AEE1917306D272A9441BB"; - $arr[$ntPassword] = "38F3951141D0F71A039CFA9D1EC06378"; - $arr['userPassword'] = crypt_single($_POST['admin_pass'],"md5"); - - - if(!$ldap->dn_exists($dn)){ - $ldap->cd($dn); - $ldap->create_missing_trees($dn); - $ldap->cd($dn); - $ldap->add($arr); - if($ldap->error!="Success"){ - show_ldap_error($ldap->get_error(),_("User and/or group could not be created, please check your configuration twice !")); - } - } - } - - /* There's already a group for administrator, so we only need to add the user */ - if(!$need_to_create_group) { - if(!isset($data['memberUid'])) { - $arrr['memberUid']= $_POST['admin_name']; - } else { - $data['memberUid'][$data['memberUid']['count']]=$_POST['admin_name']; - $arrr['memberUid'] = $data['memberUid']; - unset($arrr['memberUid']['count']); - - $tmp = array_reverse($arrr['memberUid']); - foreach($tmp as $tt){ - $tmp2[]=$tt; - } - $arrr['memberUid']= $tmp2; -// $str_there="Group found
".$data['dn']; - } - - $ldap->cd($data['dn']); - $ldap->modify($arrr); - - } else { - $dn = "cn=administrators,".$ldapconf['groupou'].",".$ldapconf['base']; - $arrr['objectClass'][0]= "gosaObject"; - $arrr['objectClass'][1]= "posixGroup"; - $arrr['gosaSubtreeACL']= ":all"; - $arrr['cn'] = "administrators"; - $arrr['gidNumber'] = "999"; - $arrr['memberUid'] = $_POST['admin_name']; - - $ldap->cd($dn); - $ldap->create_missing_trees($dn); - $ldap->cd($dn); - - $ldap->add($arrr); - } - return(true); - } else { - - if((!isset($need_to_create_user))||(!($need_to_create_user))) { - $smarty->assign ("content", get_template_path('setup_useradmin.tpl')); - $smarty->assign("exists",true); - } else { - $smarty->assign ("content", get_template_path('setup_useradmin.tpl')); - $smarty->assign("exists",false); - } - - } - - /* Smarty output */ - if($withoutput){ - $smarty->display (get_template_path('headers.tpl')); - } - if (isset($_SESSION['errors'])) { - $smarty->assign("errors", $_SESSION['errors']); - } - $smarty->assign("str_there",$str_there); - if($withoutput){ - $smarty->display (get_template_path('setup.tpl')); - } - return(false); -} - - -/* Returns the classnames auf the mail classes */ -function get_available_mail_classes() -{ - $dir = opendir( "../include"); - $methods = array(); - $suffix = "class_mail-methods-"; - $lensuf = strlen($suffix); - $prefix = ".inc"; - $lenpre = strlen($prefix); - - $i = 0; - while (($file = readdir($dir)) !== false){ - - if(stristr($file,$suffix)) { - $lenfile = strlen($file); - $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); - $methods['file'][$i] = $file; - $methods[$i]['file'] = $file; - $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); - $i++; - } - - } - - return($methods); -} - -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/setup/class_setup.inc b/setup/class_setup.inc new file mode 100644 index 000000000..d93dada1d --- /dev/null +++ b/setup/class_setup.inc @@ -0,0 +1,320 @@ +o_steps[$i++] = new Step_Welcome(); + $this->o_steps[$i++] = new Step_Language(); + $this->o_steps[$i++] = new Step_Checks(); + $this->o_steps[$i++] = new Step_License(); + $this->o_steps[$i++] = new Step_Ldap(); + $this->o_steps[$i++] = new Step_Schema(); + $this->o_steps[$i++] = new Step_Config1(); + $this->o_steps[$i++] = new Step_Config2(); + $this->o_steps[$i++] = new Step_Config3(); + $this->o_steps[$i++] = new Step_Migrate(); + $this->o_steps[$i++] = new Step_Feedback(); + $this->o_steps[$i++] = new Step_Finish(); + $this->i_steps = $i-1; + + /* Ensure that setup is not reachable if gosa.conf (CONFIG_FILE) */ + if(file_exists(CONFIG_DIR."/".CONFIG_FILE)){ + session_destroy(); + header("Location: index.php") ; + exit(); + } + + foreach($this->o_steps as $key => $step){ + $this->o_steps[$key]->parent = $this; + } + } + + function execute() + { + /* Display phpinfo() dialog when $_GET['info'] is set, + * but only do this, if user is allowed to use the setup. + * If setupStep_Welcome is_completed, we are allowed to view those infos- + */ + if(isset($_GET['info']) && get_class($this->o_steps[1]) == "Step_Welcome" && $this->o_steps[1]->is_completed()){ + phpinfo(); + exit(); + } + + /* display step error msgs */ + $msgs = $this->o_steps[$this->i_current]->check(); + foreach($msgs as $msg){ + print_red($msg); + } + + $this->o_steps[$this->i_last]->set_active(FALSE); + $this->o_steps[$this->i_current]->set_active(); + $content = $this->o_steps[$this->i_current]->execute(); + return($content); + } + + + /* Save posted attributes */ + function save_object() + { + /* Call save_object for current setup step */ + $this->o_steps[$this->i_current] -> save_object(); + + /* Get attributes from setup step */ + $tmp = $this->o_steps[$this->i_current]->get_attributes(); + foreach($tmp as $name => $value){ + $this->captured_values[$name] = $value; + } + + /* Set parent */ + foreach($this->o_steps as $key => $value){ + $this->o_steps[$key]->parent = $this; + } + + /* Check if image button requests next page */ + foreach($_POST as $name => $value){ + if(preg_match("/^next_(x|y)/",$name)){ + $_POST['next'] = TRUE; + } + if(preg_match("/^last_(x|y)/",$name)){ + $_POST['last'] = TRUE; + } + } + + /* Check if step was selected */ + if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){ + + /* check if current setup step is completed now + and activate the next step if possible */ + for($i = 1 ; $i <= $this->i_steps ; $i ++ ){ + if($this->o_steps[$i]->is_completed()){ + if(isset($this->o_steps[($i+1)])){ + $this->o_steps[($i+1)]->set_enabled(); + } + }else{ + $this->disable_steps_from($i+1); + } + } + } + + /* Disable all following steps, if one step isn't compelted right now .*/ + for($i = 1 ; $i <= $this->i_steps ; $i ++ ){ + if($this->o_steps[$i]->is_completed()){ + }else{ + $this->disable_steps_from($i+1); + } + } + + $step = -1; + + if(isset($_POST['setup_goto_step'])){ + $step= $_POST['setup_goto_step']; + } + + if(isset($_GET['step'])){ + $step = $_GET['step']; + }elseif(isset($_POST['next'])){ + $step = $this->i_current + 1; + }elseif(isset($_POST['last'])){ + $step = $this->i_current - 1; + } + + $once = true; + foreach($_POST as $name => $value){ + if(preg_match("/^step_[0-9]*$/",$name) && $once ){ + $step = preg_replace("/^step_/","",$name); + } + } + + if($this->selectable_step($step)){ + $this->i_last = $this->i_current; + $this->i_current = $step; + } + } + + + function disable_steps_from($start) + { + $found = false; + foreach($this->o_steps as $key => $step){ + if($key == $start){ + $found = true; + } + + if($found){ + $this->o_steps[$key]->set_enabled(false); + $this->o_steps[$key]->set_completed(false); + } + } + } + + + /* Create navigation menu */ + function get_navigation_html() + { + $str = ""; + foreach($this->o_steps as $key => $step){ + + $step -> update_strings(); + + $s_title = $step -> get_title(); + $s_info = $step -> get_small_info(); + $b_active = $step -> is_active(); + $b_enabled = $step -> is_enabled(); + $b_completed= $step -> is_completed(); + + if($b_completed){ + $s = ""._("Completed")." "; + }else{ + $s = "  "; + } + + if($_SESSION['js']){ + + $str .="
"; + + if($b_enabled){ + if($b_active){ + $str .= ""; + }else{ + $str .= ""; + } + }else{ + $str .= ""; + } + $str .= "
" ; + }else{ + $str .="
"; + if($b_enabled){ + if($b_active){ + $str .= ""; + }else{ + $str .= ""; + } + }else{ + $str .= ""; + } + $str .= "
" ; + } + } + return($str); + } + + + + function get_bottom_html() + { + /* Skip adding forward/backward button, + * if the currently opened step is a sub dialog + */ + if($this->o_steps[$this->i_current]->dialog){ + $str =""; + }else{ + $str ="

 

"; + $str.="
"; + if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){ + $str .= ""; + }else{ + $str .= ""; + } + $str.= " "; + $str .= ""; + $str .="
"; + } + return($str); + } + + + /* Create header entry */ + function get_header_html() + { + $str= $this->o_steps[$this->i_current]->print_header(); + return ($str); + } + + + /* Check if the given step id is valid and selectable */ + function selectable_step($id) + { + if(isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()){ + return(true); + } + return(false); + } + + function step_name_to_id($name) + { + foreach($this->o_steps as $id => $class){ + if(get_class($class) == $name){ + return($id); + } + } + return(0); + } + +} + + + + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc new file mode 100644 index 000000000..5364187e4 --- /dev/null +++ b/setup/class_setupStep.inc @@ -0,0 +1,130 @@ +s_title); + } + + function get_long_title() + { + return($this->s_title_long); + } + + function get_small_info() + { + return($this->s_info); + } + + function is_active() + { + return($this->is_active); + } + + function is_enabled() + { + return($this->is_enabled); + } + + function is_completed() + { + return($this->is_completed); + } + + function set_active($value = TRUE) + { + if($value){ + $this->is_active = TRUE; + }else{ + $this->is_active = FALSE; + } + } + + function set_enabled($value = TRUE) + { + if($value){ + $this->is_enabled = TRUE; + }else{ + $this->is_enabled = FALSE; + } + } + + function set_completed($value = TRUE) + { + if($value){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = FALSE; + } + } + + /* Return attributes handled by this setup step */ + function get_attributes() + { + $tmp = array(); + foreach($this->attributes as $attr){ + $tmp[$attr] = $this->$attr; + } + return($tmp); + } + + function print_header() + { + $image= get_template_path($this->header_image); + $display= "
"; + $display.= "

\"*\" ".$this->s_title_long."

\n"; + $display.= "
\n"; + + return($display); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Checks.inc b/setup/class_setupStep_Checks.inc new file mode 100644 index 000000000..366ab1b2e --- /dev/null +++ b/setup/class_setupStep_Checks.inc @@ -0,0 +1,318 @@ +update_strings(); + } + + + function update_strings() + { + $this->s_title = _("Installation check"); + $this->s_title_long = _("Installation check"); + $this->s_info = _("Basic checks for PHP version and required extensions."); + } + + + /* Execute and display template */ + function execute() + { + $this->run_checks(); + $smarty = get_smarty(); + $smarty->assign("basic" ,$this->basic_checks); + $smarty->assign("config" ,$this->config_checks); + $smarty->assign("is_writeable",$this->is_writeable); + return($smarty->fetch(get_template_path("setup_checks.tpl",TRUE,dirname(__FILE__)))); + } + + + /* Execute all checks */ + function run_checks() + { + $this->basic_checks = array(); + $this->config_checks = array(); + $this->is_writeable = array(); + + /* PHP version check */ + $N = _("Checking PHP version"); + $D = sprintf(_("PHP must be of version %s / %s or above."),"4.3.10","5.2.0"); + $S = _("GOsa requires functionality that is not available (or buggy) in older PHP versions. Please update to a supported version."); + $R = $this->check_php_version(); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checking imap extension */ + $N = _("Checking for LDAP support"); + $D = _("This is the main extension used by GOsa and therefore really required."); + $S = _("The ldap extension (php4-ldap/php5-ldap) is required to communicate with your LDAP server."); + $R = is_callable("ldap_bind"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Check for gettext support */ + $N = _("Checking for gettext support"); + $D = _("Gettext support is required for internationalization."); + $S = _("Please make sure that the extension is activated."); + $R = is_callable("bindtextdomain"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checing for iconv */ + $N = _("Checking for iconv support"); + $D = _("This module is used by GOsa to convert samba munged dial informations and is therefore required. "); + $S = _("Please make sure that the extension is activated."); + $R = is_callable("iconv"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Check for installed mhash module */ + $N = _("Checking for mhash support"); + $D = _("You'll need this module to make use of SSHA encryption"); + $S = _("The mhash module for PHP 4/5 is not available.Please install php4-mhash/php5-mhash."); + $R = is_callable("mhash"); + $M = FALSE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Is imap module available */ + $N = _("Checking for IMAP support"); + $D = _("The IMAP module is needed to communicate with the IMAP server. GOsa retrieves status information, creates and deletes mail users, etc."); + $S = _("This module is used to communicate with your mail server. Please install php4-imap/php5-imap."); + $R = is_callable("imap_open"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Check getacl in imap module */ + $N = _("Checking for getacl in IMAP implementation"); + $D = _("The getacl support is needed to handle shared folder permissions. Old IMAP extensions are not capable of reading acl's. You need a recent PHP version to use this feature."); + $S = $D; + $R = is_callable("imap_getacl"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Mysql module loaded ? */ + $N = _("Checking for MySQL support"); + $D = _("MySQL support is needed to communicate with several supported databases."); + $S = _("This module is required to communicate with database servers (GOfax, asterisk, GLPI, etc.). Please install php4-mysql/php5-mysql"); + $R = is_callable("mysql_query"); + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checking for kadm5 module */ + $N = _("Checking for kadm5 support"); + $D = _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network."); + $S = _("This module is required to manage user in kerberos, it is downloadable via PEAR network"); + $R = is_callable("kadm5_init_with_password"); + $M = FALSE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Snmp module available ? */ + $N = _("Checking for SNMP support"); + $D = _("The simple network management protocol is needed to get status information from clients."); + $S = _("This module is required for client monitoring. Please install php4-snmp/php5-snmp."); + $R = is_callable("snmpget"); + $M = FALSE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checking for Cups module */ + $N = _("Checking for CUPS support"); + $D = _("In order to read available printers via the IPP protocol instead of printcap files, you've to install the CUPS module."); + $S = $D; + $R = is_callable("cups_get_dest_list"); + $M = FALSE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checking for F ping utility */ + $query= "LC_ALL=C LANG=C fping -v 2>&1"; + $output= shell_exec ($query); + $N = _("Checking for fping utility"); + $D = _("The fping utility is used if you've got a thin client based terminal environment."); + $S = _("The fping utility is only used in thin client based terminal environment."); + $R = preg_match("/^fping:/", $output); + $M = FALSE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Checking generate LM/NT password hashes */ + $query= "mkntpwd 2>&1"; + $output= shell_exec ($query); + $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output); + if (!$have_mkntpwd){ + $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen $ARGV[0]), $/;" &>/dev/null'; + system ($query, $ret); + $have_mkntpwd |= ($ret == 0); + } + + $N = _("SAMBA password hash generation"); + $D = _("In order to use SAMBA 2/3 passwords, you've to install additional packages to generate password hashes."); + $S = _("In order to use SAMBA 2/3 you've to install additional perl libraries. Take a look at mkntpasswd."); + $R = $have_mkntpwd; + $M = TRUE; + $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + + /* PHP Configuration checks + */ + + /* Register_globals off */ + $N = "register_globals = "._("Off").""; + $D = _("register_globals is a PHP mechanism to register all global variables to be accessible from scripts without changing the scope. This may be a security risk."); + $S = _("Search for 'register_globals' in your php.ini and switch it to 'Off'."); + $R = ini_get("register_globals") == 0; + $M = FALSE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + + /* session lifetime set to >=86400 seconds ? */ + $N = "session.gc_maxlifetime >= 86400"; + $D = _("PHP uses this value for the garbage collector to delete old sessions.")." ". + _("Setting this value to one day will prevent loosing session and cookies before they really timeout."); + $S = _("Search for 'session.gc_maxlifetime' in your php.ini and set it to 86400 or higher."); + $R = ini_get("session.gc_maxlifetime") >= 86400; + $M = FALSE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Session auto start must be turned off */ + $session_auto_start = ini_get('session.auto_start'); + $N = "session.auto_start = "._("Off").""; + $D = _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini should be set to 'Off'."); + $S = _("Search for 'session.auto_start' in your php.ini and set it to 'Off'."); + $R = !$session_auto_start['local_value']; + $M = TRUE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Check if memory limit is set to 32 or > */ + $N = "memory_limit >= 32"; + $D = _("GOsa needs at least 32MB of memory. Setting it below this limit may cause errors that are not reproducable! Increase it for larger setups."); + $S = _("Search for 'memory_limit' in your php.ini and set it to '32M' or higher."); + $R = ini_get('memory_limit') >= 32 ; + $M = TRUE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Implicit Flush disabled can increase performance */ + $N = "implicit_flush = "._("Off").""; + $D = _("This option influences the PHP output handling. Turn this Option off, to increase performance."); + $S = _("Search for 'implicit_flush' in your php.ini and set it to 'Off'."); + $R = ini_get('implicit_flush'); + $M = FALSE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Check if execution time is set to 30 */ + $N = "max_execution_time >= 30"; + $D = _("The Execution time should be at least 30 seconds."); + $S = _("Search for 'max_execution_time' in your php.ini and set it to '30' or higher."); + $R = ini_get("max_execution_time") >= 30 ; + $M = TRUE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Expose php should be set to off */ + $N = "expose_php = "._("Off").""; + $D = _("Increase the server security by setting expose_php to 'off'. PHP won't send any information about the server you are running in this case."); + $S = _("Search for 'expose_php' in your php.ini and set if to 'Off'."); + $R = !ini_get("expose_php"); + $M = FALSE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Automatic quoting must be turned on */ + $N = "magic_quotes_gpc = "._("On").""; + $D = _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."); + $S = _("Search for 'magic_quotes_gpc' in your php.ini and set it to 'On'."); + $R = ini_get('magic_quotes_gpc'); + $M = TRUE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* Emulating old stuff? */ + if (!preg_match('/^4/', phpversion())){ + $N = "zend.ze1_compatibility_mode = "._("Off").""; + $D = _("Increase your server performance by setting magic_quotes_gpc to 'off'."); + $S = _("Search for 'zend.ze1_compatibility_mode' in your php.ini and set it to 'Off'."); + $R = !ini_get('zend.ze1_compatibility_mode'); + $M = FALSE; + $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + } + + + /* Configuration file + */ + + /* Check if we can create a config file.*/ + $N = _("Configuration writeable"); + $D = _("The configuration file can't be written"); + $S = sprintf(_("GOsa reads its configuration from a file located in (%s/%s). The setup can write the configuration directly if it is writeable."),CONFIG_DIR,CONFIG_FILE); + $R = ( file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)) // is there a config file ? + || (!file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR)); // There is non, but can we create a file there ? + $M = FALSE; + $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); + + /* If we have writeaccess to the config dir, check if there is already a config file */ +# if($R){ +# +# /* check if there is already a config file. */ +# $N = _("No old configuration file."); +# $D = "";//_(""); +# $S = _("If there is already a configuration file, this file will be overwritten when GOsa setup finishes. Please move your old config file away."); +# $R = !file_exists(CONFIG_DIR."/".CONFIG_FILE); +# $M = FALSE; +# $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M ); +# } + } + + + function save_object() + { + /* If everything is fine, set this step to completed + * and allow switching to next setup step + */ + $failed = false; + foreach(array("basic_checks","config_checks","is_writeable") as $type){ + foreach($this->$type as $obj){ + + if($obj['MUST'] && !$obj['RESULT']){ + $failed = true; + break; + } + } + } + $this->is_completed = !$failed; + } + + + /* Check if current PHP version is compatible + with the current version of GOsa */ + function check_php_version() + { + if(preg_match("/^5/",phpversion())){ + return(version_compare(phpversion(),"5.2.0",">=")); + }else{ + return(version_compare(phpversion(),"4.3.10",">=")); + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Config1.inc b/setup/class_setupStep_Config1.inc new file mode 100644 index 000000000..a1e9c0b6b --- /dev/null +++ b/setup/class_setupStep_Config1.inc @@ -0,0 +1,244 @@ + 6, + "pwminlen_active" => FALSE, + "pwdiffer" => 5, + "pwdiffer_active" => FALSE, + "externalpwdhook" => "", + "externalpwdhook_active" => FALSE); + + var $id_settings = array( "idgen" => "{%sn}-{%givenName[2-4]}", + "idgen_active" => FALSE, + "minid" => "100", + "minid_active" => FALSE); + + var $crypt_methods = array(); + + var $attributes = array("peopleou","groupou","peopledn","uidbase","encryption","theme","krbsasl", + "base_hook","base_hook_active","account_expiration","strict","include_personal_title"); + + function Step_Config1() + { + $this->update_strings(); + + $tmp = @passwordMethod::get_available_methods_if_not_loaded(); + foreach($tmp['name'] as $name){ + $this->crypt_methods[$name] = $name; + } + } + + + function update_strings() + { + $this->s_title = _("GOsa settings 1/3"); + $this->s_title_long = _("GOsa settings 1/3"); + $this->s_info = _("GOsa generic settings"); + } + + + function execute() + { + $smarty = get_smarty(); + $smarty->assign("peopledns",array("uid","cn")); + $smarty->assign("id_settings",$this->id_settings); + $smarty->assign("crypt_methods",$this->crypt_methods); + $smarty->assign("themes",$this->get_themes()); + $smarty->assign("pwd_rules",$this->pwd_rules); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + + /* !!! Attention strict is inverse. If you change this, + * don't forget to change save_object too + */ + $smarty->assign("strict",!$this->strict); + return($smarty -> fetch (get_template_path("../setup/setup_config1.tpl"))); + } + + + function get_themes() + { + $dir = opendir( "../ihtml/themes/"); + $themes = array(); + while (($file = readdir($dir)) !== false){ + if(is_dir("../ihtml/themes/".$file) && !preg_match("/^\./",$file)){ + $themes[$file] = $file; + } + } + return($themes); + } + + function check() + { + $message = array(); + + if(isset($this->id_settings['minid_active']) && !is_numeric($this->id_settings['minid'])){ + $message[] = sprintf(_("The specified value for '%s' must be a numeric value"),_("GID / UID min id")); + } + + if(preg_match("/,$/",$this->peopleou)){ + $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("People storage ou")); + } + + if(preg_match("/,$/",$this->groupou)){ + $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("Group storage ou")); + } + + if(!is_numeric($this->uidbase)){ + $message[] = _("Uid base must be numeric"); + } + + if(($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])){ + $message[] = _("The given password minimum length is not numeric."); + } + if(($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])){ + $message[] = _("The given password differ value is not numeric."); + } + return($message); + } + + function save_object() + { + if(isset($_POST['step5_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate(get_post($attr)); + } + } + + /* !!! Attention strict is inverse. If you change this, + * don't forget to change the smarty assignment too + */ + if(isset($_POST['strict'])){ + if($_POST['strict']){ + $this->strict = FALSE; + }else{ + $this->strict = TRUE; + } + } + + if(isset($_POST['minid_active'])){ + $this->id_settings['minid_active'] = TRUE; + if(isset($_POST['minid'])){ + $this->id_settings['minid'] = get_post('minid'); + } + }else{ + $this->id_settings['minid_active'] = FALSE; + } + + /* Generic settings */ + if(isset($_POST['idgen_active'])){ + $this->id_settings['idgen_active'] = TRUE; + if(isset($_POST['idgen'])){ + $this->id_settings['idgen'] = get_post('idgen'); + } + }else{ + $this->id_settings['idgen_active'] = FALSE; + } + + /* Get password settings */ + if(isset($_POST['pwdiffer_active'])){ + $this->pwd_rules['pwdiffer_active'] = TRUE; + if(isset($_POST['pwdiffer'])){ + $this->pwd_rules['pwdiffer'] = get_post('pwdiffer'); + } + }else{ + $this->pwd_rules['pwdiffer_active'] = FALSE; + } + + /* Get password minimum length posts */ + if(isset($_POST['pwminlen_active'])){ + $this->pwd_rules['pwminlen_active'] = TRUE; + if(isset($_POST['pwminlen'])){ + $this->pwd_rules['pwminlen'] = get_post('pwminlen'); + } + }else{ + $this->pwd_rules['pwminlen_active'] = FALSE; + } + + /* External pwd settings */ + if(isset($_POST['externalpwdhook_active'])){ + $this->pwd_rules['externalpwdhook_active'] = TRUE; + if(isset($_POST['externalpwdhook'])){ + $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook'); + } + }else{ + $this->pwd_rules['externalpwdhook_active'] = FALSE; + } + + /* base hook settings */ + if(isset($_POST['base_hook_active'])){ + $this->pwd_rules['base_hook_active'] = TRUE; + if(isset($_POST['base_hook'])){ + $this->pwd_rules['base_hook'] = get_post('base_hook'); + } + }else{ + $this->pwd_rules['base_hook_active'] = FALSE; + } + } + + $tmp = $this->check(); + if(count($tmp) == 0){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = FALSE; + } + }// if tempalte posted + + + /* Attributes that are interesting for configuration generation */ + function get_attributes() + { + $tmp = setup_step::get_attributes(); + foreach(array("pwd_rules","id_settings") as $attr){ + $tmp[$attr]= $this->$attr; + } + return($tmp); + } +}// CLass + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc new file mode 100644 index 000000000..d238af045 --- /dev/null +++ b/setup/class_setupStep_Config2.inc @@ -0,0 +1,268 @@ + "/etc/gosa/vacation", + "vacationdir_active" => FALSE); + + var $generic_settings = array( "enableCopyPaste" => false, + "wws_ou" => "ou=winstations", + "wws_ou_active" => FALSE, + "snapshot_active" => FALSE, + "snapshot_base" => "ou=snapshots,%base%", + "snapshot_user" => "%admin%", + "snapshot_password" => "", + "snapshot_server" => "%connection%"); + + var $samba_settings = array( "samba_sid" => "0-815-4711", + "samba_sid_active" => FALSE, + "samba_rid" => 1000, + "smbhash" => 'SMBHASH', + "samba_rid_active" => FALSE); + + var $sambaDomain_found = FALSE; + + var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail"); + var $called = FALSE; + + + function Step_Config2() + { + $this->update_strings(); + $tmp = $this->get_available_mail_classes(); + foreach($tmp['name'] as $name){ + $this->mail_methods[$name] = $name; + } + + /* Look for samba password generation method */ + if(file_exists("/usr/bin/mkntpasswd")){ + $pwdhash = "/usr/bin/mkntpasswd"; + } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){ + $pwdhash= "mkntpwd"; + } else { + $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"'; + } + + $this->samba_settings['smbhash'] = $pwdhash; + } + + + function update_strings() + { + $this->s_title = _("GOsa settings 2/3"); + $this->s_title_long = _("GOsa settings 2/3"); + $this->s_info = _("Customize special parameters"); + } + + + function execute() + { + /* On first call check for rid/sid base */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(objectClass=sambaDomain)",array("dn")); + if($ldap->count()){ + $this->sambaDomain_found =TRUE; + }else{ + $this->sambaDomain_found =FALSE; + } + + if(!$this->called){ + if(!$this->sambaDomain_found){ + $this->samba_settings['samba_sid_active'] = TRUE; + $this->samba_settings['samba_rid_active'] = TRUE; + } + + $this->called = TRUE; + } + + /* Update snapshot values, with already collected values */ + foreach($this->generic_settings as $key => $value){ + foreach(array("snapshot_base","snapshot_user","snapshot_server") as $attr){ + foreach($this->parent->captured_values as $replace_name => $replace_value){ + if(is_string($replace_value)) { + $this->generic_settings[$attr] = preg_replace("/%".$replace_name."%/",$replace_value,$this->generic_settings[$attr]); + } + } + } + } + + $smarty = get_smarty(); + $smarty->assign("sambaDomain_found",$this->sambaDomain_found); + $smarty->assign("generic_settings",$this->generic_settings); + $smarty->assign("mail_settings",$this->mail_settings); + $smarty->assign("mail_methods",$this->mail_methods); + $smarty->assign("samba_settings",$this->samba_settings); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty -> fetch (get_template_path("../setup/setup_config2.tpl"))); + } + + function save_object() + { + if(isset($_POST['step6_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate(get_post($attr)); + } + } + + /* Mail settings */ + if(isset($_POST['vacationdir_active'])){ + $this->mail_settings['vacationdir_active'] = TRUE; + if(isset($_POST['vacationdir'])){ + $this->mail_settings['vacationdir'] = get_post('vacationdir'); + } + }else{ + $this->mail_settings['vacationdir_active'] = FALSE; + } + + if(isset($_POST['enableCopyPaste'])){ + $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste'); + } + + if(isset($_POST['wws_ou_active'])){ + $this->generic_settings['wws_ou_active'] = TRUE; + if(isset($_POST['wws_ou'])){ + $this->generic_settings['wws_ou'] = get_post('wws_ou'); + } + }else{ + $this->generic_settings['wws_ou_active'] = FALSE; + } + + if(isset($_POST['snapshot_active'])){ + $this->generic_settings['snapshot_active'] = TRUE; + if(isset($_POST['snapshot_base'])){ + $this->generic_settings['snapshot_base'] = get_post('snapshot_base'); + } + if(isset($_POST['snapshot_user'])){ + $this->generic_settings['snapshot_user'] = get_post('snapshot_user'); + } + if(isset($_POST['snapshot_password'])){ + $this->generic_settings['snapshot_password'] = get_post('snapshot_password'); + } + if(isset($_POST['snapshot_server'])){ + $this->generic_settings['snapshot_server'] = get_post('snapshot_server'); + } + }else{ + $this->generic_settings['snapshot_active'] = FALSE; + } + + /* Samba settings */ + if(isset($_POST['samba_sid_active'])){ + $this->samba_settings['samba_sid_active'] = TRUE; + if(isset($_POST['samba_sid'])){ + $this->samba_settings['samba_sid'] = get_post('samba_sid'); + } + }else{ + $this->samba_settings['samba_sid_active'] = FALSE; + } + if(isset($_POST['samba_rid_active'])){ + $this->samba_settings['samba_rid_active'] = TRUE; + if(isset($_POST['samba_rid'])){ + $this->samba_settings['samba_rid'] = get_post('samba_rid'); + } + }else{ + $this->samba_settings['samba_rid_active'] = FALSE; + } + if(isset($_POST['smbhash'])){ + $this->samba_settings['smbhash'] = get_post('smbhash'); + } + + if(!$this->sambaDomain_found){ + $this->samba_settings['samba_sid_active'] = TRUE; + $this->samba_settings['samba_rid_active'] = TRUE; + } + } + + $tmp = $this->check(); + if(count($tmp) == 0){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = FALSE; + } + } + + + function check() + { + $message = array(); + return($message); + } + + + /* Attributes that are interesting for configuration generation */ + function get_attributes() + { + $tmp = setup_step::get_attributes(); + foreach(array("samba_settings","generic_settings","mail_settings") as $attr){ + $tmp[$attr]= $this->$attr; + } + return($tmp); + } + +/* Returns the classnames auf the mail classes */ + function get_available_mail_classes() + { + $dir = opendir( "../include"); + $methods = array(); + $suffix = "class_mail-methods-"; + $lensuf = strlen($suffix); + $prefix = ".inc"; + $lenpre = strlen($prefix); + $i = 0; + while (($file = readdir($dir)) !== false){ + + if(stristr($file,$suffix)) { + $lenfile = strlen($file); + $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); + $methods['file'][$i] = $file; + $methods[$i]['file'] = $file; + $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre); + $i++; + } + } + return($methods); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc new file mode 100644 index 000000000..6140cd22a --- /dev/null +++ b/setup/class_setupStep_Config3.inc @@ -0,0 +1,195 @@ + false, + "forceglobals" => true, + "forcessl" => false, + "ldapstats" => false, + "warnssl" => true, + "ppd_path" => "/var/spool/ppd/", + "ppd_path_active" => FALSE, + "compile" => "/var/spool/gosa", + "debuglevel" => 0, + "session_lifetime" => 7200, + "max_ldap_query_time" => "5.0", + "max_ldap_query_time_active" => FALSE, + + "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server", + "mailQueueScriptPath_active" => FALSE, + + "auto_network_hook" => "/etc/gosa/net-resolv.sh", + "auto_network_hook_active" => FALSE, + + "notifydir" => "", + "notifydir_active" => FALSE, + + "kioskpath" => "/var/spool/kiosk", + "kioskpath_active" => FALSE, + + "noprimarygroup" => FALSE); + + var $attributes = array("errorlvl"); + + function Step_Config3() + { + $this->update_strings(); + } + + + function update_strings() + { + $this->s_title = _("GOsa settings 3/3"); + $this->s_title_long = _("GOsa settings 3/3"); + $this->s_info = _("Tweak some GOsa core behaviour"); + } + + + function execute() + { + $smarty = get_smarty(); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + $smarty->assign("optional", $this->optional); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl"))); + } + + + function save_object() + { + if(isset($_POST['step6a_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate(get_post($attr)); + } + } + + foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){ + if(isset($_POST[$name])){ + $this->optional[$name] = get_post($name); + } + } + + if(isset($_POST['ppd_path_active'])){ + $this->optional['ppd_path_active'] = TRUE; + if(isset($_POST['ppd_path'])){ + $this->optional['ppd_path'] = get_post('ppd_path'); + } + }else{ + $this->optional['ppd_path_active'] = FALSE; + } + + if(isset($_POST['max_ldap_query_time_active'])){ + $this->optional['max_ldap_query_time_active'] = TRUE; + if(isset($_POST['max_ldap_query_time'])){ + $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time'); + } + }else{ + $this->optional['max_ldap_query_time_active'] = FALSE; + } + + if(isset($_POST['mailQueueScriptPath_active'])){ + $this->optional['mailQueueScriptPath_active'] = TRUE; + if(isset($_POST['mailQueueScriptPath'])){ + $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath'); + } + }else{ + $this->optional['mailQueueScriptPath_active'] = FALSE; + } + + if(isset($_POST['kioskpath_active'])){ + $this->optional['kioskpath_active'] = TRUE; + if(isset($_POST['kioskpath'])){ + $this->optional['kioskpath'] = get_post('kioskpath'); + } + }else{ + $this->optional['kioskpath_active'] = FALSE; + } + + if(isset($_POST['auto_network_hook_active'])){ + $this->optional['auto_network_hook_active'] = TRUE; + if(isset($_POST['auto_network_hook'])){ + $this->optional['auto_network_hook'] = get_post('auto_network_hook'); + } + }else{ + $this->optional['auto_network_hook_active'] = FALSE; + } + + if(isset($_POST['notifydir_active'])){ + $this->optional['notifydir_active'] = TRUE; + if(isset($_POST['notifydir'])){ + $this->optional['notifydir'] = get_post('notifydir'); + } + }else{ + $this->optional['notifydir_active'] = FALSE; + } + } + + $tmp = $this->check(); + if(count($tmp) == 0){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = FALSE; + } + } + + + function check() + { + $message = array(); + + if(!is_numeric( $this->optional['session_lifetime'])){ + $message[] = _("Session lifetime must be a numeric value."); + } + + if(!is_numeric( $this->optional['max_ldap_query_time'])){ + $message[] = _("Maximal ldap query time must be a numeric value. "); + } + + return($message); + } + + + /* Attributes that are interesting for configuration generation */ + function get_attributes() + { + $tmp = setup_step::get_attributes(); + foreach(array("optional") as $attr){ + $tmp[$attr]= $this->$attr; + } + return($tmp); + } + +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Feedback.inc b/setup/class_setupStep_Feedback.inc new file mode 100644 index 000000000..fd6e394c5 --- /dev/null +++ b/setup/class_setupStep_Feedback.inc @@ -0,0 +1,274 @@ +is_enabled = TRUE; + $this->is_active = TRUE; + $this->update_strings(); + } + + + function init() + { + $cv = $this->parent->captured_values; + + /* Initialize values */ + $this->use_since = date("Y"); + $this->organization = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']); + $this->distribution = ""; + $this->web_server = $_SERVER['SERVER_SOFTWARE']; + $this->php_version = PHP_VERSION; + + /* On first call check for rid/sid base */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + $ldap->cd($cv['base']); + $ldap->search("(objectClass=*)",array("dn")); + $this->object_count=$ldap->count(); + + /* Preselect used features */ + $oc = $ldap->get_objectclasses(); + $this->features_used = array(); + $this->features_used['posix'] = array("USED" => isset($oc['posixAccount']) , + "NAME" => _("UNIX accounts/groups")); + $this->features_used['samba'] = array("USED" => isset($oc['sambaSamAccount']) || isset($oc['sambaAccount']) , + "NAME" => _("Samba management")); + $this->features_used['mail'] = array("USED" => $cv['mail'] != "none", + "NAME" => _("Mailsystem management")); + $this->features_used['fax'] = array("USED" => isset($oc['goFaxAccount']) , + "NAME" => _("FAX system administration")); + $this->features_used['asterisk'] = array("USED" => isset($oc['goFonAccount']), + "NAME" => _("Asterisk administration")); + $this->features_used['inventory'] = array("USED" => isset($oc['glpiAccount']) , + "NAME" => _("System inventory")); + $this->features_used['system'] = array("USED" => FALSE , + "NAME" => _("System-/Configmanagement")); + $this->features_used['addressbook'] = array("USED" => FALSE , + "NAME" => _("Addressbook")); + } + + + function update_strings() + { + $this->s_title = _("Notification and feedback"); + $this->s_info = _("Get notifications or send feedback"); + $this->s_title_long = _("Notification and feedback"); + } + + + function execute() + { + if(!$this->initialized){ + $this->initialized = TRUE; + $this->init(); + } + + $additional_info =""; + + if(isset($_POST['send_feedback'])){ + + $msgs = $this->check_feedback(); + if(count($msgs)){ + foreach($msgs as $msg){ + print_red($msg); + } + }else{ + $str = $this->create_serialise_data_string(); + $feedback_url = $this->feedback_url."?data=".base64_encode($str); + + $ret = @fopen($feedback_url,"r"); + + if(!$ret){ + print_red(sprintf(_("Could not connect to feedback server (%s). There is possibly no connection to the internet."),$this->feedback_url)); + }else{ + $ret_value=""; + while($ret && !feof($ret)){ + $ret_value.= fgets($ret,256); + } + if(!preg_match("/successful/i",$ret_value)){ + print_red(_("Error while sending your feedback. The service is possible temporary unavailable")); + }else{ + $additional_info = ""._("Feedback sucessfully send").""; + } + } + @fclose($ret); + } + } + + $years = array(); + for($i = date("Y") ; $i >= 2001; $i--){ + $years[$i] = $i; + } + + $this->is_completed=TRUE; + $smarty = get_smarty(); + + foreach($this->attributes as $attr){ + $smarty->assign($attr, $this->$attr); + } + $smarty->assign("years",$years); + $smarty->assign("features_used",$this->features_used); + $smarty->assign("additional_info",$additional_info); + $smarty->assign ("must", "*"); + return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__)))); + } + + + function check_feedback() + { + $msgs = array(); + if(!is_email($this->eMail) || empty($this->eMail)){ + $msgs[] = _("Please specify a valid email address."); + } + + if(!$this->subscribe && !$this->use_gosa_announce){ + $msgs[] = _("You should have enabled at least one option, to subscribe or send your feedback."); + } + + return($msgs); + } + + + function save_object() + { + if(isset($_POST['step_feedback'])){ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = get_post($attr); + } + } + + if(isset($_POST['subscribe'])){ + $this->subscribe = TRUE; + }else{ + $this->subscribe = FALSE; + } + + if(isset($_POST['use_gosa_announce'])){ + $this->use_gosa_announce = TRUE; + }else{ + $this->use_gosa_announce = FALSE; + } + + foreach($this->features_used as $key => $data){ + if(isset($_POST['feature_'.$key])){ + $this->features_used[$key]['USED'] = TRUE; + }else{ + $this->features_used[$key]['USED'] = FALSE; + } + } + } + } + + + function create_serialise_data_string() + { + $str = "#FEEDBACK ".date("H:i:s d:m:Y"); + if($this->subscribe){ + + $str.= "\n\nSubscribe"; + $str .= "\nOrganization: ".$this->organization; + $str .= "\nName: ".$this->name; + $str .= "\neMail: ".$this->eMail; + } + + if($this->use_gosa_announce){ + + $str.= "\n\nFeedback"; + + if($this->get_started) { + $str .= "\nGet started: TRUE"; + }else{ + $str .= "\nGet started: FALSE"; + } + $str .= "\nProblems : ".base64_encode($this->problems_encountered); + + if($this->first_use){ + $str .= "\nFirst use: TRUE"; + }else{ + $str .= "\nFirst use: FALSE"; + } + $str .= "\nUsing GOsa since: ".$this->use_since; + + $str .="\nDistribution: ".$this->distribution; + $str .="\nWeb Server: ".$this->web_server; + $str .="\nPHP_Version: ".$this->php_version; + $str .="\nLDAP Server: ".$this->ldap_server; + $str .="\nObject count: ".$this->object_count; + $str .="\nMissing features: ".base64_encode($this->want_to_see_next); + } + + $str .= "\n\nFeatures used"; + foreach($this->features_used as $name => $data){ + $str.="\n".$name.": "; + if($data['USED']){ + $str .= "TRUE"; + }else{ + $str .= "FALSE"; + } + } + + return($str); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Finish.inc b/setup/class_setupStep_Finish.inc new file mode 100644 index 000000000..3898c55c5 --- /dev/null +++ b/setup/class_setupStep_Finish.inc @@ -0,0 +1,143 @@ +update_strings(); + } + + + function update_strings() + { + $this->s_title = _("Finish"); + $this->s_info = _("Write configuration file"); + $this->s_title_long = _("Finish - write the configuration file"); + } + + + function get_conf_data() + { + $smarty = get_smarty(); + $smarty->assign("cv",$this->parent->captured_values); + $str = $smarty->fetch(CONFIG_TEMPLATE_DIR.$this->gosa_conf_contrib); + return($str); + } + + + function execute() + { + + $info= posix_getgrgid(posix_getgid()); + $webgroup = $info['name']; + + + /* Check if there is currently an active gosa.conf + */ + $exists = file_exists(CONFIG_DIR."/".CONFIG_FILE); + + /* Redirect to GOsa login, if : + * - gosa.conf exists + * - Permisssion are set correctly + */ + if(isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){ + session_destroy(); + header("Location: index.php"); + exit(); + } + + /* Downlaod config */ + if(isset($_POST['getconf'])){ + + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + header("Cache-Control: no-cache"); + header("Pragma: no-cache"); + header("Cache-Control: post-check=0, pre-check=0"); + header("Content-type: text/plain"); + + if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) || + preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){ + header('Content-Disposition: filename="'.CONFIG_FILE.'"'); + } else { + header('Content-Disposition: attachment; filename="'.CONFIG_FILE.'"'); + } + + $str = $this->get_conf_data(); + $str = preg_replace("/\n[ ]*\n/","",$str); + + echo $this->get_conf_data(); + exit(); + } + + $err_msg= ""; + + if($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){ + $err_msg = _("Your configuration file is currently world readable. Please updated the file permissions!"); + }elseif(!$exists){ + $err_msg = _("The configuration is currently not readable or it does not exists."); + } + + $smarty = get_smarty(); + $smarty->assign("err_msg",$err_msg); + $smarty->assign("webgroup", $webgroup); + $smarty->assign("CONFIG_DIR",CONFIG_DIR); + $smarty->assign("CONFIG_FILE" , CONFIG_FILE); + + $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement:"),CONFIG_DIR,CONFIG_FILE)); + + $smarty->assign("cv",$this->parent->captured_values); + return($smarty -> fetch (get_template_path("../setup/setup_finish.tpl"))); + } + + + /* check if given file is world readable */ + function is_world_readable($file) + { + clearstatcache(); + $p = fileperms($file); + $w_r = (decbin($p & 4) == TRUE); + return($w_r); + } + + + function save_object() + { + if(isset($_POST['step8_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Language.inc b/setup/class_setupStep_Language.inc new file mode 100644 index 000000000..76106ebd0 --- /dev/null +++ b/setup/class_setupStep_Language.inc @@ -0,0 +1,76 @@ +lang = get_browser_language(); + $this->lang_selected = ""; + $this->update_strings(); + } + + function update_strings() + { + $this->s_title = _("Language setup"); + $this->s_title_long = _("Language setup"); + $this->s_info = _("This step allows you to select your preferred language."); + } + + function execute() + { + $this->languages = array("" => _("Automatic"), + "de_DE" => _("German"), + "fr_FR" => _("French"), + "en_EN" => _("English"), + "ru_RU" => _("Russian")); + asort($this->languages); + $smarty = get_smarty(); + $smarty->assign("languages", $this->languages); + $smarty->assign("lang", $this->lang); + $smarty->assign("lang_selected",$this->lang_selected); + return($smarty->fetch(get_template_path("setup_language.tpl",TRUE,dirname(__FILE__)))); + } + + function save_object() + { + if((isset($_POST['lang_selected'])) && isset($this->languages[$_POST['lang_selected']])) { + $this->lang_selected = $_POST['lang_selected']; + $this->is_completed = TRUE; + + if($this->lang_selected != ""){ + $_SESSION['lang'] = $this->lang_selected; + }else{ + $_SESSION['lang'] = $this->lang; + } + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc new file mode 100644 index 000000000..c982eec68 --- /dev/null +++ b/setup/class_setupStep_Ldap.inc @@ -0,0 +1,192 @@ +update_strings(); + } + + + function update_strings() + { + $this->s_title = _("LDAP setup"); + $this->s_title_long = _("LDAP connection setup"); + $this->s_info = _("This dialog performs the basic configuration of the LDAP connectivity for GOsa."); + } + + + function execute() + { + $smarty = get_smarty(); + foreach($this->attributes as $attr){ + $smarty->assign($attr,$this->$attr); + } + + /* Assign connection status */ + $smarty->assign("connection_status",$this->get_connection_status()); + + /* Handle namingContext detection */ + $attr = @LDAP::get_naming_contexts($this->connection); + unset($attr['count']); + $smarty->assign("namingContexts",$attr); + $smarty->assign("namingContextsCount",count($attr)); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + + /* Addign resolved users */ + $smarty->assign("resolve_user",$this->resolve_user); + if($this->resolve_user){ + $tmp = $this->resolve_user(); + $smarty->assign("resolved_users",$tmp); + $smarty->assign("resolved_users_count",count($tmp)); + $smarty->assign("resolve_filter",$this->resolve_filter); + } + return($smarty -> fetch (get_template_path("../setup/setup_ldap.tpl"))); + } + + function get_connection_status() + { + $this->connect_id = FALSE; + $this->bind_id = FALSE; + + @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7); + $this->connect_id = @ldap_connect($this->connection); + + @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3); + $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password); + + if(!$this->bind_id){ + $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); + if(!empty($this->admin)){ + $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection); + } + return("".$str.""); + }else{ + if(empty($this->admin)){ + $str = sprintf(_("Anonymous bind on server '%s' succeeded."), $this->connection); + return("".$str.""._("Please specify user and password.").""); + }else{ + $str = sprintf(_("Bind as user '%s' on server '%s' succeeded."),$this->admin,$this->connection); + return("".$str.""); + } + } + } + + + function resolve_user() + { + $filter = $this->resolve_filter; + $ldap = new LDAP("","",$this->connection); + $ldap->cd($this->base); + $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))"); + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']); + natcasesort($tmp); + } + return($tmp); + } + + + function save_object() + { + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + + if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){ + $this->parent->disable_steps_from($this->parent->step_name_to_id(get_class($this))); + } + $this->$attr = get_post($attr); + } + } + + if(isset($_POST['resolve_user_x'])){ + $this->resolve_user = !$this->resolve_user; + } + if(isset($_POST['resolve_user'])){ + $this->resolve_user = !$this->resolve_user; + } + + /* Hide backward forward button*/ + $this->dialog = $this->resolve_user; + + if(isset($_POST['resolve_filter'])){ + $this->resolve_filter = get_post('resolve_filter'); + } + + if(isset($_POST['use_selected_user'])){ + + if(isset($_POST['admin_to_use'])){ + $this->admin = base64_decode(get_post('admin_to_use')); + $this->resolve_user = false; + } + } + + if(isset($_POST['append_base_to_admin_dn'])){ + $this->append_base_to_admin_dn = TRUE; + }else{ + $this->append_base_to_admin_dn = FALSE; + } + + if($this->append_base_to_admin_dn){ + $base = $this->base; + if(!preg_match("/,$/",$this->admin_given)){ + $base = ",".$base; + } + $this->admin = $this->admin_given.$base; + }else{ + $this->admin = $this->admin_given; + } + + $this->get_connection_status(); + if($this->bind_id && !empty($this->admin) && !empty($this->base)){ + $this->is_completed =TRUE; + }else{ + $this->is_completed =FALSE; + } + + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_License.inc b/setup/class_setupStep_License.inc new file mode 100644 index 000000000..0ed29d92a --- /dev/null +++ b/setup/class_setupStep_License.inc @@ -0,0 +1,82 @@ +update_strings(); + } + + + function load_license() + { + if(!file_exists("../setup/license.txt")){ + $this->License = "License not found. Setup stops here."; + $this->license_found = false; + }else{ + $fp = fopen("../setup/license.txt","r"); + $this->License = ""; + while (!feof($fp)){ + $this->License .= fread($fp, 255); + } + $this->license_found = true; + } + } + + + function update_strings() + { + $this->s_title = _("License"); + $this->s_title_long = _("License"); + $this->s_info = _("Terms and conditions for usage"); + } + + + function execute() + { + $this->load_license(); + + $smarty = get_smarty(); + $smarty -> assign("License",nl2br($this->License)); + $smarty -> assign("license_found",$this->license_found); + + return($smarty -> fetch (get_template_path("../setup/setup_license.tpl"))); + } + + + function save_object() + { + if($this->license_found){ + $this->is_completed = true; + }else{ + $this->is_completed = false; + } + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc new file mode 100644 index 000000000..8354a765e --- /dev/null +++ b/setup/class_setupStep_Migrate.inc @@ -0,0 +1,1805 @@ +update_strings(); + } + + function update_strings() + { + $this->s_title = _("LDAP inspection"); + $this->s_title_long = _("LDAP inspection"); + $this->s_info = _("Analyze your current LDAP for GOsa compatibility"); + } + + function initialize_checks() + { + $this->checks = array(); + $this->checks['root']['TITLE'] = _("Checking for root object"); + $this->checks['root']['STATUS'] = FALSE; + $this->checks['root']['STATUS_MSG']= ""; + $this->checks['root']['ERROR_MSG'] = ""; + $this->checkBase(); + + $this->checks['permissions']['TITLE'] = _("Checking permissions on LDAP database"); + $this->checks['permissions']['STATUS'] = FALSE; + $this->checks['permissions']['STATUS_MSG']= ""; + $this->checks['permissions']['ERROR_MSG'] = ""; + $this->check_ldap_permissions(); + + $this->checks['deps_visible']['TITLE'] = _("Checking for invisible deparmtments"); + $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; + $this->checks['users_visible']['STATUS_MSG']= ""; + $this->checks['users_visible']['ERROR_MSG'] = ""; + $this->check_gosaAccounts(); + + $this->checks['acls']['TITLE'] = _("Checking for super administrator"); + $this->checks['acls']['STATUS'] = FALSE; + $this->checks['acls']['STATUS_MSG']= ""; + $this->checks['acls']['ERROR_MSG'] = ""; + $this->check_administrativeAccount(); + + $this->checks['outside_users']['TITLE'] = _("Checking for users outside the people tree"); + $this->checks['outside_users']['STATUS'] = FALSE; + $this->checks['outside_users']['STATUS_MSG']= ""; + $this->checks['outside_users']['ERROR_MSG'] = ""; + $this->search_outside_users(); + + $this->checks['outside_groups']['TITLE'] = _("Checking for groups outside the groups tree"); + $this->checks['outside_groups']['STATUS'] = FALSE; + $this->checks['outside_groups']['STATUS_MSG']= ""; + $this->checks['outside_groups']['ERROR_MSG'] = ""; + $this->search_outside_groups(); + + $this->checks['outside_winstations']['TITLE'] = _("Checking for windows workstations outside the winstation tree"); + $this->checks['outside_winstations']['STATUS'] = FALSE; + $this->checks['outside_winstations']['STATUS_MSG']= ""; + $this->checks['outside_winstations']['ERROR_MSG'] = ""; + $this->search_outside_winstations(); + + $this->checks['uidNumber_usage']['TITLE'] = _("Checking for duplicate 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']['STATUS'] = FALSE; + $this->checks['gidNumber_usage']['STATUS_MSG']= ""; + $this->checks['gidNumber_usage']['ERROR_MSG'] = ""; + $this->check_gidNumber(); + } + + + /* Check if there are uidNumbers which are used more than once. + */ + function check_uidNumber() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $res = $ldap->search("uidNumber=*",array("dn","uidNumber")); + if(!$res){ + $this->checks['uidNumber_usage']['STATUS'] = FALSE; + $this->checks['uidNumber_usage']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['uidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + $this->check_uidNumbers= array(); + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[$attrs['uidNumber'][0]][] = $attrs; + } + + foreach($tmp as $id => $entries){ + if(count($entries) > 1){ + foreach($entries as $entry){ + $this->check_uidNumbers[base64_encode($entry['dn'])] = $entry; + } + } + } + + if($this->check_uidNumbers){ + $this->checks['uidNumber_usage']['STATUS'] = FALSE; + $this->checks['uidNumber_usage']['STATUS_MSG']= ""._("Warning").""; + $this->checks['uidNumber_usage']['ERROR_MSG'] = + sprintf(_("Found %s duplicate values for attribute 'uidNumber'."),count($this->check_uidNumbers)); + return(false); + }else{ + $this->checks['uidNumber_usage']['STATUS'] = TRUE; + $this->checks['uidNumber_usage']['STATUS_MSG']= _("Ok"); + $this->checks['uidNumber_usage']['ERROR_MSG'] = ""; + return(TRUE); + } + } + + + /* Check if there are duplicated gidNumbers present in ldap + */ + function check_gidNumber() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber")); + if(!$res){ + $this->checks['gidNumber_usage']['STATUS'] = FALSE; + $this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['gidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + $this->check_gidNumbers= array(); + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[$attrs['gidNumber'][0]][] = $attrs; + } + + foreach($tmp as $id => $entries){ + if(count($entries) > 1){ + foreach($entries as $entry){ + $this->check_gidNumbers[base64_encode($entry['dn'])] = $entry; + } + } + } + + if($this->check_gidNumbers){ + $this->checks['gidNumber_usage']['STATUS'] = FALSE; + $this->checks['gidNumber_usage']['STATUS_MSG']= ""._("Warning").""; + $this->checks['gidNumber_usage']['ERROR_MSG'] = + sprintf(_("Found %s duplicate values for attribute 'gidNumber'."),count($this->check_gidNumbers)); + return(false); + }else{ + $this->checks['gidNumber_usage']['STATUS'] = TRUE; + $this->checks['gidNumber_usage']['STATUS_MSG']= _("Ok"); + $this->checks['gidNumber_usage']['ERROR_MSG'] = ""; + return(TRUE); + } + } + + + /* Search for winstations outside the winstation ou + */ + function search_outside_winstations() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Get winstation ou */ + if($cv['generic_settings']['wws_ou_active']) { + $winstation_ou = $cv['generic_settings']['ws_ou']; + }else{ + $winstation_ou = "ou=winstations"; + } + + if($cv['samba_version'] == 3){ + $oc = "sambaSamAccount"; + }else{ + $oc = "sambaAccount"; + } + + $ldap->cd($cv['base']); + $res = $ldap->search("(&(objectClass=".$oc.")(uid=*$))",array("dn","sambaSID")); + if(!$res){ + $this->checks['outside_winstations']['STATUS'] = FALSE; + $this->checks['outside_winstations']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['outside_winstations']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + $this->outside_winstations = array(); + while($attrs = $ldap->fetch()){ + if((!preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){ + $attrs['selected'] = FALSE; + $attrs['ldif'] = ""; + $this->outside_winstations[base64_encode($attrs['dn'])] = $attrs; + } + } + + if(count($this->outside_winstations)){ + $this->checks['outside_winstations']['STATUS'] = FALSE; + $this->checks['outside_winstations']['STATUS_MSG']= _("Failed"); + $this->checks['outside_winstations']['ERROR_MSG'] = + sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou); + $this->checks['outside_winstations']['ERROR_MSG'].= ""; + return(false); + }else{ + $this->checks['outside_winstations']['STATUS'] = TRUE; + $this->checks['outside_winstations']['STATUS_MSG']= _("Ok"); + $this->checks['outside_winstations']['ERROR_MSG'] = ""; + return(TRUE); + } + } + + + /* Search for groups outside the group ou + */ + function search_outside_groups() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $group_ou = $cv['groupou']; + $ldap->cd($cv['base']); + $res = $ldap->search("(objectClass=posixGroup)",array("dn")); + if(!$res){ + $this->checks['outside_groups']['STATUS'] = FALSE; + $this->checks['outside_groups']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['outside_groups']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + + $this->outside_groups = array(); + while($attrs = $ldap->fetch()){ + if((!preg_match("/^[^,]+,".normalizePreg($group_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){ + $attrs['selected'] = FALSE; + $attrs['ldif'] = ""; + $this->outside_groups[base64_encode($attrs['dn'])] = $attrs; + } + } + + if(count($this->outside_groups)){ + $this->checks['outside_groups']['STATUS'] = FALSE; + $this->checks['outside_groups']['STATUS_MSG']= ""._("Warning").""; + $this->checks['outside_groups']['ERROR_MSG'] = + sprintf(_("Found %s groups outside the configured tree '%s'."),count($this->outside_groups),$group_ou); + $this->checks['outside_groups']['ERROR_MSG'].= " "; + return(false); + }else{ + $this->checks['outside_groups']['STATUS'] = TRUE; + $this->checks['outside_groups']['STATUS_MSG']= _("Ok"); + $this->checks['outside_groups']['ERROR_MSG'] = ""; + return(TRUE); + } + } + + + /* Search for users outside the people ou + */ + function search_outside_users() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + $people_ou = $cv['peopleou']; + $ldap->cd($cv['base']); + $res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn")); + if(!$res){ + $this->checks['outside_users']['STATUS'] = FALSE; + $this->checks['outside_users']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['outside_users']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + + $this->outside_users = array(); + while($attrs = $ldap->fetch()){ + if((!preg_match("/^[^,]+,".normalizePreg($people_ou)."/",$attrs['dn']) && !preg_match("/,dc=addressbook,/",$attrs['dn']))){ + $attrs['selected'] = FALSE; + $attrs['ldif'] = ""; + $this->outside_users[base64_encode($attrs['dn'])] = $attrs; + } + } + + if(count($this->outside_users)){ + $this->checks['outside_users']['STATUS'] = FALSE; + $this->checks['outside_users']['STATUS_MSG']= ""._("Warning").""; + $this->checks['outside_users']['ERROR_MSG'] = + sprintf(_("Found %s user(s) outside the configured tree '%s'."),count($this->outside_users),$people_ou); + $this->checks['outside_users']['ERROR_MSG'].= ""; + return(false); + }else{ + $this->checks['outside_users']['STATUS'] = TRUE; + $this->checks['outside_users']['STATUS_MSG']= _("Ok"); + $this->checks['outside_users']['ERROR_MSG'] = ""; + return(TRUE); + } + } + + + /* Check ldap accessibility + * Create and remove a dummy object, + * to ensure that we have the necessary permissions + */ + function check_ldap_permissions() + { + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Create dummy entry + */ + $name = "GOsa_setup_text_entry_".session_id().rand(0,999999); + $dn = "ou=".$name.",".$cv['base']; + $testEntry= array(); + $testEntry['objectClass'][]= "top"; + $testEntry['objectClass'][]= "organizationalUnit"; + $testEntry['objectClass'][]= "gosaDepartment"; + $testEntry['description']= "Created by GOsa setup, this object can be removed."; + $testEntry['ou'] = $name; + + /* check if simple ldap cat will be successful + */ + $res = $ldap->cat($cv['base']); + if(!$res){ + $this->checks['permissions']['STATUS'] = FALSE; + $this->checks['permissions']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['permissions']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + return(false); + } + + /* Try to create dummy object + */ + $ldap->cd ($dn); + $ldap->create_missing_trees($dn); + $res = $ldap->add($testEntry); + $ldap->cat($dn); + if(!$ldap->count()){ + gosa_log($ldap->get_error()); + $this->checks['permissions']['STATUS'] = FALSE; + $this->checks['permissions']['STATUS_MSG']= _("Failed"); + $this->checks['permissions']['ERROR_MSG'] = + sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']); + return(false); + } + + /* Try to remove created entry + */ + $res = $ldap->rmDir($dn); + $ldap->cat($dn); + if($ldap->count()){ + gosa_log($ldap->get_error()); + $this->checks['permissions']['STATUS'] = FALSE; + $this->checks['permissions']['STATUS_MSG']= _("Failed"); + $this->checks['permissions']['ERROR_MSG'] = + sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']); + return(false); + } + + /* Create & remove of dummy object was successful */ + $this->checks['permissions']['STATUS'] = TRUE; + $this->checks['permissions']['STATUS_MSG']= _("Ok"); + $this->checks['permissions']['ERROR_MSG'] = ""; + return(true); + } + + + /* Check if there are users which will + * be invisible for GOsa + */ + function check_gosaAccounts() + { + /* Remember old list of ivisible users, to be able to set + * the 'html checked' status for the checkboxes again + */ + $cnt_ok = 0; + $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['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Get all invisible users + */ + $ldap->cd($cv['base']); + $res =$ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))(!(objectClass=gosaAccount))(uid=*))",array("sn","givenName","cn","uid")); + while($attrs = $ldap->fetch()){ + if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){ + $attrs['checked'] = FALSE; + $attrs['before'] = ""; + $attrs['after'] = ""; + + /* Set objects to selected, that were selected before reload */ + if(isset($old[base64_encode($attrs['dn'])])){ + $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked']; + } + $this->users_to_migrate[base64_encode($attrs['dn'])] = $attrs; + } + } + + /* No invisible */ + if(!$res){ + $this->checks['users_visible']['STATUS'] = FALSE; + $this->checks['users_visible']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['users_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + }elseif(count($this->users_to_migrate) == 0){ + $this->checks['users_visible']['STATUS'] = TRUE; + $this->checks['users_visible']['STATUS_MSG']= _("Ok"); + $this->checks['users_visible']['ERROR_MSG'] = ""; + }else{ + $this->checks['users_visible']['STATUS'] = FALSE; + $this->checks['users_visible']['STATUS_MSG']= ""._("Warning").""; + $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s user(s) that will not be visible in GOsa."), + count($this->users_to_migrate)); + $this->checks['users_visible']['ERROR_MSG'] .= ""; + } + } + + + /* Start user account migration + */ + function migrate_gosaAccounts($only_ldif = FALSE) + { + $this->show_details= $only_ldif; + + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Add gosaAccount objectClass to the selected users + */ + foreach($this->users_to_migrate as $key => $dep){ + if($dep['checked']){ + + /* Get old objectClasses */ + $ldap->cat($dep['dn'],array("objectClass")); + $attrs = $ldap->fetch(); + + /* Create new objectClass array */ + $new_attrs = array(); + $new_attrs['objectClass']= array("gosaAccount","inetOrgPerson","organizationalPerson"); + for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){ + if(!in_array_ics($attrs['objectClass'][$i], $new_attrs['objectClass'])){ + $new_attrs['objectClass'][] = $attrs['objectClass'][$i]; + } + } + + /* Set info attributes for current object, + * or write changes to the ldap database + */ + if($only_ldif){ + $this->users_to_migrate[$key]['before'] = $this->array_to_ldif($attrs); + $this->users_to_migrate[$key]['after'] = $this->array_to_ldif($new_attrs); + }else{ + $ldap->cd($attrs['dn']); + if(!$ldap->modify($new_attrs)){ + print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error())); + return(false); + } + } + } + } + return(TRUE); + } + + + /* Check if there are invisible organizational Units + */ + function check_organizationalUnits() + { + $cnt_ok = 0; + $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['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Skip GOsa internal departments */ + $skip_dns = array("/^ou=people,/","/^ou=groups,/","/(,|)ou=configs,/","/(,|)ou=systems,/", + "/^ou=apps,/","/^ou=mime,/","/^ou=aclroles,/","/^ou=incoming,/", + "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/", + "/(,|)ou=winstations,/"); + + + /* Get all invisible departments */ + $ldap->cd($cv['base']); + $res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn")); + while($attrs = $ldap->fetch()){ + $attrs['checked'] = FALSE; + $attrs['before'] = ""; + $attrs['after'] = ""; + + /* Set objects to selected, that were selected before reload */ + if(isset($old[base64_encode($attrs['dn'])])){ + $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked']; + } + $this->deps_to_migrate[base64_encode($attrs['dn'])] = $attrs; + } + + /* Filter returned list of departments and ensure that + * GOsa internal departments will not be listed + */ + foreach($this->deps_to_migrate as $key => $attrs){ + $dn = $attrs['dn']; + $skip = false; + foreach($skip_dns as $skip_dn){ + if(preg_match($skip_dn,$dn)){ + $skip = true; + } + } + if($skip){ + unset($this->deps_to_migrate[$key]); + } + } + + /* If we have no invisible departments found + * tell the user that everything is ok + */ + if(!$res){ + $this->checks['deps_visible']['STATUS'] = FALSE; + $this->checks['deps_visible']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['deps_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + }elseif(count($this->deps_to_migrate) == 0 ){ + $this->checks['deps_visible']['STATUS'] = TRUE; + $this->checks['deps_visible']['STATUS_MSG']= _("Ok"); + $this->checks['deps_visible']['ERROR_MSG'] = ""; + }else{ + $this->checks['deps_visible']['STATUS'] = TRUE; + $this->checks['deps_visible']['STATUS_MSG']= ''._("Warning").''; + $this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate)); + $this->checks['deps_visible']['ERROR_MSG'] .= " "; + } + } + + + + /* Start deparmtment migration */ + function migrate_organizationalUnits($only_ldif = FALSE) + { + $this->show_details= $only_ldif; + + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Add gosaDepartment objectClass to each selected entry + */ + foreach($this->deps_to_migrate as $key => $dep){ + if($dep['checked']){ + + /* Get current objectClasses */ + $ldap->cat($dep['dn'],array("objectClass","description")); + $attrs = $ldap->fetch(); + + /* Create new objectClass attribute including gosaDepartment*/ + $new_attrs = array(); + for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){ + $new_attrs['objectClass'][] = $attrs['objectClass'][$i]; + } + $new_attrs['objectClass'][] = "gosaDepartment"; + + /* Append description it is missing */ + if(!isset($attrs['description'])){ + $new_attrs['description'][] = "GOsa department"; + } + + /* Depending on the parameter >only_diff< we save the changes as ldif + * or we write our changes directly to the ldap database + */ + if($only_ldif){ + $this->deps_to_migrate[$key]['before'] = $this->array_to_ldif($attrs); + $this->deps_to_migrate[$key]['after'] = $this->array_to_ldif($new_attrs); + }else{ + $ldap->cd($attrs['dn']); + if(!$ldap->modify($new_attrs)){ + print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error())); + return(false); + } + } + } + } + return(TRUE); + } + + + /* Check Acls if there is at least one object with acls defined + */ + function check_administrativeAccount() + { + /* Establish ldap connection */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Search for gosaAcls */ + $ldap->cd($cv['base']); + $res = $ldap->cat($cv['base']); + + if(!$res){ + $this->checks['acls']['STATUS'] = FALSE; + $this->checks['acls']['STATUS_MSG']= _("LDAP query failed"); + $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing."); + }else{ + $found = false; + $username = ""; + $attrs = $ldap->fetch(); + if(isset($attrs['gosaAclEntry'])){ + $acls = $attrs['gosaAclEntry']; + for($i = 0 ; $i < $acls['count'] ; $i++){ + $acl = $acls[$i]; + $tmp = split(":",$acl); + if($tmp[1] == "psub"){ + $members = split(",",$tmp[2]); + foreach($members as $member){ + $member = base64_decode($member); + + /* Check if acl owner is a valid GOsa user account */ + $ldap->cat($member,array("objectClass","uid","cn")); + $ret = $ldap->fetch(); + + if(isset($ret['objectClass']) && in_array("posixGroup",$ret['objectClass'])){ + $found = TRUE; + $username .= "ACL-Group: ".$ret['cn'][0]."
"; + }elseif(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) && + in_array("organizationalPerson",$ret['objectClass']) && + in_array("inetOrgPerson",$ret['objectClass'])){ + $found = TRUE; + $username .= "ACL: ".$ret['uid'][0]."
"; + } + } + }elseif($tmp[1] == "role"){ + + /* Check if acl owner is a valid GOsa user account */ + $ldap->cat(base64_decode($tmp[2]),array("gosaAclTemplate")); + $ret = $ldap->fetch(); + + if(isset($ret['gosaAclTemplate'])){ + $cnt = $ret['gosaAclTemplate']['count']; + for($e = 0 ; $e < $cnt ; $e++){ + + $a_str = $ret['gosaAclTemplate'][$e]; + if(preg_match("/^[0-9]*:psub:/",$a_str) && preg_match("/:all;cmdrw$/",$a_str)){ + + $members = split(",",$tmp[3]); + foreach($members as $member){ + $member = base64_decode($member); + + /* Check if acl owner is a valid GOsa user account */ + $ldap->cat($member,array("objectClass","uid")); + $ret = $ldap->fetch(); + + if(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) && + in_array("organizationalPerson",$ret['objectClass']) && + in_array("inetOrgPerson",$ret['objectClass'])){ + $found = TRUE; + $username .= "ACL Role: ".$ret['uid'][0]."
"; + } + } + } + } + } + } + } + } + + # For debugging + #echo $username; + + if($found){ + $this->checks['acls']['STATUS'] = TRUE; + $this->checks['acls']['STATUS_MSG']= _("Ok")." "; + $this->checks['acls']['ERROR_MSG'] = ""; + }else{ + $this->checks['acls']['STATUS'] = FALSE; + $this->checks['acls']['STATUS_MSG']= _("Failed"); + $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")." "; + $this->checks['acls']['ERROR_MSG'].= ""; + } + } + return($ldap->count()>=1); + } + + + + function create_admin($only_ldif = FALSE) + { + /* Reset '' */ + $this->acl_create_changes=""; + + /* Object that should receive admin acls */ + $dn = $this->acl_create_selected; + + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* 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['objectClass'] = array("gosaACL"); + + for($i = 0; $i < $attrs['objectClass']['count']; $i ++){ + if(!in_array_ics($attrs['objectClass'][$i],$attrs_new['objectClass'])){ + $attrs_new['objectClass'][] = $attrs['objectClass'][$i]; + } + } + + $acl = "0:psub:".base64_encode($dn).":all;cmdrw"; + $attrs_new['gosaAclEntry'][] = $acl; + if(isset($attrs['gosaAclEntry'])){ + for($i = 0 ; $i < $attrs['gosaAclEntry']['count']; $i ++){ + + $prio = preg_replace("/[:].*$/","",$attrs['gosaAclEntry'][$i]); + $rest = preg_replace("/^[^:]/","",$attrs['gosaAclEntry'][$i]); + + $data = ($prio+1).$rest; + $attrs_new['gosaAclEntry'][] = $data; + } + } + + if($only_ldif){ + $this->acl_create_changes ="\n".$cv['base']."\n"; + $this->acl_create_changes.=$this->array_to_ldif($attrs)."\n"; + $this->acl_create_changes.="\n".$cv['base']."\n"; + $this->acl_create_changes.=$this->array_to_ldif($attrs_new); + }else{ + + $ldap->cd($cv['base']); + if(!$ldap->modify($attrs_new)){ + print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error())); + return(FALSE); + }else{ + return(TRUE); + } + } + } + + + function create_admin_user() + { + $pw1 = $pw2 = ""; + + if(isset($_POST['new_user_password'])){ + $pw1 = $_POST['new_user_password']; + } + if(isset($_POST['new_user_password2'])){ + $pw2 = $_POST['new_user_password2']; + } + + if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){ + print_red(_("Specified passwords are empty or not equal.")); + return false; + } + + /* Establish ldap connection */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Get current base attributes */ + $ldap->cd($cv['base']); + + if($cv['peopledn'] == "cn"){ + $dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base']; + }else{ + $dn = "uid=admin,".$cv['peopleou'].",".$cv['base']; + } + + $methods = @passwordMethod::get_available_methods_if_not_loaded(); + $p_m = $methods[$cv['encryption']]; + $p_c = new $p_m(array()); + $hash = $p_c->generate_hash($pw2); + + $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['uid'] = "admin"; + $new_user['userPassword'] = $hash; + + $ldap->cd($cv['base']); + $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn)); + $ldap->cd($dn); + $res = $ldap->add($new_user); + $this->acl_create_selected = $dn; + $this->create_admin(); + + if(!$res){ + print_red($ldap->get_error()); + return(FALSE); + } + + $this->acl_create_dialog=FALSE; + $this->check_administrativeAccount(); + return(TRUE); + } + + + function migrate_outside_winstations($perform = FALSE) + { + /* Establish ldap connection */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + + /* Check if there was a destination department posted */ + if(isset($_POST['move_winstation_to'])){ + $destination_dep = $_POST['move_winstation_to']; + }else{ + print_red(_("Couldn't move users to specified department.")); + return(false); + } + + foreach($this->outside_winstations as $b_dn => $data){ + $this->outside_winstations[$b_dn]['ldif'] =""; + if($data['selected']){ + $dn = base64_decode($b_dn); + $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn); + if(!$perform){ + $this->outside_winstations[$b_dn]['ldif'] = _("Winstation will be moved from").":
\t".$dn."
"._("to").":
\t".$d_dn; + + + /* Check if there are references to this object */ + $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn')); + $refs = ""; + while($attrs = $ldap->fetch()){ + $ref_dn = $attrs['dn']; + $refs .= "
\t".$ref_dn; + } + if(!empty($refs)){ + $this->outside_winstations[$b_dn]['ldif'] .= "

"._("Updating following references too").":".$refs; + } + + }else{ + $this->move($dn,$d_dn); + } + } + } + } + + + function migrate_outside_groups($perform = FALSE) + { + /* Establish ldap connection */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + + /* Check if there was a destination department posted */ + if(isset($_POST['move_group_to'])){ + $destination_dep = $_POST['move_group_to']; + }else{ + print_red(_("Couldn't move users to specified department.")); + return(false); + } + + foreach($this->outside_groups as $b_dn => $data){ + $this->outside_groups[$b_dn]['ldif'] =""; + if($data['selected']){ + $dn = base64_decode($b_dn); + $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn); + if(!$perform){ + $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":
\t".$dn."
"._("to").":
\t".$d_dn; + + + /* Check if there are references to this object */ + $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn')); + $refs = ""; + while($attrs = $ldap->fetch()){ + $ref_dn = $attrs['dn']; + $refs .= "
\t".$ref_dn; + } + if(!empty($refs)){ + $this->outside_groups[$b_dn]['ldif'] .= "

"._("Updating following references too").":".$refs; + } + + }else{ + $this->move($dn,$d_dn); + } + } + } + } + + + function migrate_outside_users($perform = FALSE) + { + /* Establish ldap connection */ + $cv = $this->parent->captured_values; + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + + /* Check if there was a destination department posted */ + if(isset($_POST['move_user_to'])){ + $destination_dep = $_POST['move_user_to']; + }else{ + print_red(_("Couldn't move users to specified department.")); + return(false); + } + + foreach($this->outside_users as $b_dn => $data){ + $this->outside_users[$b_dn]['ldif'] =""; + if($data['selected']){ + $dn = base64_decode($b_dn); + $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn); + if(!$perform){ + $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":
\t".$dn."
"._("to").":
\t".$d_dn; + + /* Check if there are references to this object */ + $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn')); + $refs = ""; + while($attrs = $ldap->fetch()){ + $ref_dn = $attrs['dn']; + $refs .= "
\t".$ref_dn; + } + if(!empty($refs)){ + $this->outside_users[$b_dn]['ldif'] .= "

"._("The following references will be updated").":".$refs; + } + + }else{ + $this->move($dn,$d_dn); + } + } + } + } + + + function execute() + { + /* Initialise checks if this is the first call */ + if(!$this->checks_initialised || isset($_POST['reload'])){ + $this->initialize_checks(); + $this->checks_initialised = TRUE; + } + + /************* + * Winstations outside the group ou + *************/ + + if(isset($_POST['outside_winstations_dialog_cancel'])){ + $this->outside_winstations_dialog = FALSE; + $this->dialog = FALSE; + $this->show_details = FALSE; + } + + if(isset($_POST['outside_winstations_dialog_whats_done'])){ + $this->migrate_outside_winstations(FALSE); + } + + if(isset($_POST['outside_winstations_dialog_perform'])){ + $this->migrate_outside_winstations(TRUE); + $this->search_outside_winstations(); + $this->dialog = FALSE; + $this->show_details = FALSE; + $this->outside_winstations_dialog = FALSE; + } + + if(isset($_POST['outside_winstations_dialog'])){ + $this->outside_winstations_dialog = TRUE; + $this->dialog = TRUE; + } + + if($this->outside_winstations_dialog){ + $smarty = get_smarty(); + $smarty->assign("ous",$this->get_all_winstation_ous()); + $smarty->assign("method","outside_winstations"); + $smarty->assign("outside_winstations",$this->outside_winstations); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + /************* + * Groups outside the group ou + *************/ + + if(isset($_POST['outside_groups_dialog_cancel'])){ + $this->outside_groups_dialog = FALSE; + $this->show_details = FALSE; + $this->dialog = FALSE; + } + + if(isset($_POST['outside_groups_dialog_whats_done'])){ + $this->show_details= TRUE; + $this->migrate_outside_groups(FALSE); + } + + if(isset($_POST['outside_groups_dialog_refresh'])){ + $this->show_details= FALSE; + } + + if(isset($_POST['outside_groups_dialog_perform'])){ + $this->migrate_outside_groups(TRUE); + $this->dialog = FALSE; + $this->show_details = FALSE; + $this->outside_groups_dialog = FALSE; + $this->initialize_checks(); + } + + if(isset($_POST['outside_groups_dialog'])){ + $this->outside_groups_dialog = TRUE; + $this->dialog = TRUE; + } + + if($this->outside_groups_dialog){ + $smarty = get_smarty(); + $smarty->assign("ous",$this->get_all_group_ous()); + $smarty->assign("method","outside_groups"); + $smarty->assign("outside_groups",$this->outside_groups); + $smarty->assign("group_details", $this->show_details); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + /************* + * User outside the people ou + *************/ + + if(isset($_POST['outside_users_dialog_cancel'])){ + $this->outside_users_dialog = FALSE; + $this->dialog = FALSE; + $this->show_details = FALSE; + } + + if(isset($_POST['outside_users_dialog_whats_done'])){ + $this->show_details= TRUE; + $this->migrate_outside_users(FALSE); + } + + if(isset($_POST['outside_users_dialog_perform'])){ + $this->migrate_outside_users(TRUE); + $this->initialize_checks(); + $this->dialog = FALSE; + $this->show_details = FALSE; + $this->outside_users_dialog = FALSE; + } + + if (isset($_POST['outside_users_dialog_refresh'])){ + $this->show_details= FALSE; + } + + if(isset($_POST['outside_users_dialog'])){ + $this->outside_users_dialog = TRUE; + $this->dialog = TRUE; + } + + if($this->outside_users_dialog){ + $smarty = get_smarty(); + $smarty->assign("ous",$this->get_all_people_ous()); + $smarty->assign("method","outside_users"); + $smarty->assign("outside_users",$this->outside_users); + $smarty->assign("user_details", $this->show_details); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + /************* + * Root object check + *************/ + + if(isset($_POST['retry_root_create'])){ + + $state = $this->checks['root']['STATUS']; + $this->checkBase(FALSE); + if($state != $this->checks['root']['STATUS']){ + $this->initialize_checks(); + } + } + + /************* + * User Migration handling + *************/ + + if(isset($_POST['retry_acls'])){ + $this->check_administrativeAccount(); + } + + if(isset($_POST['create_acls'])){ + $this->acl_create_dialog = TRUE; + $this->dialog = TRUE; + } + + if(isset($_POST['create_acls_cancel'])){ + $this->acl_create_dialog = FALSE; + $this->dialog = FALSE; + $this->show_details = FALSE; + } + + if(isset($_POST['create_acls_create_confirmed'])){ + if($this->create_admin()){ + $this->acl_create_dialog = FALSE; + $this->dialog = FALSE; + $this->show_details = FALSE; + $this->initialize_checks(); + } + } + + if(isset($_POST['create_acls_create'])){ + $this->create_admin(TRUE); + } + + if(isset($_POST['create_admin_user'])){ + if($this->create_admin_user()){ + $this->dialog = FALSE; + $this->show_details = FALSE; + } + } + + if($this->acl_create_dialog){ + $smarty = get_smarty(); + $smarty->assign("new_user_password",@$_POST['new_user_password']); + $smarty->assign("new_user_password2",@$_POST['new_user_password2']); + $smarty->assign("users" ,$this->get_user_list()); + $smarty->assign("users_cnt" ,count($this->get_user_list())); + $smarty->assign("groups",$this->get_group_list()); + $smarty->assign("groups_cnt",count($this->get_group_list())); + $smarty->assign("type" ,$this->acl_create_type); + $smarty->assign("method","create_acls"); + $smarty->assign("acl_create_selected",$this->acl_create_selected); + $smarty->assign("what_will_be_done_now",$this->acl_create_changes); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + /************* + * User Migration handling + *************/ + + /* Refresh list of deparments */ + if(isset($_POST['users_visible_migrate_refresh'])){ + $this->check_gosaAccounts(); + } + + /* Open migration dialog */ + if(isset($_POST['users_visible_migrate'])){ + $this->show_details= FALSE; + $this->users_migration_dialog = TRUE; + $this->dialog =TRUE; + } + + /* Close migration dialog */ + if(isset($_POST['users_visible_migrate_close'])){ + $this->users_migration_dialog = FALSE; + $this->dialog =FALSE; + $this->show_details = FALSE; + } + + /* Start migration */ + if(isset($_POST['users_visible_migrate_migrate'])){ + if($this->migrate_gosaAccounts()){ + $this->initialize_checks(); + $this->dialog = FALSE; + $this->show_details = FALSE; + $this->users_migration_dialog = FALSE; + } + } + + /* Start migration */ + if(isset($_POST['users_visible_migrate_whatsdone'])){ + $this->migrate_gosaAccounts(TRUE); + } + + /* Display migration dialog */ + if($this->users_migration_dialog){ + $smarty = get_smarty(); + $smarty->assign("users_to_migrate",$this->users_to_migrate); + $smarty->assign("method","migrate_users"); + $smarty->assign("user_details", $this->show_details); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + + /************* + * Department Migration handling + *************/ + + /* Refresh list of deparments */ + if(isset($_POST['deps_visible_migrate_refresh'])){ + $this->check_organizationalUnits(); + $this->show_details= FALSE; + } + + /* Open migration dialog */ + if(isset($_POST['deps_visible_migrate'])){ + $this->dep_migration_dialog = TRUE; + $this->dialog =TRUE; + } + + /* Close migration dialog */ + if(isset($_POST['deps_visible_migrate_close'])){ + $this->dep_migration_dialog = FALSE; + $this->dialog =FALSE; + $this->show_details = FALSE; + } + + /* Start migration */ + if(isset($_POST['deps_visible_migrate_migrate'])){ + if($this->migrate_organizationalUnits()){ + $this->show_details= FALSE; + $this->check_organizationalUnits(); + $this->dialog = FALSE; + $this->dep_migration_dialog = FALSE; + } + } + + /* Start migration */ + if(isset($_POST['deps_visible_migrate_whatsdone'])){ + $this->migrate_organizationalUnits(TRUE); + } + + /* Display migration dialog */ + if($this->dep_migration_dialog){ + $smarty = get_smarty(); + $smarty->assign("deps_to_migrate",$this->deps_to_migrate); + $smarty->assign("method","migrate_deps"); + $smarty->assign("deps_details", $this->show_details); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + $smarty = get_smarty(); + $smarty->assign("checks",$this->checks); + $smarty->assign("method","default"); + return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__)))); + } + + + function save_object() + { + $this->is_completed= TRUE; + + /* Capture all selected winstations from outside_winstations_dialog */ + if($this->outside_winstations_dialog){ + foreach($this->outside_winstations as $dn => $data){ + if(isset($_POST['select_winstation_'.$dn])){ + $this->outside_winstations[$dn]['selected'] = TRUE; + }else{ + $this->outside_winstations[$dn]['selected'] = FALSE; + } + } + } + + /* Capture all selected groups from outside_groups_dialog */ + if($this->outside_groups_dialog){ + foreach($this->outside_groups as $dn => $data){ + if(isset($_POST['select_group_'.$dn])){ + $this->outside_groups[$dn]['selected'] = TRUE; + }else{ + $this->outside_groups[$dn]['selected'] = FALSE; + } + } + } + + /* Capture all selected users from outside_users_dialog */ + if($this->outside_users_dialog){ + foreach($this->outside_users as $dn => $data){ + if(isset($_POST['select_user_'.$dn])){ + $this->outside_users[$dn]['selected'] = TRUE; + }else{ + $this->outside_users[$dn]['selected'] = FALSE; + } + } + } + + /* Get "create acl" dialog posts */ + if($this->acl_create_dialog){ + if(isset($_POST['create_acls_create'])){ + if(isset($_POST['create_acls_selected'])){ + $this->acl_create_selected = base64_decode($_POST['create_acls_selected']); + }else{ + $this->acl_create_selected = ""; + } + } + + if(isset($_POST['create_acls_create_abort'])){ + $this->acl_create_selected = ""; + } + + if(isset($_POST['acl_create_type'])){ + $this->acl_create_type = $_POST['acl_create_type']; + } + } + + /* Get selected departments */ + if($this->dep_migration_dialog){ + foreach($this->deps_to_migrate as $id => $data){ + if(isset($_POST['migrate_'.$id])){ + $this->deps_to_migrate[$id]['checked'] = TRUE; + }else{ + $this->deps_to_migrate[$id]['checked'] = FALSE; + } + } + } + + /* Get selected users */ + if($this->users_migration_dialog){ + foreach($this->users_to_migrate as $id => $data){ + if(isset($_POST['migrate_'.$id])){ + $this->users_to_migrate[$id]['checked'] = TRUE; + }else{ + $this->users_to_migrate[$id]['checked'] = FALSE; + } + } + } + } + + + /* Check if the root object exists. + * If the parameter just_check is true, then just check if the + * root object is missing and update the info messages. + * If the Parameter is false, try to create a new root object. + */ + function checkBase($just_check = TRUE) + { + /* Get collected setup informations */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Check if root object exists */ + $ldap->cd($cv['base']); + $res = $ldap->search("(objectClass=*)"); + $err = ldap_errno($ldap->cid); + + if( !$res || + $err == 0x20 || # LDAP_NO_SUCH_OBJECT + $err == 0x40) { # LDAP_NAMING_VIOLATION + + /* Root object doesn't exists + */ + if($just_check){ + $this->checks['root']['STATUS'] = FALSE; + $this->checks['root']['STATUS_MSG']= _("Failed"); + $this->checks['root']['ERROR_MSG'] = _("The LDAP root object is missing. It is required to use your LDAP service.").' '; + $this->checks['root']['ERROR_MSG'].= ""; + return(FALSE); + }else{ + + /* Add root object */ + $ldap->cd($cv['base']); + $res = $ldap->create_missing_trees($cv['base']); + + /* If adding failed, tell the user */ + if(!$res){ + $this->checks['root']['STATUS'] = FALSE; + $this->checks['root']['STATUS_MSG']= _("Failed"); + $this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own."); + $this->checks['root']['ERROR_MSG'].= " "; + return($res);; + } + } + } + + /* Create & remove of dummy object was successful */ + $this->checks['root']['STATUS'] = TRUE; + $this->checks['root']['STATUS_MSG']= _("Ok"); + } + + + /* Return ldif information for a + * given attribute array + */ + function array_to_ldif($atts) + { + $ret = ""; + unset($atts['count']); + unset($atts['dn']); + foreach($atts as $name => $value){ + if(is_numeric($name)) { + continue; + } + if(is_array($value)){ + unset($value['count']); + foreach($value as $a_val){ + $ret .= $name.": ". $a_val."\n"; + } + }else{ + $ret .= $name.": ". $value."\n"; + } + } + return(preg_replace("/\n$/","",$ret)); + } + + + function get_user_list() + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(objectClass=gosaAccount)",array("dn")); + + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']); + } + return($tmp); + } + + + function get_all_people_ous() + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(".$cv['peopleou'].")",array("dn")); + + if($ldap->count() == 0 ){ + $add_dn = $cv['peopleou'].",".$cv['base']; + $naming_attr = preg_replace("/=.*$/","",$add_dn); + $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn); + $add = array(); + $add['objectClass'] = array("organizationalUnit"); + $add[$naming_attr] = $naming_value; + + $ldap->cd($cv['base']); + $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn)); + $ldap->cd($add_dn); + $ldap->add($add); + } + + $ldap->search("(".$cv['peopleou'].")",array("dn")); + $tmp = array(); + while($attrs= $ldap->fetch()){ + if(!preg_match("/ou=snapshots,/",$attrs['dn'])){ + $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']); + } + } + return($tmp); + } + + function get_all_winstation_ous() + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Get winstation ou */ + if($cv['generic_settings']['wws_ou_active']) { + $winstation_ou = $cv['generic_settings']['ws_ou']; + }else{ + $winstation_ou = "ou=winstations"; + } + + $ldap->cd($cv['base']); + $ldap->search("(".$winstation_ou.")",array("dn")); + + if($ldap->count() == 0 ){ + $add_dn = $winstation_ou.",ou=systems,".$cv['base']; + $naming_attr = preg_replace("/=.*$/","",$add_dn); + $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn); + $add = array(); + $add['objectClass'] = array("organizationalUnit"); + $add[$naming_attr] = $naming_value; + + $ldap->cd($cv['base']); + $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn)); + $ldap->cd($add_dn); + $ldap->add($add); + } + + $ldap->search("(".$winstation_ou.")",array("dn")); + $tmp = array(); + while($attrs= $ldap->fetch()){ + if(!preg_match("/ou=snapshots,/",$attrs['dn'])){ + $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']); + } + } + return($tmp); + } + + + function get_all_group_ous() + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(".$cv['groupou'].")",array("dn")); + + if($ldap->count() == 0 ){ + $add_dn = $cv['groupou'].",".$cv['base']; + $naming_attr = preg_replace("/=.*$/","",$add_dn); + $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn); + $add = array(); + $add['objectClass'] = array("organizationalUnit"); + $add[$naming_attr] = $naming_value; + + $ldap->cd($cv['base']); + $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn)); + $ldap->cd($add_dn); + $ldap->add($add); + } + + $ldap->search("(".$cv['groupou'].")",array("dn")); + $tmp = array(); + while($attrs= $ldap->fetch()){ + if(!preg_match("/ou=snapshots,/",$attrs['dn'])){ + $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']); + } + } + return($tmp); + } + + + function get_group_list() + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + $ldap->cd($cv['base']); + $ldap->search("(objectClass=posixGroup)",array("dn")); + + $tmp = array(); + while($attrs = $ldap->fetch()){ + $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']); + } + return($tmp); + } + + + function move($source,$destination) + { + /* Get collected configuration settings */ + $cv = $this->parent->captured_values; + + /* Establish ldap connection */ + $ldap = new LDAP($cv['admin'], + $cv['password'], + $cv['connection'], + FALSE, + $cv['tls']); + + /* Update object references in gosaGroupOfNames */ + $ogs_to_fix = array(); + $ldap->cd($cv['base']); + $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member')); + while ($attrs= $ldap->fetch()){ + $dn = $attrs['dn']; + $attrs = $this->cleanup_array($attrs); + $member_new = array($destination); + foreach($attrs['member'] as $member){ + if($member != $source){ + $member_new[] = $member; + } + } + $attrs['member'] = $member_new; + $ogs_to_fix[$dn] = $attrs; + } + + /* Copy source to destination dn */ + $ldap->cat($source); + $new_data = $this->cleanup_array($ldap->fetch()); + $ldap->cd($destination); + $res = $ldap->add($new_data); + + /* Display warning if copy failed */ + if(!$res){ + print_red(_("Failed to copy '%s' to '%s'. LDAP says '%s'."),$source,$destination,$ldap->get_error()); + }else{ + $res = $ldap->rmDir($source); + show_ldap_error($ldap->get_error(),_("Something went wrong while copying dns.")); + + /* Object is copied, so update its references */ + foreach($ogs_to_fix as $dn => $data){ + $ldap->cd($dn); + $ldap->modify($data); + } + } + } + + + /* Cleanup ldap result to be able to write it be to ldap */ + function cleanup_array($attrs) + { + foreach($attrs as $key => $value) { + if(is_numeric($key) || in_array($key,array("count","dn"))){ + unset($attrs[$key]); + } + if(is_array($value) && isset($value['count'])){ + unset($attrs[$key]['count']); + } + } + return($attrs); + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Schema.inc b/setup/class_setupStep_Schema.inc new file mode 100644 index 000000000..8d22f6ed6 --- /dev/null +++ b/setup/class_setupStep_Schema.inc @@ -0,0 +1,243 @@ +update_strings(); + } + + + function update_strings() + { + $this->s_title = _("LDAP schema check"); + $this->s_title_long = _("LDAP schema check"); + $this->s_info = _("Perform test on your current LDAP schema"); + } + + + function execute() + { + $this->check_schema(); + $failed_checks = 0 ; + foreach($this->checked as $val) { + if(!$val['STATUS']){ + $failed_checks ++; + } + } + + if($failed_checks == 0){ + $this->is_completed = TRUE; + }else{ + $this->is_completed = TRUE; + } + + $smarty = get_smarty(); + $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes"))); + $smarty->assign("schema_readable",$this->schema_readable); + $smarty->assign("enable_schema_check",$this->enable_schema_check); + $smarty->assign("checks",$this->checked); + $smarty->assign("not_checked",$this->not_checked); + $smarty->assign("failed_checks",$failed_checks); + return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl"))); + } + + function check_schema_version($class, $version) + { + return preg_match("/\(v$version\)/", $class['DESC']); + } + + + function save_object() + { + if(isset($_POST['step7_posted'])){ + + /* Get attributes */ + foreach($this->attributes as $attr){ + if(isset($_POST[$attr])){ + $this->$attr = validate($_POST[$attr]); + } + } + } + } + + + function check_schema() + { + $cfg = $this->parent->captured_values; + $messages= array(); + + /* Get objectclasses */ + $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']); + $objectclasses = $ldap->get_objectclasses(); + if(count($objectclasses) == 0){ + print_red(_("Can't get schema information from server. No schema check possible!")); + } + + + /* Which samba version do we use? */ + if(isset($objectclasses['sambaSamAccount'])){ + $this->samba_version = 3; + } elseif(isset($objectclasses['sambaAccount'])) { + $this->samba_version = 2; + }else{ + $this->samba_version = 0; + } + + /* This is the default block used for each entry. + * to avoid unset indexes. + */ + $def_check = array("REQUIRED_VERSION" => "0", + "SCHEMA_FILES" => array(), + "CLASSES_REQUIRED" => array(), + "STATUS" => FALSE, + "IS_MUST_HAVE" => FALSE, + "MSG" => "", + "INFO" => "");#_("There is currently no information specified for this schema extension.")); + + + /* The gosa base schema */ + $checks['gosaObject'] = $def_check; + $checks['gosaObject']['REQUIRED_VERSION'] = "2.4"; + $checks['gosaObject']['SCHEMA_FILES'] = array("gosa+samba3.schema","gosa.schema"); + $checks['gosaObject']['CLASSES_REQUIRED'] = array("gosaObject"); + $checks['gosaObject']['IS_MUST_HAVE'] = TRUE; + + /* GOsa Account class */ + $checks["gosaAccount"]["REQUIRED_VERSION"]= "2.4"; + $checks["gosaAccount"]["SCHEMA_FILES"] = array("gosa+samba3.schema","gosa.schema"); + $checks["gosaAccount"]["CLASSES_REQUIRED"]= array("gosaAccount"); + $checks["gosaAccount"]["IS_MUST_HAVE"] = TRUE; + $checks["gosaAccount"]["INFO"] = _("Used to store account specific informations."); + + /* GOsa lock entry, used to mark currently edited objects as 'in use' */ + $checks["gosaLockEntry"]["REQUIRED_VERSION"] = "2.4"; + $checks["gosaLockEntry"]["SCHEMA_FILES"] = array("gosa+samba3.schema","gosa.schema"); + $checks["gosaLockEntry"]["CLASSES_REQUIRED"] = array("gosaLockEntry"); + $checks["gosaLockEntry"]["IS_MUST_HAVE"] = TRUE; + $checks["gosaLockEntry"]["INFO"] = _("Used to lock currently edited entries to avoid multiple changes at the same time."); + + /* Some other checks */ + foreach(array( + "gosaCacheEntry" => array("version" => "2.4"), + "gosaDepartment" => array("version" => "2.4"), + "goFaxAccount" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), + "goFaxSBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), + "goFaxRBlock" => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"), + "gosaUserTemplate" => array("version" => "2.4", "class" => "posixAccount","file" => "nis.schema"), + "gosaMailAccount" => array("version" => "2.4", "class" => "mailAccount","file" => "gosa+samba3.schema"), + "gosaProxyAccount" => array("version" => "2.4", "class" => "proxyAccount","file" => "gosa+samba3.schema"), + "gosaApplication" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), + "gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"), + "GOhard" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), + "gotoTerminal" => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"), + "goServer" => array("version" => "2.4","class" => "server","file" => "goserver.schema"), + "goTerminalServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), + "goShareServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), + "goNtpServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), + "goSyslogServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), + "goLdapServer" => array("version" => "2.4"), + "goCupsServer" => array("version" => "2.4", "class" => array("posixAccount", "terminals"),), + "goImapServer" => array("version" => "2.4", "class" => array("mailAccount", "mailgroup"),"file" => "gosa+samba3.schema"), + "goKrbServer" => array("version" => "2.4"), + "goFaxServer" => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"), + ) as $name => $values){ + + $checks[$name] = $def_check; + if(isset($values['version'])){ + $checks[$name]["REQUIRED_VERSION"] = $values['version']; + } + if(isset($values['file'])){ + $checks[$name]["SCHEMA_FILES"] = array($values['file']); + } + $checks[$name]["CLASSES_REQUIRED"] = array($name); + } + + foreach($checks as $name => $value){ + foreach($value['CLASSES_REQUIRED'] as $class){ + + if(!isset($objectclasses[$name])){ + $checks[$name]['STATUS'] = FALSE; + if($value['IS_MUST_HAVE']){ + $checks[$name]['MSG'] = sprintf(_("The required objectClass '%s' is not present in your schema setup"),$class); + }else{ + $checks[$name]['MSG'] = sprintf(_("The optional objectClass '%s' is not present in your schema setup"),$class); + } + }elseif(!$this->check_schema_version($objectclasses[$name],$value['REQUIRED_VERSION'])){ + $checks[$name]['STATUS'] = FALSE; + + if($value['IS_MUST_HAVE']){ + $checks[$name]['MSG'] = sprintf(_("The required objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); + }else{ + $checks[$name]['MSG'] = sprintf(_("The optional objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']); + } + }else{ + $checks[$name]['STATUS'] = TRUE; + $checks[$name]['MSG'] = sprintf(_("Class(es) available")); + } + } + } + + $tmp = $objectclasses; + + /* Depending on selected rfc2307bis mode, we need different schema configurations */ + $rfc2307bis = $this->parent->captured_values['rfc2307bis']; + + + /* The gosa base schema */ + $checks['posixGroup'] = $def_check; + $checks['posixGroup']['REQUIRED_VERSION'] = "2.4"; + $checks['posixGroup']['SCHEMA_FILES'] = array("gosa+samba3.schema","gosa.schema"); + $checks['posixGroup']['CLASSES_REQUIRED'] = array("posixGroup"); + $checks['posixGroup']['STATUS'] = TRUE; + $checks['posixGroup']['IS_MUST_HAVE'] = TRUE; + $checks['posixGroup']['MSG'] = ""; + $checks['posixGroup']['INFO'] = ""; + + if(isset($tmp['posixGroup'])){ + + if($rfc2307bis && isset($tmp['posixGroup']['STRUCTURAL'])){ + $checks['posixGroup']['STATUS'] = FALSE; + $checks['posixGroup']['MSG'] = _("You have enabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option."); + $checks['posixGroup']['INFO'] = _("In order to use rfc2307bis conform groups the objectClass 'posixGroup' must be AUXILIARY"); + } + if(!$rfc2307bis && !isset($tmp['posixGroup']['STRUCTURAL'])){ + $checks['posixGroup']['STATUS'] = FALSE; + $checks['posixGroup']['MSG'] = _("You have disabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option."); + $checks['posixGroup']['INFO'] = _("The objectClass 'posixGroup' must be STRUCTURAL"); + } + } + + $this->checked = $checks; + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/class_setupStep_Welcome.inc b/setup/class_setupStep_Welcome.inc new file mode 100644 index 000000000..f030f3121 --- /dev/null +++ b/setup/class_setupStep_Welcome.inc @@ -0,0 +1,71 @@ +is_enabled = TRUE; + $this->is_active = TRUE; + $this->update_strings(); + } + + function update_strings() + { + $this->s_title = _("Welcome"); + $this->s_info = _("The welcome message"); + $this->s_title_long = _("Welcome to GOsa setup wizard"); + } + + function execute() + { + $smarty = get_smarty(); + $smarty->assign('auth_id', session_id()); + return($smarty->fetch(get_template_path("setup_welcome.tpl",TRUE,dirname(__FILE__)))); + } + + function save_object() + { + $id = ""; + + /* Get auth ID from file */ + if (file_exists('/tmp/gosa.auth') && is_readable('/tmp/gosa.auth')){ + $contents= file('/tmp/gosa.auth'); + $id= chop($contents[0]); + } + + /* Continue if we've the correct ID */ + if ($id == session_id()){ + $this->is_completed = true; + } else { + $this->is_completed = false; + } + + } +} + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/license.txt b/setup/license.txt new file mode 100644 index 000000000..9140f02bf --- /dev/null +++ b/setup/license.txt @@ -0,0 +1,147 @@ +Table of Contents + + * GNU GENERAL PUBLIC LICENSE + o Preamble + o TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + o How to Apply These Terms to Your New Programs + +GNU GENERAL PUBLIC LICENSE + +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + * a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + * b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + * c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + * a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + * b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + * c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +END OF TERMS AND CONDITIONS +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + +one line to give the program's name and an idea of what it does. +Copyright (C) yyyy name of author + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + +Gnomovision version 69, Copyright (C) year name of author +Gnomovision comes with ABSOLUTELY NO WARRANTY; for details +type `show w'. This is free software, and you are welcome +to redistribute it under certain conditions; type `show c' +for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright +interest in the program `Gnomovision' +(which makes passes at compilers) written +by James Hacker. + +signature of Ty Coon, 1 April 1989 +Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. + +Linking Joomla! statically or dynamically with other modules is making a combined work based on Joomla!. Thus, the terms and conditions of the GNU General Public License cover the whole combination. + +In addition, as a special exception, the copyright holders of Joomla! give you permission to combine Joomla! with free software programs or libraries that are released under the GNU LGPL and with independent modules that communicate with Joomla! solely through the Joomla! extension interface. You may copy and distribute such a system following the terms of the GNU GPL for Joomla! and the licenses of the other code concerned, provided that you include the source code of that other code when and as the GNU GPL requires distribution of source code. + +Note that people who make modified versions of Joomla! are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU General Public License gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception. diff --git a/setup/main.inc b/setup/main.inc new file mode 100644 index 000000000..bce41ef68 --- /dev/null +++ b/setup/main.inc @@ -0,0 +1,35 @@ +save_object(); +$display= $setup->execute(); + +/* Store changes in session */ +$_SESSION['setup']= $setup; + +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?> diff --git a/setup/setup.tpl b/setup/setup.tpl new file mode 100644 index 000000000..3bb21f795 --- /dev/null +++ b/setup/setup.tpl @@ -0,0 +1,4 @@ +
+{$php_errors} +sadffasdsdfa +
diff --git a/setup/setup_checks.tpl b/setup/setup_checks.tpl new file mode 100644 index 000000000..90275fc27 --- /dev/null +++ b/setup/setup_checks.tpl @@ -0,0 +1,122 @@ + +
+ + +
+ +

{t}PHP module and extension checks{/t}

+ + {foreach from=$basic item=val key=key} + + {if $basic[$key].SOLUTION != "" && !$basic[$key].RESULT} + + +
+ {else} + + +
+ {/if} + +
{$basic[$key].NAME}
+
+ + {if $basic[$key].RESULT} +
{t}Ok{/t}
+ {else} + {if $basic[$key].MUST} +
{t}Error{/t}
+ {else} +
{t}Warning{/t}
+ {/if} + {if $basic[$key].SOLUTION != ""} + + +
+ {if $basic[$key].MUST} +
+ {$basic[$key].SOLUTION} + {t}GOsa will NOT run without fixing this.{/t} + {else} +
+ {$basic[$key].SOLUTION} + {t}GOsa will run without fixing this.{/t} + {/if} +
+
+ {/if} + {/if} +
+
+ {/foreach} +
+
+ + + +
+ + +
+ + +

{t}PHP setup configuration{/t} ({t}show information{/t})

+ + + {foreach from=$config item=val key=key} + + + {if $config[$key].SOLUTION != "" && !$config[$key].RESULT} + + +
+ {else} + + +
+ {/if} + + +
{$config[$key].NAME}
+
+ {if $config[$key].RESULT} +
{t}Ok{/t}
+ {else} + + {if $config[$key].MUST} +
{t}Error{/t}
+ {else} +
{t}Warning{/t}
+ {/if} + + {if $config[$key].SOLUTION != ""} + + +
+ {if $config[$key].MUST} +
+ {$config[$key].SOLUTION} + {t}GOsa will NOT run without fixing this.{/t} + {else} +
+ {$config[$key].SOLUTION} + {t}GOsa will run without fixing this.{/t} + {/if} +
+
+ {/if} + {/if} +
+
+ {/foreach} + + +
+
+ +
+ diff --git a/setup/setup_config1.tpl b/setup/setup_config1.tpl new file mode 100644 index 000000000..c6072ccfb --- /dev/null +++ b/setup/setup_config1.tpl @@ -0,0 +1,213 @@ +
+

{t}Look and feel{/t}

+ +
+
+ {t}Theme{/t} +
+
+ +
+
+ +

{t}People and group storage{/t}

+
+
+ {t}People DN attribute{/t} +
+
+ +
+
+ +
+
+ {t}People storage subtree{/t} +
+
+ +
+
+ +
+
+ {t}Group storage subtree{/t} +
+
+ +
+
+ +
+
+ {t}Include personal title in user DN{/t} +
+
+ +
+
+ +
+
+ {t}Relaxed naming policies{/t} +
+
+ +
+
+ +
+
+ {t}Automatic uids{/t} +
+
+ {if $id_settings.idgen_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}GID / UID min id{/t} +
+
+ {if $id_settings.minid_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Number base for people/groups{/t} +
+
+ +
+
+
+
+ {t}Hook for number base{/t} +
+
+ {if $base_hook_active == FALSE} + + + {else} + + + {/if} +
+
+
+ +

{t}Password settings{/t}

+ +
+
+ {t}Password encryption algorithm{/t} +
+
+ +
+
+ +
+
+ {t}Password restrictions{/t} +
+
+ + {if $pwd_rules.pwminlen_active == FALSE} + + {t}Password minimum length{/t} + + {else} + + {t}Password minimum length{/t} + + {/if} +
+ {if $pwd_rules.pwdiffer_active == FALSE} + + {t}Different characters from old password{/t} + + {else} + + {t}Different characters from old password{/t} + + {/if} + +
+
+ +
+
+ {t}Password change hook{/t} +
+
+ {if $pwd_rules.externalpwdhook_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Use SASL for kerberos{/t} +
+
+ +
+
+ +
+
+ {t}Use account expiration{/t} +
+
+ +
+
+ + + + + diff --git a/setup/setup_config2.tpl b/setup/setup_config2.tpl new file mode 100644 index 000000000..5b35c4ecb --- /dev/null +++ b/setup/setup_config2.tpl @@ -0,0 +1,238 @@ +
+

{t}Samba settings{/t}

+ +
+
+ {t}Samba hash generator{/t} +
+
+ +
+
+ +
+
+ {t}Samba SID{/t} +
+
+ {if $samba_settings.samba_sid_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}RID base{/t} +
+
+ {if $samba_settings.samba_rid_active == FALSE} + + + {else} + + + {/if} +
+
+
+
+ {t}Workstation container{/t} +
+
+ {if $generic_settings.wws_ou_active == FALSE} + + + {else} + + + {/if} +
+
+
+
+ {t}Samba SID mapping{/t} +
+
+ +
+
+ +

{t}Additional GOsa settings{/t}

+ +
+
+ {t}Enable Copy & Paste{/t} +
+
+ + +
+
+ +
+
+ {t}Government mode{/t} +
+
+ +
+
+ +

{t}Mail settings{/t}

+ +
+
+ {t}Mail method{/t} +
+
+ +
+
+
+
+ +
+
+ {t}Vacation templates{/t} +
+
+ {if $mail_settings.vacationdir_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Use Cyrus UNIX style{/t} +
+
+ +
+
+ + +

{t}Snapshots / Undo{/t}

+ {if $generic_settings.snapshot_active == FALSE} +
+
+ {t}Enable snapshots{/t} +
+
+
+
+
+ {t}Snapshot base{/t} +
+
+ +
+
+
+
+ {t}Server{/t} +
+
+ +
+
+
+
+ {t}User{/t} +
+
+ +
+
+
+
+ {t}Password{/t} +
+
+ +
+
+
+ + {else} +
+
+ {t}Enable snapshots{/t} +
+
+
+
+
+ {t}Snapshot base{/t} +
+
+ +
+
+
+
+ {t}Server{/t} +
+
+ +
+
+
+
+ {t}User{/t} +
+
+ +
+
+
+
+ {t}Password{/t} +
+
+ +
+
+
+ {/if} +
+ + +
diff --git a/setup/setup_config3.tpl b/setup/setup_config3.tpl new file mode 100644 index 000000000..5a878fedf --- /dev/null +++ b/setup/setup_config3.tpl @@ -0,0 +1,235 @@ +
+

{t}GOsa core settings{/t}

+ +
+
+ {t}Disable primary group filter{/t} +
+
+ + +
+
+ +
+
+ {t}Honour administrative units{/t} +
+
+ + +
+
+ +
+
+ {t}Smarty compile directory{/t} +
+
+ +
+
+
+
+ {t}Path for PPD storage{/t} +
+
+ {if $optional.ppd_path_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Path for kiosk profile storage{/t} +
+
+ {if $optional.kioskpath_active == FALSE} + + + {else} + + + {/if} +
+
+ + +
+
+ {t}Network resolv hook{/t} +
+
+ {if $optional.auto_network_hook_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Mail queue script{/t} +
+
+ {if $optional.mailQueueScriptPath_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Notification script{/t} +
+
+ {if $optional.notifydir_active == FALSE} + + + {else} + + + {/if} +
+
+ +

{t}Login and session{/t}

+
+
+ {t}Enforce register_globals to be activated{/t} +
+
+ + +
+
+ +
+
+ {t}Enforce encrypted connections{/t} +
+
+ + +
+
+ +
+
+ {t}Warn if session is not encrypted{/t} +
+
+ + +
+
+ +
+
+ {t}Session lifetime{/t} +
+
+ +
+
+ +

{t}Debugging{/t}

+ +
+
+ {t}Show PHP errors{/t} +
+
+ +
+
+ + +
+
+ {t}Maximum LDAP query time{/t} +
+
+ {if $optional.max_ldap_query_time_active == FALSE} + + + {else} + + + {/if} +
+
+ +
+
+ {t}Log LDAP statistics{/t} +
+
+ + +
+
+ +
+
+ {t}Debug level{/t} +
+
+ +
+
+
+ + diff --git a/setup/setup_feedback.tpl b/setup/setup_feedback.tpl new file mode 100644 index 000000000..20fae54e6 --- /dev/null +++ b/setup/setup_feedback.tpl @@ -0,0 +1,144 @@ +
+ +

{$additional_info}

+ +

+  {t}Subscribe to the gosa-announce mailinglist{/t} +

+

+ {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to subscribe you to the gosa-announce mailing list. You've to confirm this by mail.{/t} +

+
+ + + + + + + + + + + + +
+ {t}Organization{/t} + + +
+ {t}Name{/t} + + +
+ {t}Mail address{/t}{$must} + + +
+ + +

 

+

+  {t}Send feedback to the GOsa project team{/t} +

+

+ {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to submit your form anonymously.{/t} +

+ {t}Generic{/t} + + + + + + + + + + + + + + + + + + + + + + + + + +
+ {t}Did the setup procedure help you to get started?{/t} + + {t}Yes{/t} +
+ {t}No{/t} +
+ {t}If not, what problems did you encounter{/t}: + + +
+ {t}Is this the first time you use GOsa?{/t} + + {t}Yes{/t} +
+ {t}No{/t}, + {t}I use it since{/t} + +
+ {t}What operating system / distribution do you use?{/t} + + +
+ {t}What web server do you use?{/t} + + +
+ {t}What PHP version do you use?{/t} + + +
+ +
{t}LDAP{/t} + + + + + + + + + +
+ {t}What kind of LDAP server(s) do you use?{/t} + +
{t}How many objects are in your LDAP?{/t} + +
+ +
{t}Features{/t} + + + + + + + + + +
{t}What features of GOsa do you use?{/t} + + {foreach from=$features_used item=data key=key} + + {$data.NAME}
+ {/foreach} +
{t}What features do you want to see in future versions of GOsa?{/t} + +
+ + + diff --git a/setup/setup_finish.tpl b/setup/setup_finish.tpl new file mode 100644 index 000000000..87b6732d3 --- /dev/null +++ b/setup/setup_finish.tpl @@ -0,0 +1,23 @@ +
+

+ {t}Create your configuration file{/t} +

+

+ {$msg2} +

+ + chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}
+ chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE} +
+

+ +

+ {if $err_msg != ""} +

 

+
+ {t}Status: {/t} + {$err_msg} + {/if} + +
+ diff --git a/setup/setup_frame.tpl b/setup/setup_frame.tpl new file mode 100644 index 000000000..296870743 --- /dev/null +++ b/setup/setup_frame.tpl @@ -0,0 +1,46 @@ + +{$php_errors} +
+ +
+
+
GOsa
+
{$version}
+
+
+ {t}GOsa setup wizard{/t} +
+ +
+ +
+
+ {t}Installation{/t}  {t}Steps{/t} +
+ {$navigation} +
+ +
+
+ {$errors} + {$header} +
+
+ {$contents} + {$bottom} +
+
+
+
+
+
+ + + +
+ + + + diff --git a/setup/setup_language.tpl b/setup/setup_language.tpl new file mode 100644 index 000000000..6d1b30b98 --- /dev/null +++ b/setup/setup_language.tpl @@ -0,0 +1,13 @@ +
+
+

{t}Please select the preferred language{/t}

+

+ {t}At this point, you can select the site wide default language. Choosing 'automatic' will use the language requested by the browser. This setting can be overriden per user.{/t} +

+
+
+ +
+
diff --git a/setup/setup_ldap.tpl b/setup/setup_ldap.tpl new file mode 100644 index 000000000..a753c8a4c --- /dev/null +++ b/setup/setup_ldap.tpl @@ -0,0 +1,135 @@ +
+ + {if $resolve_user} + +
+

+ {t}Please choose the LDAP user to be used by GOsa{/t} +

+ + + +

 

+
+ + +
+
+ +
+ + {else} +

+ {t}LDAP connection{/t} +

+
+
+ {t}Location name{/t} +
+
+ +
+
+
+
+
{t}Connection URL{/t}
+
+
+ +
+
+
+
+ {t}TLS connection{/t} +
+
+ +
+
+
+
+ {t}Base{/t} +
+
+ {if $namingContextsCount >= 1} + + {else} + + {/if} + +
+
+

+ {t}Authentication{/t} +

+
+
+ {t}Admin DN{/t} +
+
+ + +
+
+ +
+
+
+
+  {t}Automatically append LDAP base to admin DN{/t} +
+
+ + +
+
+ {t}Admin password{/t} +
+
+ +
+
+ +

+ {t}Schema based settings{/t} +

+
+
+ {t}Use rfc2307bis compliant groups{/t} +
+
+ +
+
+ {/if} + + {if ! $resolve_user} +

+ {t}Current status{/t} +

+
+
+ {t}Information{/t} +
+
+ {$connection_status} +
+
+ {/if} + +
+ + + diff --git a/setup/setup_license.tpl b/setup/setup_license.tpl new file mode 100644 index 000000000..c0c189636 --- /dev/null +++ b/setup/setup_license.tpl @@ -0,0 +1,7 @@ +
+
+
+ {$License} +
+
+
diff --git a/setup/setup_migrate.tpl b/setup/setup_migrate.tpl new file mode 100644 index 000000000..e2f5dd34a --- /dev/null +++ b/setup/setup_migrate.tpl @@ -0,0 +1,394 @@ +
+
+ + {if $method == "default"} +

{t}During the LDAP inspection, we're going to check for several common pitfalls that may occur when migration to GOsa base LDAP administration. You may want to fix the problems below, in order to provide smooth services.{/t} +

+ + {foreach from=$checks item=val key=key} +
+ + {if $checks.$key.ERROR_MSG} + +
+ {else} + +
+ {/if} +
{$checks.$key.TITLE}
+
+ {if $checks.$key.STATUS} +
{$checks.$key.STATUS_MSG}
+ {else} +
{$checks.$key.STATUS_MSG}
+ {/if} +
+ {if $checks.$key.ERROR_MSG} + {$checks.$key.ERROR_MSG} + {/if} +
+
+ {/foreach} +
+ + + {elseif $method == "outside_winstations"} + +

{t}Move windows workstations into a valid windows workstation department{/t}

+ + {t}This dialog allows you to move the displayed windows workstations into a valid department{/t} +
+ {t}Be careful with this tool, there may be references pointing to this workstations that can't be migrated.{/t} +
+
+ + {foreach from=$outside_winstations item=val key=key} + {if $outside_winstations.$key.selected} + + {else} + + {/if} + +  {$outside_winstations.$key.dn} + {if $outside_winstations.$key.ldif != ""} +
+
+
+								{$outside_winstations.$key.ldif}
+							
+
+
+ {/if} +
+ {/foreach} + + +

+ {t}Move selected windows workstations into the following GOsa department{/t} : + +
+ + +

+ + +

 

+
+ +
+ + + {elseif $method == "outside_groups"} + +

{t}Move groups into configured group tree{/t}

+ +

+ {t}This dialog allows moving a couple of groups to the configured group tree. Doing this may straighten your LDAP service.{/t} +

+

+ {t}Be careful with this option! There may be references pointing to these groups. The GOsa setup can't migrate references, so you may want to cancel the migration in this case in this case.{/t} +

+

+ {t}Move selected groups into this group tree{/t}: + +

+ + {foreach from=$outside_groups item=val key=key} + {if $outside_groups.$key.selected} + + {else} + + {/if} + +  {$outside_groups.$key.dn} + {if $outside_groups.$key.ldif != "" && $group_details} +
+
+
+{$outside_groups.$key.ldif}
+
+
+
+ {/if} +
+ {/foreach} + +

+ + + {if $group_details} + + {else} + + {/if} +

+ +

 

+
+ +   + +
+ + {elseif $method == "outside_users"} + +

{t}Move users into configured user tree{/t}

+

+ {t}This dialog allows moving a couple of users to the configured user tree. Doing this may straighten your LDAP service.{/t} +

+

+ {t}Be careful with this option! There may be references pointing to these users. The GOsa setup can't migrate references, so you may want to cancel the migration in this case.{/t} +

+

+ {t}Move selected users into this people tree{/t}: + +

+ {foreach from=$outside_users item=val key=key} + {if $outside_users.$key.selected} + + {else} + + {/if} + +  {$outside_users.$key.dn} + {if $outside_users.$key.ldif != "" && $user_details} +
+
+
+{$outside_users.$key.ldif}
+
+
+
+ {/if} +
+ {/foreach} +
+ + + + {if $user_details} + + {else} + + {/if} + +

 

+
+ +   + +
+ + + {elseif $method == "create_acls"} + + {if $acl_create_selected != "" && $what_will_be_done_now!=""} +
+
+{$what_will_be_done_now}
+
+
+ + + {else} +

{t}Create a new GOsa administrator account{/t}

+ +

+ {t}This dialog will automatically add a new super administrator to your LDAP tree.{/t} +

+ + + + + + + + + + + + + + + + + +
+ {t}Name{/t}:  + + System administrator +
+ {t}User ID{/t}:  + + admin +
+ {t}Password{/t}:  + +
+
+ {t}Password (again){/t}:  + +
+
+ + + + + + {if $users_cnt != 0 || $groups_cnt != 0} + +

{t}Assign super administrator permissions to an existing user or group{/t}

+

{t}To grant administrative permissions to a user or a group, select an object and choose 'Assign'.{/t}

+ + + + {/if} +

 

+ +
+ +
+ + {/if} + + + + {elseif $method == "migrate_deps"} + +

Department migration

+ +

{t}The listed departments are currenlty invisble in the GOsa user interface. If you want to change this for a couple of entries, select them and use the migrate button below.{/t}

+

{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}

+ + {foreach from=$deps_to_migrate item=val key=key} + + {if $deps_to_migrate.$key.checked} + + {$deps_to_migrate.$key.dn} + {if $deps_to_migrate.$key.after != ""} +
+ +{t}Current{/t} +
+
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.before}
+
+
+{t}After migration{/t} +
+
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.after}
+
+
+
+ {/if} + {else} + + {$deps_to_migrate.$key.dn} + {/if} + + + {/foreach} + +
+ + + + {if $deps_details} + + {else} + + {/if} + +

 

+ +
+ +   + +
+ {elseif $method == "migrate_users"} + +

User migration

+ +

{t}The listed users are currenlty invisble in the GOsa user interface. If you want to change this for a couple of users, just select them and use the 'Migrate' button below.{/t}

+

{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}

+ {foreach from=$users_to_migrate item=val key=key} + + {if $users_to_migrate.$key.checked} + + {$users_to_migrate.$key.dn} + {if $users_to_migrate.$key.after != ""} +
+ +{t}Current{/t} +
+
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.before}
+
+
+{t}After migration{/t} +
+
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.after}
+
+
+
+ {/if} + {else} + + {$users_to_migrate.$key.dn} + {/if} + +
+ + + {/foreach} +
+ + + + {if $user_details} + + {else} + + {/if} + +

 

+ +
+ +   + +
+ {/if} +
+
diff --git a/setup/setup_schema.tpl b/setup/setup_schema.tpl new file mode 100644 index 000000000..e56538b1e --- /dev/null +++ b/setup/setup_schema.tpl @@ -0,0 +1,40 @@ +
+

+ {t}Schema specific settings{/t} +

+
+
+ {t}Enable schema validation when logging in{/t} +
+
+ +
+
+

+ {t}Check status{/t} +

+
+ {if $failed_checks == 0} + {t}Schema check succeeded{/t} + {else} + + {t}Schema check failed{/t} + {/if} +
+
+ {foreach from=$checks item=val key=key} + {if !$checks[$key].STATUS} +
+ {if $checks[$key].IS_MUST_HAVE} + {$checks[$key].MSG} + {else} + {$checks[$key].MSG} + {/if} +
+ {/if} + {/foreach} +
+
+ diff --git a/setup/setup_welcome.tpl b/setup/setup_welcome.tpl new file mode 100644 index 000000000..e6f76c7b6 --- /dev/null +++ b/setup/setup_welcome.tpl @@ -0,0 +1,37 @@ +
+
+

+ {t}This seems to be the first time you start GOsa - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t} +

+ +

+ {t}What will the wizard do for you?{/t} +

+
    +
  • {t}Create a basic, single site configuration{/t}
  • +
  • {t}Tries to find problems within your PHP and LDAP setup{/t}
  • +
  • {t}Let you choose from a set of basic and advanced configuration switches{/t}
  • +
  • {t}Guided migration of existing LDAP trees{/t}
  • +
+

+ {t}What will the wizard NOT do for you?{/t} +

+
    +
  • {t}Find every possible configuration error{/t}
  • +
  • {t}Migrate every possible LDAP setup - create backup dumps!{/t}
  • +
+ +

+ {t}To continue...{/t} +

+

+ {t}For security reasons you need to authenticate for the installation by creating the file '/tmp/gosa.auth', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t} +

+ + echo -n {$auth_id} > /tmp/gosa.auth + +

+ {t}Click the 'Continue' button when you've finished.{/t} +

+
+
-- 2.30.2