summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-10-02 15:12:05 +0200
committerAleksander Machniak <alec@alec.pl>2013-10-02 15:12:05 +0200
commit1d99b6e0995f7eafc8a38cfc3196925d9168f2bb (patch)
treed96990e1589a9b0754c0a49f1820d32280c2a726 /lib
parentc4ff3570cb284f0b786146b169c0def686c84ca3 (diff)
downloadwebadmin-1d99b6e0995f7eafc8a38cfc3196925d9168f2bb.tar.gz
Fix various validation inconsistences and empty value checks
Diffstat (limited to 'lib')
-rw-r--r--lib/api/kolab_api_service_form_value.php17
-rw-r--r--lib/ext/Net/LDAP3.php7
-rw-r--r--lib/kolab_api_service.php2
3 files changed, 12 insertions, 14 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 7f476e9..d96a9b1 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1089,8 +1089,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_alias($value, $postdata = null, $validation_type = null)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1112,15 +1112,12 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
}
+
+ return 'OK';
}
private function validate_associateddomain($value, $postdata = array(), $validation_type = null)
{
- return $value;
-
- $auth = Auth::get_instance();
- $conf = Conf::get_instance();
-
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1149,8 +1146,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_mail($value, $postdata = array(), $validation_type = null)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1172,6 +1169,8 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
}
+
+ return 'OK';
}
private function validate_mailquota($value, $postdata = array(), $validation_type = null)
@@ -1190,8 +1189,8 @@ class kolab_api_service_form_value extends kolab_api_service
private function validate_mailalternateaddress($value, $postdata = array(), $validation_type = null)
{
- $auth = Auth::get_instance();
$conf = Conf::get_instance();
+
if (!is_array($value)) {
$value = (array)($value);
}
@@ -1213,6 +1212,8 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
}
+
+ return 'OK';
}
private function _list_options_members($postdata, $attribs = array())
diff --git a/lib/ext/Net/LDAP3.php b/lib/ext/Net/LDAP3.php
index ffe645f..e661edb 100644
--- a/lib/ext/Net/LDAP3.php
+++ b/lib/ext/Net/LDAP3.php
@@ -1229,7 +1229,6 @@ class Net_LDAP3
// Compare each attribute value of the old attrs with the corresponding value
// in the new attrs, if any.
foreach ($old_attrs as $attr => $old_attr_value) {
-
if (is_array($old_attr_value)) {
if (count($old_attr_value) == 1) {
$old_attrs[$attr] = $old_attr_value[0];
@@ -1238,7 +1237,6 @@ class Net_LDAP3
}
if (array_key_exists($attr, $new_attrs)) {
-
if (is_array($new_attrs[$attr])) {
if (count($new_attrs[$attr]) == 1) {
$new_attrs[$attr] = $new_attrs[$attr][0];
@@ -1316,7 +1314,7 @@ class Net_LDAP3
}
} else {
- if (empty($new_attrs[$attr])) {
+ if (!isset($new_attrs[$attr]) || $new_attrs[$attr] === '' || (is_array($new_attrs[$attr]) && empty($new_attrs[$attr]))) {
switch ($attr) {
case "userpassword":
break;
@@ -1349,7 +1347,6 @@ class Net_LDAP3
}
if (array_key_exists($attr, $old_attrs)) {
-
if (is_array($old_attrs[$attr])) {
if (count($old_attrs[$attr]) == 1) {
$old_attrs[$attr] = $old_attrs[$attr][0];
@@ -1366,7 +1363,7 @@ class Net_LDAP3
$_sort2 = false;
}
- if (empty($value)) {
+ if ($value === null || $value === '' || (is_array($value) && empty($value))) {
if (!array_key_exists($attr, $mod_array['del'])) {
switch ($attr) {
case 'userpassword':
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index 8294dcd..fa5bd8e 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -286,7 +286,7 @@ abstract class kolab_api_service
$special_attr_validate = Array();
foreach ($validate_result as $attr_name => $value) {
- if (!empty($value) && $value !== "OK" && $value !== 0) {
+ if ($value !== false && $value !== '' && $value !== null && $value !== "OK") {
$special_attr_validate[$attr_name] = $value;
}
}