r66640 - 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
Thu Dec 30 14:17:49 UTC 2010


Author: carnil
Date: Thu Dec 30 14:15:18 2010
New Revision: 66640

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=66640
Log:
[svn-upgrade] new version libdata-validate-ip-perl (0.12)

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=66640&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/Changes (original)
+++ branches/upstream/libdata-validate-ip-perl/current/Changes Thu Dec 30 14:15:18 2010
@@ -1,5 +1,10 @@
 Revision history for Perl extension Data::Validate::IP.
 
+0.12  Wed Dec  29 2010
+	- Fixed parsing of trailing :: (such as 2001::), as that is valid
+		This address bug#58991 - Thanks to Alan.Chester at tekelec.com for identifying the problem
+	- Also fixed incorrectly treating 2001::1: as a valid IPv6 address when it isn't
+	
 0.11  Mon Mar  01 2010
 	- Added support for is_innet_ipv4 - simple check to see if IP is in network
 		Thanks to "Bartłomiej Syryjczyk" <bartlomiej at syryjczyk.name> for suggesting the function

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=66640&op=diff
==============================================================================
--- branches/upstream/libdata-validate-ip-perl/current/META.yml (original)
+++ branches/upstream/libdata-validate-ip-perl/current/META.yml Thu Dec 30 14:15:18 2010
@@ -1,6 +1,6 @@
 --- #YAML:1.0
 name:               Data-Validate-IP
-version:            0.11
+version:            0.12
 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=66640&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 Thu Dec 30 14:15:18 2010
@@ -41,7 +41,7 @@
                 is_linklocal_ipv6
 );
 
-our $VERSION = '0.11';
+our $VERSION = '0.12';
 
 #Global, we store this only once
 my %MASK;
@@ -246,6 +246,14 @@
 		$ipv4 = pop(@chunks);
 	}
 	my $empty = 0;
+	#Workaround to handle trailing :: being valid
+
+	if ($value =~ /[0123456789abcdef]{0,4}::$/) {
+		$empty++;
+	} elsif ($value =~ /:$/) {
+		#single trailing ':' is invalid
+		return;
+	}
 	foreach (@chunks) {
 		return unless (/^[0123456789abcdef]{0,4}$/i);
 		$empty++ if /^$/;
@@ -262,8 +270,12 @@
 	}
 	#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 join(':', @chunks);
+
+       	my $return = join(':', @chunks);
+	#Need to handle the exception of trailing :: being valid
+	return $return . '::' if ($value =~ /::$/);
+	return $return;
+	
 }
 
 =pod

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=66640&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 Thu Dec 30 14:15:18 2010
@@ -5,7 +5,7 @@
 
 # change 'tests => 1' to 'tests => last_test_to_print';
 
-use Test::More tests => 45;
+use Test::More tests => 49;
 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) ) };
 
 #########################
@@ -58,6 +58,10 @@
 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:');
 
 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');




More information about the Pkg-perl-cvs-commits mailing list