From 21c8e378c0d0d7ff8ea584948b644d944448d87e Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Tue, 25 Oct 2011 10:22:25 -0700 Subject: [PATCH] Copy IP range support into other ip_match function --- webmin/webmin-lib.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/webmin/webmin-lib.pl b/webmin/webmin-lib.pl index b0cacda2c..5f72fd1dd 100755 --- a/webmin/webmin-lib.pl +++ b/webmin/webmin-lib.pl @@ -1418,6 +1418,19 @@ for(my $i=1; $i<@_; $i++) { } } } + elsif ($_[$i] =~ /^(\S+)-(\S+)$/) { + # Compare with an IPv4 range (separated by a hyphen -) + local ($remote, $min, $max); + @low = split(/\./, $1); @high = split(/\./, $2); + for($j=0; $j<4; $j++) { + $remote += $io[$j] << ((3-$j)*8); + $min += $low[$j] << ((3-$j)*8); + $max += $high[$j] << ((3-$j)*8); + } + if ($remote < $min || $remote > $max) { + $mismatch = 1; + } + } elsif ($ip =~ /^\*(\.\S+)$/) { # Compare with hostname regexp $mismatch = 1 if ($hn !~ /$1$/);