summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2013-06-21 23:58:44 +0200
committerArthur Schiwon <blizzz@owncloud.com>2013-07-10 11:39:47 +0200
commit5387e5c354440b264040816ea7fcaf6783a2ebdc (patch)
tree7858bb254cc6b12566ac772fbd61840454654568 /apps/user_ldap
parent6a50848a6eec361d21655819c946d8e14c073608 (diff)
downloadnextcloud-server-5387e5c354440b264040816ea7fcaf6783a2ebdc.tar.gz
nextcloud-server-5387e5c354440b264040816ea7fcaf6783a2ebdc.zip
LDAP: even better check for emptiness, fixes #3815
Diffstat (limited to 'apps/user_ldap')
-rw-r--r--apps/user_ldap/lib/connection.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 31150a5bec5..36c8e648b1a 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -210,6 +210,22 @@ class Connection {
}
/**
+ * Special handling for reading Base Configuration
+ *
+ * @param $base the internal name of the config key
+ * @param $value the value stored for the base
+ */
+ private function readBase($base, $value) {
+ if(empty($value)) {
+ $value = '';
+ } else {
+ $value = preg_split('/\r\n|\r|\n/', $value);
+ }
+
+ $this->config[$base] = $value;
+ }
+
+ /**
* Caches the general LDAP configuration.
*/
private function readConfiguration($force = false) {
@@ -224,14 +240,9 @@ class Connection {
$this->config['ldapAgentName'] = $this->$v('ldap_dn');
$this->config['ldapAgentPassword']
= base64_decode($this->$v('ldap_agent_password'));
- $rawLdapBase = $this->$v('ldap_base');
- $this->config['ldapBase']
- = preg_split('/\r\n|\r|\n/', $rawLdapBase);
- $this->config['ldapBaseUsers']
- = preg_split('/\r\n|\r|\n/', ($this->$v('ldap_base_users')));
- $this->config['ldapBaseGroups']
- = preg_split('/\r\n|\r|\n/', $this->$v('ldap_base_groups'));
- unset($rawLdapBase);
+ $this->readBase('ldapBase', $this->$v('ldap_base'));
+ $this->readBase('ldapBaseUsers', $this->$v('ldap_base_users'));
+ $this->readBase('ldapBaseGroups', $this->$v('ldap_base_groups'));
$this->config['ldapTLS'] = $this->$v('ldap_tls');
$this->config['ldapNoCase'] = $this->$v('ldap_nocase');
$this->config['turnOffCertCheck']