Replace the deprecated module Net::Subnets with Net::CIDR::Lite.
This commit is contained in:
parent
5df15c6307
commit
fae8b162fa
4 changed files with 39 additions and 34 deletions
|
|
@ -25,6 +25,7 @@
|
|||
- fixed #11247: Survey edit screen broken
|
||||
- fixed #11246: Image.pm - Validation error
|
||||
- fixed #11221: wrong version of Locales::Country in testEnvironment
|
||||
- Net::Subnets has been deprecated.
|
||||
|
||||
7.8.4
|
||||
- Fixed a compatibility problem between WRE and new Spectre code.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ save you many hours of grief.
|
|||
7.8.5
|
||||
--------------------------------------------------------------------
|
||||
* WebGUI now requires Locales 0.10 or higher, to replace the deprecated
|
||||
modules Locales::Country.
|
||||
module Locales::Country.
|
||||
|
||||
* WebGUI now requires Net::CIDR::Lite 0.20 or higher, to replace the deprecated
|
||||
module Net::Subnets.
|
||||
|
||||
* Users, no matter if they are created via anonymous registration,
|
||||
via the Admin Console Users screen, or via code, now always get
|
||||
|
|
@ -18,24 +21,24 @@ save you many hours of grief.
|
|||
the Visitor account. Previously, based on how the user was created,
|
||||
they would get default values from different places.
|
||||
|
||||
* The following style templates have been cleaned up by the TWG:
|
||||
- WebGUI 6 Blank Style, Style 01; Style 02, Style 03:
|
||||
- no structural changes
|
||||
- Fail safe:
|
||||
- added new CSS that is more robust and validates (in external file: style.css);
|
||||
- it was also necessary to update the css to work with the new navigation templates
|
||||
- changed the markup and the order of the home/login/user/admin controls at the bottom
|
||||
- All of the above templates:
|
||||
- added a link tag to wg-base.css
|
||||
- added conditional comments at the top and bottom of the body tag to be able to target
|
||||
IE versions easily with css
|
||||
* The following style templates have been cleaned up by the TWG:
|
||||
- WebGUI 6 Blank Style, Style 01; Style 02, Style 03:
|
||||
- no structural changes
|
||||
- Fail safe:
|
||||
- added new CSS that is more robust and validates (in external file: style.css);
|
||||
- it was also necessary to update the css to work with the new navigation templates
|
||||
- changed the markup and the order of the home/login/user/admin controls at the bottom
|
||||
- All of the above templates:
|
||||
- added a link tag to wg-base.css
|
||||
- added conditional comments at the top and bottom of the body tag to be able to target
|
||||
IE versions easily with css
|
||||
|
||||
* Added wg-base.css, which is linked to in each style template. This stylesheet is for css that
|
||||
is used in more than one tempalte, like pagination inline icons etc. Inline styles that are
|
||||
removed from templates, will be replaced with styles in wg-base.css (and example is RFE 11182).
|
||||
Elements that are styled in wg-base.css have a classname that starts with "wg-".
|
||||
* Added wg-base.css, which is linked to in each style template. This stylesheet is for css that
|
||||
is used in more than one tempalte, like pagination inline icons etc. Inline styles that are
|
||||
removed from templates, will be replaced with styles in wg-base.css (and example is RFE 11182).
|
||||
Elements that are styled in wg-base.css have a classname that starts with "wg-".
|
||||
|
||||
wg-base.css replaces webgui.css, which will be removed from the site.
|
||||
wg-base.css replaces webgui.css, which will be removed from the site.
|
||||
|
||||
7.8.4
|
||||
--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package WebGUI::Utility;
|
|||
use Exporter;
|
||||
use strict;
|
||||
use Tie::IxHash;
|
||||
use Net::Subnets;
|
||||
use Net::CIDR::Lite;
|
||||
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT = qw(&isBetween &makeTabSafe &makeArrayTabSafe &randomizeHash &commify &randomizeArray &isInSubnet
|
||||
|
|
@ -176,7 +176,9 @@ sub isIn {
|
|||
|
||||
=head2 isInSubnet ( ipAddress, subnets )
|
||||
|
||||
Verifies whether an IP address is in a given subnet. Returns a 1 if it is, undef if there's a formatting error, or 0 if the IP is not in the list of subnets.
|
||||
Verifies whether an IP address is in a given subnet. Returns a 1 if it
|
||||
is, undef if there's a formatting error, or 0 if the IP is not in the
|
||||
list of subnets.
|
||||
|
||||
=head3 ipAddress
|
||||
|
||||
|
|
@ -191,22 +193,21 @@ An array reference containing subnets in CIDR format. Example: 127.0.0.1/32
|
|||
sub isInSubnet {
|
||||
my $ip = shift;
|
||||
my $subnets = shift;
|
||||
# some validation
|
||||
return 0 unless @{ $subnets };
|
||||
for my $cidr ( @{ $subnets } ) {
|
||||
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
|
||||
unless ( 5 == @parts ) { # cidr has 5 parts
|
||||
return undef;
|
||||
}
|
||||
unless ( 4 == grep { $_ <= 255 } @parts[0..3] ) { # each octet needs to be between 0 and 255
|
||||
return undef;
|
||||
}
|
||||
unless ( $parts[4] <= 32 ) { # the subnet needs to be less than or equal to 32, as 32 represents only 1 ip address
|
||||
return undef;
|
||||
}
|
||||
my @parts = $cidr =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)\/(\d+)$/;
|
||||
unless ( 5 == @parts ) { # cidr has 5 parts
|
||||
return undef;
|
||||
}
|
||||
unless ( 4 == grep { $_ <= 255 } @parts[0..3] ) { # each octet needs to be between 0 and 255
|
||||
return undef;
|
||||
}
|
||||
unless ( $parts[4] <= 32 ) { # the subnet needs to be less than or equal to 32, as 32 represents only 1 ip address
|
||||
return undef;
|
||||
}
|
||||
}
|
||||
my $net = Net::Subnets->new;
|
||||
$net->subnets($subnets);
|
||||
if ($net->check(\$ip)) {
|
||||
my $net = Net::CIDR::Lite->new(@{ $subnets });
|
||||
if ($net->find($ip)) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ checkModule("XML::FeedPP", 0.40 );
|
|||
checkModule("JSON", 2.12 );
|
||||
checkModule("Config::JSON", "1.3.1" );
|
||||
checkModule("Text::CSV_XS", "0.64" );
|
||||
checkModule("Net::Subnets", 0.21 );
|
||||
checkModule("Net::CIDR::Lite", 0.20 );
|
||||
checkModule("Finance::Quote", 1.15 );
|
||||
checkModule("POE", 1.005 );
|
||||
checkModule("POE::Component::IKC::Server", 0.2001 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue