X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions_setup.inc;h=cabcbbdb1c9128883b402e4fe900c3d2757a03c0;hb=c0eb555e5c33de4b0c5277d7c7b6593a4fcdb928;hp=10a8fece664d33258d5781bd772661c322a7e4f4;hpb=ebbe88a10bc961428d01ddbfff6923f308f7851c;p=gosa.git
diff --git a/include/functions_setup.inc b/include/functions_setup.inc
index 10a8fece6..cabcbbdb1 100644
--- a/include/functions_setup.inc
+++ b/include/functions_setup.inc
@@ -32,28 +32,13 @@ function view_schema_check($table)
function is_schema_readable($server, $admin, $password)
{
- $ds= ldap_connect ($server);
- if (!$ds) {
- return (false);
- }
- ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- $r= ldap_bind ($ds, $admin, $password);
-
- /* Get base to look for schema */
- $sr = @ldap_read ($ds, "", "objectClass=*", array("subschemaSubentry"));
- $attr= @ldap_get_entries($ds,$sr);
- if (!isset($attr[0]['subschemasubentry'][0])){
- return (false);
- }
+ $ldap = new LDAP($admin,$password,$server);
+ $tmp = $ldap->get_objectclasses();
- $nb= $attr[0]['subschemasubentry'][0];
- $objectclasses= array();
- $sr= ldap_read ($ds, $nb, "objectClass=*", array("objectclasses"));
- $attrs= ldap_get_entries($ds,$sr);
- if (!isset($attrs[0])){
- return (false);
+ if(count($tmp)){
+ return(true);
}
- return(true);
+ return(false);
}
function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false)
@@ -78,11 +63,11 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
"gosaApplication" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
"gosaApplicationGroup" => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
- "GOhard" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
- "gotoTerminal" => array("version" => "2.0", "class" => "terminals","file" => "goto.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"),
- "goNfsServer" => 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"),
@@ -92,35 +77,13 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
"goFaxServer" => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"),
);
- /* Build LDAP connection */
- $ds= ldap_connect ($server);
- if (!$ds) {
- return (array(array("msg" => _("Can't bind to LDAP. No schema check possible!"), "status" => FALSE)));
- }
- ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- $r= ldap_bind ($ds, $admin, $password);
-
- /* Get base to look for schema */
- $sr = @ldap_read ($ds, "", "objectClass=*", array("subschemaSubentry"));
- $attr= @ldap_get_entries($ds,$sr);
- if (!isset($attr[0]['subschemasubentry'][0])){
+ /* Get objectclasses */
+ $ldap = new LDAP($admin,$password, $server);
+ $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)));
}
- /* Get list of objectclasses */
- $nb= $attr[0]['subschemasubentry'][0];
- $objectclasses= array();
- $sr= ldap_read ($ds, $nb, "objectClass=*", array("objectclasses"));
- $attrs= ldap_get_entries($ds,$sr);
- if (!isset($attrs[0])){
- return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
- }
- foreach ($attrs[0]['objectclasses'] as $val){
- $name= preg_replace("/^.* NAME\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $val);
- if ($name != $val){
- $objectclasses[$name]= $val;
- }
- }
/* Walk through objectclasses and check if they are needed or not */
foreach ($required_classes as $key => $value){
if (isset($value['class'])){
@@ -216,6 +179,16 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
$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");
@@ -226,11 +199,31 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false
$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((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");
@@ -281,6 +274,7 @@ function perform_php_checks(&$faults)
$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);
@@ -288,55 +282,103 @@ function perform_php_checks(&$faults)
$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."),
- function_exists('ldap_bind'));
+ is_callable('ldap_bind'));
$msg.= check ( $faults, _("Checking for XML functions"),
_("XML functions are required to parse the configuration file."),
- function_exists('xml_parser_create'));
+ is_callable('xml_parser_create'));
$msg.= check ( $faults, _("Checking for gettext support"),
- _("Gettext support is required for internationalized GOsa."), function_exists('bindtextdomain'));
+ _("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."),
- function_exists('iconv'));
+ 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."),
- function_exists('mhash'), FALSE);
+ 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."),
- function_exists('imap_open'));
+ 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."),
- function_exists('imap_getacl'), FALSE);
+ is_callable('imap_getacl'), FALSE);
$msg.= check ( $faults, _("Checking for mysql module"),
_("MySQL support is needed for reading GOfax reports from databases."),
- function_exists('mysql_query'), FALSE);
+ 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."),
- function_exists('cups_get_dest_list'), FALSE);
+ 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."),
- function_exists('kadm5_init_with_password'), FALSE);
+ is_callable('kadm5_init_with_password'), FALSE);
$msg.= check ( $faults, _("Checking for snmp Module"),
_("Simple Network Management Protocol (SNMP) is required for client monitoring."),
- function_exists('snmpget'), FALSE);
+ 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")."
";
@@ -450,19 +492,21 @@ function parse_contrib_conf()
}
/* Look for samba password generation method */
- if(file_exists("/usr/lib/gosa/mkntpasswd")){
- $pwdhash = "/usr/lib/gosa/mkntpasswd";
+ 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 "ntlmgen \"\$ARGV[0]\", \$lm, \$nt; print \"\${lm}:\${nt}\n\";" $1');
}
+
/* 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'];
@@ -487,6 +531,8 @@ function parse_contrib_conf()
$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 */
@@ -534,7 +580,7 @@ function parse_contrib_conf()
}
/* Data readed, types replaced, samba version detected and checked if
- we need to add SID and RIDBASE. Check if there is an ivbbEntry in
+ 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. */
@@ -543,7 +589,7 @@ function parse_contrib_conf()
}
/* Try to find a Samba Domain Objekt */
- $ldap->search("(objectClass=ivbbEntry)");
+ $ldap->search("(objectClass=ivbbentry)");
/* Something found ??? so we need to define ridbase an SID by ourselfs */
if($ldap->count()> 0) {
@@ -559,11 +605,10 @@ function parse_contrib_conf()
$str = str_replace("mailMethod=\"{MAILMETHOD}\"","",$str);
}
-
/* Remove all unused plugins */
- foreach($possible_plugins as $key=> $plugin) {
- foreach($plugin as $key=>$val) {
- if(in_array($plugin,$classes)) {
+ 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);
}
}
@@ -577,9 +622,11 @@ function parse_contrib_conf()
/* Show setup_page 1 */
function show_setup_page1($withoutput = true)
{
+ $faults = array();
$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($faults));
/* This var is true if anything went wrong */
if ($faults){
@@ -606,6 +653,7 @@ function show_setup_page1($withoutput = true)
/* Show setup_page 2 */
function show_setup_page2($withoutput = true)
{
+ $faults = array();
$smarty = get_smarty();
$smarty->assign ("content", get_template_path('setup_step2.tpl'));
$smarty->assign ("tests", perform_additional_checks($faults));
@@ -629,6 +677,7 @@ function show_setup_page2($withoutput = true)
function show_setup_page3($withoutput = true)
{
+ $ds = NULL;
$smarty = get_smarty();
/* Take the Post oder the Sessioin saved data */
@@ -716,6 +765,7 @@ function show_setup_page4($withoutput = true)
{
$smarty= get_smarty();
+ // ?
if(!isset($_SESSION['ldapconf']['base'])){
$_SESSION['ldapconf']['base']= $base;
}
@@ -763,14 +813,14 @@ function show_setup_page4($withoutput = true)
print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
}
} else {
- $sr= @ldap_search ($ds, "", "objectClass=*", array("namingContexts"));
+ $sr= @ldap_search ($ds, NULL, "objectClass=*", array("namingContexts"));
$attr= @ldap_get_entries($ds,$sr);
if((empty($attr))) {
$base= "dc=example,dc=net";
if($withoutput){
- print_red(_("Bind to server successful, but the server seems to be completly empty, please check all informations twice"));
+ print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
}
} else {
@@ -1104,7 +1154,7 @@ function create_user_for_setup($withoutput=true)
return(true);
} else {
- if(!($create_user)) {
+ if((!isset($create_user))||(!($create_user))) {
$smarty->assign ("content", get_template_path('setup_useradmin.tpl'));
$smarty->assign("exists",true);
} else {