Skip to content

Commit 2ac3055

Browse files
author
Marius Burkard
committed
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 ispconfig/ispconfig3!1613
2 parents 4d5369a + 6b17bf5 commit 2ac3055

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

interface/lib/classes/functions.inc.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,14 @@ private function _idn_encode_decode($domain, $encode = true) {
334334
$domain = substr($domain, strrpos($domain, '@') + 1);
335335
}
336336

337+
// idn_to_* chokes on leading dots, but we need them for amavis, so remove it for later
338+
if(substr($domain, 0, 1) === '.') {
339+
$leading_dot = true;
340+
$domain = substr($domain, 1);
341+
} else {
342+
$leading_dot = false;
343+
}
344+
337345
if($encode == true) {
338346
if(function_exists('idn_to_ascii')) {
339347
if(defined('IDNA_NONTRANSITIONAL_TO_ASCII') && defined('INTL_IDNA_VARIANT_UTS46') && constant('IDNA_NONTRANSITIONAL_TO_ASCII')) {
@@ -378,6 +386,10 @@ private function _idn_encode_decode($domain, $encode = true) {
378386
}
379387
}
380388

389+
if($leading_dot == true) {
390+
$domain = '.' . $domain;
391+
}
392+
381393
if($user_part !== false) return $user_part . '@' . $domain;
382394
else return $domain;
383395
}

0 commit comments

Comments
 (0)