summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-09-13 12:36:54 +0200
committerAleksander Machniak <alec@alec.pl>2014-09-13 12:37:23 +0200
commit9a498212446f6c9a186df5652a7625526b590b78 (patch)
tree099b09b61a9b6f5094b4b8c10243c82c5f96ff50 /program
parentd6867490abc543da0c8ec7895d3748d1e7e93e63 (diff)
Fix validation of email addresses with IDNA domains (#1490067)
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_utils.php5
1 files changed, 3 insertions, 2 deletions
diff --git a/program/lib/Roundcube/rcube_utils.php b/program/lib/Roundcube/rcube_utils.php
index 00999ba50..28b16ff57 100644
--- a/program/lib/Roundcube/rcube_utils.php
+++ b/program/lib/Roundcube/rcube_utils.php
@@ -103,13 +103,14 @@ class rcube_utils
}
foreach ($domain_array as $part) {
- if (!preg_match('/^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]))$/', $part)) {
+ if (!preg_match('/^((xn--)?([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]))$/', $part)) {
return false;
}
}
// last domain part
- if (preg_match('/[^a-zA-Z]/', array_pop($domain_array))) {
+ $last_part = array_pop($domain_array);
+ if (strpos($last_part, 'xn--') !== 0 && preg_match('/[^a-zA-Z]/', $last_part)) {
return false;
}