X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Ffunctions_setup.inc;h=cabcbbdb1c9128883b402e4fe900c3d2757a03c0;hb=c0eb555e5c33de4b0c5277d7c7b6593a4fcdb928;hp=2a15513042c0f5d903b800a54893eddb28919890;hpb=5f305cccde524d528bff44b9c3d51fe4822f0cf4;p=gosa.git diff --git a/include/functions_setup.inc b/include/functions_setup.inc index 2a1551304..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, NULL, "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,8 +63,8 @@ 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"), "goShareServer" => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"), @@ -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, NULL, "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'])){ @@ -247,6 +210,16 @@ function schema_check($server, $admin, $password, $aff=0,$CalledByIndexPhP=false $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']."