summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-08-18 13:33:59 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-09-27 13:34:15 +0200
commit1a020e0696b5b2876044f419c7f02525b0bb9942 (patch)
tree581f373b32516b83bd64e7222a0c243af77cc5bf /apps/user_ldap
parentf47ff13abf65f0c66082333a55b8a108697aae97 (diff)
downloadnextcloud-server-1a020e0696b5b2876044f419c7f02525b0bb9942.tar.gz
nextcloud-server-1a020e0696b5b2876044f419c7f02525b0bb9942.zip
Resolve merge conflict
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/connection.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index e5d9b4d5b40..42139274666 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -23,7 +23,7 @@
namespace OCA\user_ldap\lib;
-class Connection {
+class Connection extends BackendBase {
private $ldapConnectionRes = null;
private $configPrefix;
private $configID;
@@ -78,6 +78,7 @@ class Connection {
* @param $configID a string with the value for the appid column (appconfig table) or null for on-the-fly connections
*/
public function __construct($configPrefix = '', $configID = 'user_ldap') {
+ parent::__construct();
$this->configPrefix = $configPrefix;
$this->configID = $configID;
$memcache = new \OC\Memcache\Factory();
@@ -86,13 +87,13 @@ class Connection {
} else {
$this->cache = \OC_Cache::getGlobalCache();
}
- $this->config['hasPagedResultSupport'] = (function_exists('ldap_control_paged_result')
- && function_exists('ldap_control_paged_result_response'));
+ $this->config['hasPagedResultSupport'] =
+ $this->ldap->hasPagedResultSupport();
}
public function __destruct() {
if(!$this->dontDestruct && is_resource($this->ldapConnectionRes)) {
- @ldap_unbind($this->ldapConnectionRes);
+ @$this->ldap->unbind($this->ldapConnectionRes);
};
}
@@ -603,7 +604,7 @@ class Connection {
return false;
}
if(!$this->ldapConnectionRes) {
- if(!function_exists('ldap_connect')) {
+ if(!$this->ldap->areLDAPFunctionsAvailable()) {
$phpLDAPinstalled = false;
\OCP\Util::writeLog('user_ldap',
'function ldap_connect is not available. Make sure that the PHP ldap module is installed.',
@@ -653,11 +654,11 @@ class Connection {
//ldap_connect ignores port paramater when URLs are passed
$host .= ':' . $port;
}
- $this->ldapConnectionRes = ldap_connect($host, $port);
- if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
- if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
+ $this->ldapConnectionRes = $this->ldap->connect($host, $port);
+ if($this->ldap->set_option($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
+ if($this->ldap->set_option($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
if($this->config['ldapTLS']) {
- ldap_start_tls($this->ldapConnectionRes);
+ $this->ldap->start_tls($this->ldapConnectionRes);
}
}
}
@@ -681,10 +682,10 @@ class Connection {
if(!is_resource($cr)) {
return false;
}
- $ldapLogin = @ldap_bind($cr, $this->config['ldapAgentName'], $this->config['ldapAgentPassword']);
+ $ldapLogin = @$this->ldap->bind($cr, $this->config['ldapAgentName'], $this->config['ldapAgentPassword']);
if(!$ldapLogin) {
\OCP\Util::writeLog('user_ldap',
- 'Bind failed: ' . ldap_errno($cr) . ': ' . ldap_error($cr),
+ 'Bind failed: ' . $this->ldap->errno($cr) . ': ' . $this->ldap->error($cr),
\OCP\Util::ERROR);
$this->ldapConnectionRes = null;
return false;