summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib_ldap.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/user_ldap/lib_ldap.php')
-rw-r--r--apps/user_ldap/lib_ldap.php21
1 files changed, 16 insertions, 5 deletions
diff --git a/apps/user_ldap/lib_ldap.php b/apps/user_ldap/lib_ldap.php
index aa104eb5126..c88b18b10d3 100644
--- a/apps/user_ldap/lib_ldap.php
+++ b/apps/user_ldap/lib_ldap.php
@@ -471,11 +471,22 @@ class OC_LDAP {
if(!is_null($attr) && !is_array($attr)) {
$attr = array(strtolower($attr));
}
- $sr = @ldap_search(self::getConnectionResource(), $base, $filter, $attr);
- $findings = @ldap_get_entries(self::getConnectionResource(), $sr );
- // if we're here, probably no connection ressource is returned.
- // to make ownCloud behave nicely, we simply give back an empty array.
- if(is_null($findings)) {
+
+ // See if we have a resource
+ $link_resource = self::getConnectionResource();
+ if($link_resource)
+ {
+ $sr = ldap_search($link_resource, $base, $filter, $attr);
+ $findings = ldap_get_entries($link_resource, $sr );
+ // if we're here, probably no connection resource is returned.
+ // to make ownCloud behave nicely, we simply give back an empty array.
+ if(is_null($findings)) {
+ return array();
+ }
+ } else
+ {
+ // Seems like we didn't find any resource.
+ // Return an empty array just like before.
return array();
}