From: hickert Date: Fri, 5 May 2006 03:39:18 +0000 (+0000) Subject: Updated setup schema check with new ldap::get_objectclasses() X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c9759b2a40146ba0d3c244c3bc4f212f71c08ab6;p=gosa.git Updated setup schema check with new ldap::get_objectclasses() git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3200 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/functions_setup.inc b/include/functions_setup.inc index eb63ea93b..fbee382bc 100644 --- a/include/functions_setup.inc +++ b/include/functions_setup.inc @@ -92,35 +92,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'])){