r67211 - in /branches/upstream/libdata-validate-ip-perl/current: Changes META.yml lib/Data/Validate/IP.pm t/Data-Validate-IP.t
carnil at users.alioth.debian.org
carnil at users.alioth.debian.org
Sun Jan 9 18:26:47 UTC 2011
Author: carnil
Date: Sun Jan 9 18:26:06 2011
New Revision: 67211
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=67211
Log:
[svn-upgrade] new version libdata-validate-ip-perl (0.14)
Modified:
branches/upstream/libdata-validate-ip-perl/current/Changes
branches/upstream/libdata-validate-ip-perl/current/META.yml
branches/upstream/libdata-validate-ip-perl/current/lib/Data/Validate/IP.pm
branches/upstream/libdata-validate-ip-perl/current/t/Data-Validate-IP.t
Modified: branches/upstream/libdata-validate-ip-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-validate-ip-perl/current/Changes?rev=67211&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/Changes (original)
+++ branches/upstream/libdata-validate-ip-perl/current/Changes Sun Jan 9 18:26:06 2011
@@ -1,4 +1,11 @@
Revision history for Perl extension Data::Validate::IP.
+
+0.14 Thu Jan 06 2011
+ - Cleaned up test suite (no code changes)
+
+0.13 Thu Jan 06 2011
+ - Fixed unshorted ipv6 check when ipv4 address is trailing. (Bug#64532)
+ Thanks to Milan Matlak <milan.matlak at sde.cz> for patch
0.12 Wed Dec 29 2010
- Fixed parsing of trailing :: (such as 2001::), as that is valid
Modified: branches/upstream/libdata-validate-ip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-validate-ip-perl/current/META.yml?rev=67211&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/META.yml (original)
+++ branches/upstream/libdata-validate-ip-perl/current/META.yml Sun Jan 9 18:26:06 2011
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: Data-Validate-IP
-version: 0.12
+version: 0.14
abstract: ipv4 and ipv6 validation methods
author:
- Neil Neely <neil at neely.cx>
Modified: branches/upstream/libdata-validate-ip-perl/current/lib/Data/Validate/IP.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-validate-ip-perl/current/lib/Data/Validate/IP.pm?rev=67211&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/lib/Data/Validate/IP.pm (original)
+++ branches/upstream/libdata-validate-ip-perl/current/lib/Data/Validate/IP.pm Sun Jan 9 18:26:06 2011
@@ -41,7 +41,7 @@
is_linklocal_ipv6
);
-our $VERSION = '0.12';
+our $VERSION = '0.14';
#Global, we store this only once
my %MASK;
@@ -242,13 +242,15 @@
#exempt it from the normal ipv6 checking and stick it back on at the end.
#if only one chunk and it matches it isn't ipv6 - it is a ipv4 address only
my $ipv4;
+ my $expected_chunks = 8;
if (@chunks > 1 && is_ipv4($chunks[$#chunks])) {
$ipv4 = pop(@chunks);
+ $expected_chunks--;
}
my $empty = 0;
#Workaround to handle trailing :: being valid
- if ($value =~ /[0123456789abcdef]{0,4}::$/) {
+ if ($value =~ /[0123456789abcdef]{1,4}::$/) {
$empty++;
} elsif ($value =~ /:$/) {
#single trailing ':' is invalid
@@ -269,7 +271,7 @@
push(@chunks, $ipv4);
}
#Need 8 chunks, or we need an empty section that could be filled to represent the missing '0' sections
- return unless (@chunks == 8 || @chunks < 8 && $empty);
+ return unless (@chunks == $expected_chunks || @chunks < $expected_chunks && $empty);
my $return = join(':', @chunks);
#Need to handle the exception of trailing :: being valid
Modified: branches/upstream/libdata-validate-ip-perl/current/t/Data-Validate-IP.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libdata-validate-ip-perl/current/t/Data-Validate-IP.t?rev=67211&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/t/Data-Validate-IP.t (original)
+++ branches/upstream/libdata-validate-ip-perl/current/t/Data-Validate-IP.t Sun Jan 9 18:26:06 2011
@@ -5,7 +5,7 @@
# change 'tests => 1' to 'tests => last_test_to_print';
-use Test::More tests => 49;
+use Test::More tests => 50;
BEGIN { use_ok('Data::Validate::IP', qw(is_ipv4 is_innet_ipv4 is_ipv6 is_private_ipv4 is_loopback_ipv4 is_testnet_ipv4 is_public_ipv4 is_multicast_ipv4 is_linklocal_ipv4 is_linklocal_ipv6) ) };
#########################
@@ -13,59 +13,68 @@
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
-is ('216.17.184.1', is_ipv4('216.17.184.1'), 'is_ipv4 216.17.184.1');
-is ('0.0.0.0', is_ipv4('0.0.0.0'), 'is_ipv4 0.0.0.0');
-isnt ('www.neely.cx', is_ipv4('www.neely.cx'), 'is_ipv4 www.neely.cx');
-isnt ('216.17.184.G', is_ipv4('216.17.184.G'), 'is_ipv4 216.17.184.G');
-isnt ('216.17.184.1.', is_ipv4('216.17.184.1.'), 'is_ipv4 216.17.184.1.');
-isnt ('216.17.184', is_ipv4('216.17.184'), 'is_ipv4 216.17.184');
-isnt ('216.17.184.', is_ipv4('216.17.184.'), 'is_ipv4 216.17.184.');
-isnt ('256.17.184.1', is_ipv4('256.17.184.1'), 'is_ipv4 256.17.184.1');
-isnt ('216.017.184.1', is_ipv4('216.017.184.1'), 'is_ipv4 216.017.184.1');
-isnt ('016.17.184.1', is_ipv4('016.17.184.1'), 'is_ipv4 016.17.184.1');
+is (is_ipv4('216.17.184.1'), '216.17.184.1', 'is_ipv4 216.17.184.1');
+is (is_ipv4('0.0.0.0'), '0.0.0.0', 'is_ipv4 0.0.0.0');
+is (is_ipv4('www.neely.cx'), undef, 'is_ipv4 www.neely.cx');
+is (is_ipv4('216.17.184.G'), undef, 'is_ipv4 216.17.184.G');
+is (is_ipv4('216.17.184.1.'), undef, 'is_ipv4 216.17.184.1.');
+is (is_ipv4('216.17.184'), undef, 'is_ipv4 216.17.184');
+is (is_ipv4('216.17.184.'), undef, 'is_ipv4 216.17.184.');
+is (is_ipv4('256.17.184.1'), undef, 'is_ipv4 256.17.184.1');
+is (is_ipv4('216.017.184.1'), undef, 'is_ipv4 216.017.184.1');
+is (is_ipv4('016.17.184.1'), undef, 'is_ipv4 016.17.184.1');
-is ('216.17.184.1', is_innet_ipv4('216.17.184.1','216.17.184.0/24'), 'is_innet_ipv4 216.17.184.1 216.17.184.0/24');
-isnt ('216.17.184.1', is_innet_ipv4('127.0.0.1','216.17.184.0/24'), 'is_innet_ipv4 127.0.0.1 216.17.184.0/24');
+is (is_innet_ipv4('216.17.184.1','216.17.184.0/24'), '216.17.184.1', 'is_innet_ipv4 216.17.184.1 216.17.184.0/24');
+is (is_innet_ipv4('127.0.0.1','216.17.184.0/24'), undef, 'is_innet_ipv4 127.0.0.1 216.17.184.0/24');
-is ('10.0.0.1', is_private_ipv4('10.0.0.1'), 'is_private_ipv4 10.0.0.1');
-is ('172.16.0.1', is_private_ipv4('172.16.0.1'), 'is_private_ipv4 172.16.0.1');
-is ('192.168.0.1', is_private_ipv4('192.168.0.1'), 'is_private_ipv4 192.168.0.1');
-isnt ('216.17.184.1', is_private_ipv4('216.17.184.1'), 'is_private_ipv4 216.17.184.1');
-is ('127.0.0.1', is_loopback_ipv4('127.0.0.1'), 'is_loopback_ipv4 127.0.0.1');
-is ('192.0.2.9', is_testnet_ipv4('192.0.2.9'), 'is_testnet_ipv4 192.0.2.9');
-is ('216.17.184.1', is_public_ipv4('216.17.184.1'), 'is_public_ipv4 216.17.184.1');
-isnt ('192.168.0.1', is_public_ipv4('192.168.0.1'), 'is_public_ipv4 192.168.0.1');
+is (is_private_ipv4('10.0.0.1'), '10.0.0.1', 'is_private_ipv4 10.0.0.1');
+is (is_private_ipv4('172.16.0.1'), '172.16.0.1', 'is_private_ipv4 172.16.0.1');
+is (is_private_ipv4('192.168.0.1'), '192.168.0.1', 'is_private_ipv4 192.168.0.1');
+is (is_private_ipv4('216.17.184.1'), undef, 'is_private_ipv4 216.17.184.1');
-is ('224.0.0.1', is_multicast_ipv4('224.0.0.1'), 'is_multicast_ipv4 224.0.0.1');
-isnt ('216.17.184.1', is_multicast_ipv4('216.17.184.1'), 'is_multicast_ipv4 216.17.184.1');
-isnt ('224.0.0.1', is_public_ipv4('224.0.0.1'), 'is_public_ipv4 224.0.0.1');
-is ('169.254.0.1', is_linklocal_ipv4('169.254.0.1'), 'is_linklocal_ipv4 169.254.0.1');
-isnt ('216.17.184.1', is_linklocal_ipv4('216.17.184.1'), 'is_linklocal_ipv4 216.17.184.1');
-isnt ('169.254.0.1', is_public_ipv4('169.254.0.1'), 'is_public_ipv4 169.254.0.1');
+is (is_loopback_ipv4('127.0.0.1'), '127.0.0.1', 'is_loopback_ipv4 127.0.0.1');
+is (is_testnet_ipv4('192.0.2.9'), '192.0.2.9', 'is_testnet_ipv4 192.0.2.9');
-isnt ('2067:fa88', is_ipv6('2067:fa88'), 'is_ipv6 2067:fa88');
-isnt ('2067:FA88', is_ipv6('2067:FA88'), 'is_ipv6 2067:FA88');
-is ('2067:fa88::0', is_ipv6('2067:fa88::0'), 'is_ipv6 2067:fa88::0');
-is ('2067:FA88::1', is_ipv6('2067:FA88::1'), 'is_ipv6 2067:FA88::1');
-is ('2607:fa88::8a2e:370:7334', is_ipv6('2607:fa88::8a2e:370:7334'), 'is_ipv6 2607:fa88::8a2e:370:7334');
-is ('2001:0db8:0000:0000:0000:0000:1428:57ab', is_ipv6('2001:0db8:0000:0000:0000:0000:1428:57ab'), 'is_ipv6 2001:0db8:0000:0000:0000:0000:1428:57ab');
-is ('2001:0db8:0000:0000:0000::1428:57ab', is_ipv6('2001:0db8:0000:0000:0000::1428:57ab'), 'is_ipv6 2001:0db8:0000:0000:0000::1428:57ab');
-is ('2001:0db8:0:0:0:0:1428:57ab', is_ipv6('2001:0db8:0:0:0:0:1428:57ab'), 'is_ipv6 2001:0db8:0:0:0:0:1428:57ab');
-is ('2001:0db8:0:0::1428:57ab', is_ipv6('2001:0db8:0:0::1428:57ab'), 'is_ipv6 2001:0db8:0:0::1428:57ab');
-is ('2001:0db8::1428:57ab', is_ipv6('2001:0db8::1428:57ab'), 'is_ipv6 2001:0db8::1428:57ab');
-is ('2001:db8::1428:57ab', is_ipv6('2001:db8::1428:57ab'), 'is_ipv6 2001:db8::1428:57ab');
-is ('::0', is_ipv6('::0'), 'is_ipv6 ::0');
-is ('::1', is_ipv6('::1'), 'is_ipv6 ::1');
-is ('::ffff:12.34.56.78', is_ipv6('::ffff:12.34.56.78'), 'is_ipv6 ::ffff:12.34.56.78');
-is ('2067::', is_ipv6('2067::'), 'is_ipv6 2607::');
-isnt ('2067:::', is_ipv6('2067:::'), 'is_ipv6 2607:::');
-isnt ('2067:::1', is_ipv6('2067:::1'), 'is_ipv6 2607:::1');
-isnt ('2067::1:', is_ipv6('2067::1:'), 'is_ipv6 2607::1:');
+is (is_public_ipv4('216.17.184.1'), '216.17.184.1', 'is_public_ipv4 216.17.184.1');
+is (is_public_ipv4('192.168.0.1'), undef, 'is_public_ipv4 192.168.0.1');
-isnt ('216.17.184.1', is_ipv6('216.17.184.1'), 'is_ipv6 216.17.184.1');
-isnt ('bbb.bbb.bbb', is_ipv6('bbb.bbb.bbb'), 'is_ipv6 bbb.bbb.bbb');
+is (is_multicast_ipv4('224.0.0.1'), '224.0.0.1', 'is_multicast_ipv4 224.0.0.1');
+is (is_multicast_ipv4('216.17.184.1'), undef, 'is_multicast_ipv4 216.17.184.1');
-isnt ('fe80:db8', is_linklocal_ipv6('fe80:db8'), 'is_linklocal_ipv6 fe80:db8');
-is ('fe80:db8::4', is_linklocal_ipv6('fe80:db8::4'), 'is_linklocal_ipv6 fe80:db8::4');
+is (is_public_ipv4('169.254.0.1'), undef, 'is_public_ipv4 169.254.0.1');
+is (is_public_ipv4('224.0.0.1'), undef, 'is_public_ipv4 224.0.0.1');
+is (is_linklocal_ipv4('169.254.0.1'), '169.254.0.1', 'is_linklocal_ipv4 169.254.0.1');
+is (is_linklocal_ipv4('216.17.184.1'),undef, 'is_linklocal_ipv4 216.17.184.1');
+
+
+is (is_ipv6('2067:fa88'), undef, 'is_ipv6 2067:fa88');
+is (is_ipv6('2067:FA88'), undef, 'is_ipv6 2067:FA88');
+is (is_ipv6('2067:fa88::0'), '2067:fa88::0', 'is_ipv6 2067:fa88::0');
+is (is_ipv6('2067:FA88::1'), '2067:FA88::1', 'is_ipv6 2067:FA88::1');
+is (is_ipv6('2607:fa88::8a2e:370:7334'), '2607:fa88::8a2e:370:7334', 'is_ipv6 2607:fa88::8a2e:370:7334');
+is (is_ipv6('2001:0db8:0000:0000:0000:0000:1428:57ab'), '2001:0db8:0000:0000:0000:0000:1428:57ab', 'is_ipv6 2001:0db8:0000:0000:0000:0000:1428:57ab');
+is (is_ipv6('2001:0db8:0000:0000:0000::1428:57ab'), '2001:0db8:0000:0000:0000::1428:57ab', 'is_ipv6 2001:0db8:0000:0000:0000::1428:57ab');
+is (is_ipv6('2001:0db8:0:0:0:0:1428:57ab'), '2001:0db8:0:0:0:0:1428:57ab', 'is_ipv6 2001:0db8:0:0:0:0:1428:57ab');
+is (is_ipv6('2001:0db8:0:0::1428:57ab'), '2001:0db8:0:0::1428:57ab', 'is_ipv6 2001:0db8:0:0::1428:57ab');
+is (is_ipv6('2001:0db8::1428:57ab'), '2001:0db8::1428:57ab', 'is_ipv6 2001:0db8::1428:57ab');
+is (is_ipv6('2001:db8::1428:57ab'), '2001:db8::1428:57ab', 'is_ipv6 2001:db8::1428:57ab');
+is (is_ipv6('::0'), '::0', 'is_ipv6 ::0');
+is (is_ipv6('::1'), '::1', 'is_ipv6 ::1');
+
+is (is_ipv6('::ffff:12.34.56.78'), '::ffff:12.34.56.78', 'is_ipv6 ::ffff:12.34.56.78');
+is (is_ipv6('0:0:0:0:0:ffff:12.34.56.78'), '0:0:0:0:0:ffff:12.34.56.78', 'is_ipv6 0:0:0:0:0:ffff:12.34.56.78');
+
+is (is_ipv6('2067::'), '2067::', 'is_ipv6 2607::');
+is (is_ipv6('2067:::'), undef, 'is_ipv6 2607:::');
+is (is_ipv6('2067:::1'), undef, 'is_ipv6 2607:::1');
+is (is_ipv6('2067::1:'), undef, 'is_ipv6 2607::1:');
+
+is (is_ipv6('216.17.184.1'), undef, 'is_ipv6 216.17.184.1');
+is (is_ipv6('bbb.bbb.bbb'), undef, 'is_ipv6 bbb.bbb.bbb');
+
+is (is_linklocal_ipv6('fe80:db8::4'), 'fe80:db8::4', 'is_linklocal_ipv6 fe80:db8::4');
+is (is_linklocal_ipv6('fe80:db8'), undef, 'is_linklocal_ipv6 fe80:db8');
+
+
More information about the Pkg-perl-cvs-commits
mailing list