Match TLHs correctly, not only partially.

The TLH was checked to match the beginning
of the newsgroup name, not the whole TLH part.
So the TLH "de" would match not only "de.test",
but also "denver.test", which was not the
desired outcome.

Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
Thomas Hochstein 2012-05-27 13:58:32 +02:00
parent 43a0fc7769
commit 7773fb6d8f

View file

@ -85,9 +85,15 @@ if ($Conf{'TLH'}) {
} }
# strip whitespace # strip whitespace
$TLH =~ s/\s//g; $TLH =~ s/\s//g;
# add trailing dots if none are present yet
# (using negative look-behind assertions)
$TLH =~ s/(?<!\.):/.:/g;
$TLH =~ s/(?<!\.)$/./;
# check for illegal characters # check for illegal characters
&Bleat(2,'Config error - illegal characters in TLH definition!') &Bleat(2,'Config error - illegal characters in TLH definition!')
if ($TLH !~ /^[a-zA-Z0-9:]+$/); if ($TLH !~ /^[a-zA-Z0-9:]+$/);
# escape dots
$TLH =~ s/\./\\./g;
if ($TLH =~ /:/) { if ($TLH =~ /:/) {
# reformat $TLH from a:b to (a)|(b), # reformat $TLH from a:b to (a)|(b),
# e.g. replace ':' by ')|(' # e.g. replace ':' by ')|('