Fixed IPv6 validation special case: single colon

IPv6 parsing was incorrectly evaluating ':' as a valid IPv6 address.

https://fedorahosted.org/freeipa/ticket/1466
This commit is contained in:
Petr Vobornik authored and Endi S. Dewata committed 2012-01-03 21:28:53 -06:00
1 parent c7ae0c20db
commit ceee08faa1
2 files changed
+8

No files matched your search

+5
View File
@@ -125,6 +125,11 @@ NET.ip_address = function(spec) {
var i;
//usecases like ':'
if (that.parts.length <= 2) {
return that.set_error('invalid format');
}
for (i=0; i<that.parts.length; i++) {
var part = that.parts[i];
+3
View File
@@ -156,6 +156,9 @@ test('Testing incorrect IPv6 addresses', function() {
address = NET.ip_address('2001:db8:85a3:0:0:8a2e:370');
ok(!address.valid, 'Missing part - 2001:db8:85a3:0:0:8a2e:370');
address = NET.ip_address(':');
ok(!address.valid, 'Address - :');
address = NET.ip_address('::1::');
ok(!address.valid, 'Address - ::1::');