summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2018-07-21 13:47:04 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2018-07-21 13:47:04 +0200
commit5ddeb334469e3e871c910cdf05f78134d8983beb (patch)
tree58ef1c3fda366f6cdb7841ddfce858e5e336e675
parent3bda3645113d957ee0f370e8d4c353a19585b4b9 (diff)
downloadwebadmin-5ddeb334469e3e871c910cdf05f78134d8983beb.tar.gz
Allow a value of @domain.tld to be used to facilitate catchall addressing
-rw-r--r--lib/api/kolab_api_service_form_value.php18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 7976780..c6c7a3f 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -1546,7 +1546,7 @@ class kolab_api_service_form_value extends kolab_api_service
$domain = substr($mail_address, $at_index+1);
$local = substr($mail_address, 0, $at_index);
- if (strlen($local) < 1 || strlen($local) > 64) {
+ if (strlen($local) > 64) {
// local part length exceeded
//console("Local part of email address is longer than permitted");
$valid = false;
@@ -1562,8 +1562,8 @@ class kolab_api_service_form_value extends kolab_api_service
$valid = false;
} else if (preg_match('/\\.\\./', $local)) {
- //console("Local part contains two consecutive dots");
// local part has two consecutive dots
+ //console("Local part contains two consecutive dots");
$valid = false;
} else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) {
@@ -1576,12 +1576,14 @@ class kolab_api_service_form_value extends kolab_api_service
//console("Domain part contains two consecutive dots");
$valid = false;
- } else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) {
- // character not valid in local part unless
- // local part is quoted
- if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) {
- //console("Unquoted invalid character in local part");
- $valid = false;
+ } else if (strlen($local) > 0) {
+ if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) {
+ // character not valid in local part unless
+ // local part is quoted
+ if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) {
+ //console("Unquoted invalid character in local part");
+ $valid = false;
+ }
}
}