summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/lib/Wizard.php
diff options
context:
space:
mode:
authorVictor Dubiniuk <victor.dubiniuk@gmail.com>2016-09-23 01:30:57 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-10-13 00:53:34 +0200
commit011d5f554c1fcc2896c8798c9ef29b59af7b2692 (patch)
treea82d4724e97221a2cf05fb3e5c2c39fc8a462321 /apps/user_ldap/lib/Wizard.php
parent17fa45a29200ced15b4258f2d06d8159b60856f9 (diff)
downloadnextcloud-server-011d5f554c1fcc2896c8798c9ef29b59af7b2692.tar.gz
nextcloud-server-011d5f554c1fcc2896c8798c9ef29b59af7b2692.zip
Harden empty
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Wizard.php')
-rw-r--r--apps/user_ldap/lib/Wizard.php22
1 files changed, 12 insertions, 10 deletions
diff --git a/apps/user_ldap/lib/Wizard.php b/apps/user_ldap/lib/Wizard.php
index cdc98c72cde..2c388b1803e 100644
--- a/apps/user_ldap/lib/Wizard.php
+++ b/apps/user_ldap/lib/Wizard.php
@@ -220,7 +220,7 @@ class Wizard extends LDAPUtility {
}
$attr = $this->configuration->ldapUserDisplayName;
- if($attr !== 'displayName' && !empty($attr)) {
+ if ($attr !== '' && $attr !== 'displayName') {
// most likely not the default value with upper case N,
// verify it still produces a result
$count = intval($this->countUsersWithAttribute($attr, true));
@@ -262,7 +262,7 @@ class Wizard extends LDAPUtility {
}
$attr = $this->configuration->ldapEmailAttribute;
- if(!empty($attr)) {
+ if ($attr !== '') {
$count = intval($this->countUsersWithAttribute($attr, true));
if($count > 0) {
return false;
@@ -552,7 +552,7 @@ class Wizard extends LDAPUtility {
}
//make sure the use display name is set
$displayName = $this->configuration->ldapGroupDisplayName;
- if(empty($displayName)) {
+ if ($displayName === '') {
$d = $this->configuration->getDefaults();
$this->applyFind('ldap_group_display_name',
$d['ldap_group_display_name']);
@@ -576,7 +576,7 @@ class Wizard extends LDAPUtility {
}
//make sure the use display name is set
$displayName = $this->configuration->ldapUserDisplayName;
- if(empty($displayName)) {
+ if ($displayName === '') {
$d = $this->configuration->getDefaults();
$this->applyFind('ldap_display_name', $d['ldap_display_name']);
}
@@ -904,7 +904,7 @@ class Wizard extends LDAPUtility {
$er = $this->ldap->firstEntry($cr, $rr);
$attrs = $this->ldap->getAttributes($cr, $er);
$dn = $this->ldap->getDN($cr, $er);
- if(empty($dn)) {
+ if ($dn == false || $dn === '') {
continue;
}
$filterPart = '(memberof=' . $dn . ')';
@@ -923,7 +923,7 @@ class Wizard extends LDAPUtility {
if($parts > 1) {
$filter = '(&' . $filter . ')';
}
- if(empty($filter)) {
+ if ($filter === '') {
$filter = '(objectclass=*)';
}
break;
@@ -973,7 +973,7 @@ class Wizard extends LDAPUtility {
//fallback
$attr = 'cn';
}
- if(!empty($attr)) {
+ if ($attr !== '') {
$filterUsername = '(' . $attr . $loginpart . ')';
$parts++;
}
@@ -1098,8 +1098,10 @@ class Wizard extends LDAPUtility {
$agent = $this->configuration->ldapAgentName;
$pwd = $this->configuration->ldapAgentPassword;
- return ( (!empty($agent) && !empty($pwd))
- || (empty($agent) && empty($pwd)));
+ return
+ ($agent !== '' && $pwd !== '')
+ || ($agent === '' && $pwd === '')
+ ;
}
/**
@@ -1236,7 +1238,7 @@ class Wizard extends LDAPUtility {
if(is_array($setFeatures) && !empty($setFeatures)) {
//something is already configured? pre-select it.
$this->result->addChange($dbkey, $setFeatures);
- } else if($po && !empty($maxEntryObjC)) {
+ } else if ($po && $maxEntryObjC !== '') {
//pre-select objectclass with most result entries
$maxEntryObjC = str_replace($p, '', $maxEntryObjC);
$this->applyFind($dbkey, $maxEntryObjC);