summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-10-23 17:37:49 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-11-26 13:29:47 (GMT)
commit7a98138b282256c96a24b12e5c40bc96484c51bd (patch)
tree265edb162c2f7dd15a9dd3e392f3a82647b7d5c0
parente9eaf6114dadcc862e8dc18cf9e49908e9fbed89 (diff)
downloadkolab-wap-7a98138b282256c96a24b12e5c40bc96484c51bd.tar.gz
Check user domain before getting all domains in _validate_email_address_in_any_of_my_domains() (#1138)
-rw-r--r--lib/api/kolab_api_service_form_value.php36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 9e213f6..1443a1b 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -959,7 +959,8 @@ class kolab_api_service_form_value extends kolab_api_service
}
}
- private function _highest_of_two($one, $two) {
+ private function _highest_of_two($one, $two)
+ {
if ($one > $two) {
return $one;
} elseif ($one == $two) {
@@ -1091,7 +1092,8 @@ class kolab_api_service_form_value extends kolab_api_service
return array('list' => $result);
}
- private function _validate_email_address($mail_address) {
+ private function _validate_email_address($mail_address)
+ {
$valid = true;
$at_index = strrpos($mail_address, "@");
@@ -1150,20 +1152,8 @@ class kolab_api_service_form_value extends kolab_api_service
return $valid;
}
- private function _validate_email_address_in_any_of_my_domains($mail_address) {
- $valid = false;
-
- $auth = Auth::get_instance();
- $conf = Conf::get_instance();
-
- $my_primary_domain = $_SESSION['user']->get_domain();
- $all_domains = $auth->list_domains();
- $all_domains = $all_domains['list'];
-
- $valid_domains = array();
-
- $dna = $conf->get('domain_name_attribute');
-
+ private function _validate_email_address_in_any_of_my_domains($mail_address)
+ {
$at_index = strrpos($mail_address, "@");
if (is_bool($at_index) && !$at_index) {
throw new Exception("Invalid email address: No domain name space", 235);
@@ -1171,6 +1161,20 @@ class kolab_api_service_form_value extends kolab_api_service
$email_domain = substr($mail_address, $at_index+1);
}
+ $my_primary_domain = $_SESSION['user']->get_domain();
+
+ if ($email_domain == $my_primary_domain) {
+ return true;
+ }
+
+ $auth = Auth::get_instance();
+ $conf = Conf::get_instance();
+ $all_domains = $auth->list_domains();
+ $all_domains = $all_domains['list'];
+ $valid_domains = array();
+ $dna = $conf->get('domain_name_attribute');
+ $valid = false;
+
Log::trace("_validate_email_address_in_any_of_mydomains(\$mail_address = " . var_export($mail_address, TRUE) . ")");
Log::trace("\$all_domains includes: " . var_export($all_domains, TRUE) . " (must include domain for \$mail_address)");