summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-07-25 12:54:23 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-07-25 12:56:09 +0200
commitb10f7aafb7fcf31af86795d45a8d227540dfb0fe (patch)
tree285f61088fc12d0bdb8a5f231cedf7186b77ae04 /apps
parent25ad1d5c3e92228e6274b5b765e3fa5d47ece04b (diff)
downloadnextcloud-server-b10f7aafb7fcf31af86795d45a8d227540dfb0fe.tar.gz
nextcloud-server-b10f7aafb7fcf31af86795d45a8d227540dfb0fe.zip
LDAP: silence warning, but handle the error
Diffstat (limited to 'apps')
-rw-r--r--apps/user_ldap/lib/access.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index eef471f1598..ff94b00a842 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -48,7 +48,12 @@ abstract class Access {
return false;
}
$cr = $this->connection->getConnectionResource();
- $rr = ldap_read($cr, $dn, 'objectClass=*', array($attr));
+ $rr = @ldap_read($cr, $dn, 'objectClass=*', array($attr));
+ if(!is_resource($rr)) {
+ \OCP\Util::writeLog('user_ldap', 'readAttribute failed for DN '.$dn, \OCP\Util::DEBUG);
+ //in case an error occurs , e.g. object does not exist
+ return false;
+ }
$er = ldap_first_entry($cr, $rr);
//LDAP attributes are not case sensitive
$result = \OCP\Util::mb_array_change_key_case(ldap_get_attributes($cr, $er), MB_CASE_LOWER, 'UTF-8');