summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-03-07 14:43:43 +0100
committerPetr Vobornik <pvoborni@redhat.com>2012-03-14 09:07:58 +0100
commit6066432f0d4138473f0cd9fe4965558fbc054589 (patch)
treebea677c1e1a2657ac337b15c0f6266b1bcad98d7 /install
parent75b3755648c9bb0c9a8f724bed654a9f0136144d (diff)
downloadfreeipa-6066432f0d4138473f0cd9fe4965558fbc054589.tar.gz
freeipa-6066432f0d4138473f0cd9fe4965558fbc054589.tar.xz
freeipa-6066432f0d4138473f0cd9fe4965558fbc054589.zip
Fixed mask validation in network_validator
Network validator allowed invalid mask format: * leading zeros: 192.168.0.1/0024 * trailing chars: 192.168.0.1/24abcd It was fixed. https://fedorahosted.org/freeipa/ticket/2493
Diffstat (limited to 'install')
-rw-r--r--install/ui/dns.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 4cc6d4c53..512d2cc23 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -2231,7 +2231,7 @@ IPA.network_validator = function(spec) {
return that.true_result();
}
- var address_part, mask_part;
+ var address_part, mask;
if (value.indexOf('/') > -1) {
@@ -2239,9 +2239,9 @@ IPA.network_validator = function(spec) {
if (parts.length === 2) {
address_part = parts[0];
- mask_part = parts[1];
+ mask = parts[1];
- if (mask_part === '') return that.false_result();
+ if (mask === '') return that.false_result();
} else {
return that.false_result();
@@ -2260,14 +2260,12 @@ IPA.network_validator = function(spec) {
var address = NET.ip_address(address_part);
if (!address.valid) return that.false_result();
- if (mask_part) {
-
- var mask = parseInt(mask_part, 10);
+ if (mask) {
var mask_length = 32;
if (address.type === 'v6') mask_length = 128;
- if (isNaN(mask) || mask < 8 || mask > mask_length) {
+ if (!mask.match(/^[1-9]\d*$/) || mask < 8 || mask > mask_length) {
return that.false_result();
}
}