diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index 087dd265e9ccae9a3a259b66c40063ae4f495240..6ae00e89623831ee284932bf2f6f8a8f13cb2410 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
}
if($this->error != "Success"){
- /* Some error occured */
+ /* Some error occurred */
print "---------------------------------------------";
print $this->get_error()."<br>";
print $sourcedn."<br>";
}
$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;
*/
function import_single_entry($str_attr,$modify,$delete)
{
+ global $config;
+
+ if(!$config){
+ trigger_error("Can't import ldif, can't read config object.");
+ }
+
+
if($this->reconnect) $this->connect();
$ret = false;
/* Create missing trees */
$this->cd ($this->basedn);
- $this->create_missing_trees($data['dn']);
+ $this->cd($config->current['BASE']);
+ $this->create_missing_trees(preg_replace("/^[^,]+,/","",$data['dn']));
$this->cd($data['dn']);
$dn = $data['dn'];
function get_objectclasses()
{
$objectclasses = array();
-
+ global $config;
+
+ /* Only read schema if it is allowed */
+ if(isset($config) && preg_match("/config/i",get_class($config))){
+ if(!isset($config->data['MAIN']['SCHEMA_CHECK']) || !preg_match("/true/i",$config->data['MAIN']['SCHEMA_CHECK'])){
+ return($objectclasses);
+ }
+ }
+
# Get base to look for schema
$sr = @ldap_read ($this->cid, NULL, "objectClass=*", array("subschemaSubentry"));
if(!$sr){
}
}
-
return $objectclasses;
}
function get_naming_contexts($server, $admin= "", $password= "")
{
- $attr= $this->get_root_dse($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']);
}
$sr = @ldap_read ($ds, "", "objectClass=*", array("+"));
$attr= @ldap_get_entries($ds,$sr);
- print_a($attr);
+ /* Return empty array, if nothing was set */
+ if (!isset($attr[0])){
+ return array();
+ }
+
+ /* Rework array... */
+ $result= array();
+ for ($i= 0; $i<$attr[0]['count']; $i++){
+ $result[$attr[0][$i]]= $attr[0][$attr[0][$i]];
+ unset($result[$attr[0][$i]]['count']);
+ }
- return ($attr);
+ return ($result);
}