also support regexp in domain_suffix
This commit is contained in:
@@ -141,7 +141,8 @@ config->{'domain_suffix'} = [setting('domain_suffix')]
|
|||||||
if ref [] ne ref setting('domain_suffix');
|
if ref [] ne ref setting('domain_suffix');
|
||||||
|
|
||||||
if (scalar @{ setting('domain_suffix') }) {
|
if (scalar @{ setting('domain_suffix') }) {
|
||||||
my @suffixes = map { quotemeta } @{ setting('domain_suffix') };
|
my @suffixes = map { (ref qr// eq ref $_) ? $_ : quotemeta }
|
||||||
|
@{ setting('domain_suffix') };
|
||||||
my $buildref = '(?:'. (join '|', @suffixes) .')$';
|
my $buildref = '(?:'. (join '|', @suffixes) .')$';
|
||||||
config->{'domain_suffix'} = qr/$buildref/;
|
config->{'domain_suffix'} = qr/$buildref/;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,11 +151,11 @@ sub search_by_dns {
|
|||||||
if ref {} ne ref $cond or !exists $cond->{dns};
|
if ref {} ne ref $cond or !exists $cond->{dns};
|
||||||
|
|
||||||
(my $suffix = (delete $cond->{suffix} || ''))
|
(my $suffix = (delete $cond->{suffix} || ''))
|
||||||
=~ s|^\Q(?^\E|***:(?|;
|
=~ s|\Q(?^\Eu?|(?|g;
|
||||||
|
|
||||||
$cond->{dns} = [ -and =>
|
$cond->{dns} = [ -and =>
|
||||||
{ '-ilike' => delete $cond->{dns} },
|
{ '-ilike' => delete $cond->{dns} },
|
||||||
{ '~*' => "$suffix" },
|
{ '~*' => "***:$suffix" },
|
||||||
];
|
];
|
||||||
|
|
||||||
return $rs
|
return $rs
|
||||||
|
|||||||
Reference in New Issue
Block a user