2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-24 02:59:22 +00:00

HttpUtils.pm: fix dnsHostsFile search (Forum #119497)

git-svn-id: https://svn.fhem.de/fhem/trunk@23965 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-03-14 09:44:41 +00:00
parent a7b36d0c1a
commit ac192716b4

View File

@ -251,7 +251,8 @@ HttpUtils_gethostbyname($$$$)
my $fh;
if(open($fh, $dh)) {
while(my $line = <$fh>) {
if($line =~ m/^([^# \t]+).*\b\Q$host\E\b/) {
if($line =~ m/^([^#\s]+).*?\s\Q$host\E\s/ ||
$line =~ m/^([^#\s]+).*?\s\Q$host\E$/) {
if($1 =~ m/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/ && # IP-Address
$1<256 && $2<256 && $3<256 && $4<256) {
$fn->($hash, undef, pack("CCCC", $1, $2, $3, $4));