From 71164a7278ea9607f9a22173ee67304baa48ce95 Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 2 May 2007 09:01:48 +0000 Subject: [PATCH] Added return values git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6223 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_ldap.inc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 1a8ec8050..087dd265e 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -773,8 +773,13 @@ class LDAP{ $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; } @@ -1364,17 +1369,7 @@ class LDAP{ 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("namingContexts", )); - $attr= @ldap_get_entries($ds,$sr); + $attr= $this->get_root_dse($server, $admin, $password); return ($attr[0]['namingcontexts']); } -- 2.30.2