Commit 2ac30551 authored by Marius Burkard's avatar Marius Burkard
Browse files

Merge branch '5533-idn-encode-support-for-amavis-leading-dot' into 'develop'

Added support for leading dots in amavis wildcard user lookups

Closes #5533

See merge request !1613
parents 4d5369ae 6b17bf5f
Pipeline #11858 passed with stage
in 8 seconds
...@@ -334,6 +334,14 @@ class functions { ...@@ -334,6 +334,14 @@ class functions {
$domain = substr($domain, strrpos($domain, '@') + 1); $domain = substr($domain, strrpos($domain, '@') + 1);
} }
// idn_to_* chokes on leading dots, but we need them for amavis, so remove it for later
if(substr($domain, 0, 1) === '.') {
$leading_dot = true;
$domain = substr($domain, 1);
} else {
$leading_dot = false;
}
if($encode == true) { if($encode == true) {
if(function_exists('idn_to_ascii')) { if(function_exists('idn_to_ascii')) {
if(defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46') && constant('IDNA_NONTRANSITIONAL_TO_ASCII')) { if(defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46') && constant('IDNA_NONTRANSITIONAL_TO_ASCII')) {
...@@ -378,6 +386,10 @@ class functions { ...@@ -378,6 +386,10 @@ class functions {
} }
} }
if($leading_dot == true) {
$domain = '.' . $domain;
}
if($user_part !== false) return $user_part . '@' . $domain; if($user_part !== false) return $user_part . '@' . $domain;
else return $domain; else return $domain;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment