summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2012-07-25 18:40:48 +0200
committerArthur Schiwon <blizzz@owncloud.com>2012-07-25 18:40:48 +0200
commitb94631de0cf16d0ffc83dd2e805efe275d119be6 (patch)
tree1372e98070b6f5eeac6e2f0ccae7784a9107252b /apps/user_ldap/lib
parentd17eb2983f46b1a2e72f0c3c2d7cfce40f47f653 (diff)
downloadnextcloud-server-b94631de0cf16d0ffc83dd2e805efe275d119be6.tar.gz
nextcloud-server-b94631de0cf16d0ffc83dd2e805efe275d119be6.zip
LDAP: check if php-ldap is installed. If not, give an error output. FIX: blank Users page when the module is not installed.
Diffstat (limited to 'apps/user_ldap/lib')
-rw-r--r--apps/user_ldap/lib/access.php4
-rw-r--r--apps/user_ldap/lib/connection.php10
2 files changed, 14 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 870f6330edd..19122b34c7d 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -48,6 +48,10 @@ abstract class Access {
return false;
}
$cr = $this->connection->getConnectionResource();
+ if(!is_resource($cr)) {
+ //LDAP not available
+ return false;
+ }
$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);
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index c8ba9dad70e..e54a8e2b241 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -211,11 +211,21 @@ class Connection {
* Connects and Binds to LDAP
*/
private function establishConnection() {
+ static $phpLDAPinstalled = true;
+ if(!$phpLDAPinstalled) {
+ return false;
+ }
if(!$this->configured) {
\OCP\Util::writeLog('user_ldap', 'Configuration is invalid, cannot connect', \OCP\Util::WARN);
return false;
}
if(!$this->ldapConnectionRes) {
+ if(!function_exists('ldap_connect')) {
+ $phpLDAPinstalled = false;
+ \OCP\Util::writeLog('user_ldap', 'function ldap_connect is not available. Make sure that the PHP ldap module is installed.', \OCP\Util::ERROR);
+
+ return false;
+ }
$this->ldapConnectionRes = ldap_connect($this->config['ldapHost'], $this->config['ldapPort']);
if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {