浏览代码

HPCC-17434 Properly process IP/IP-Ranges/Hostnames

- Adds front end IP restrictions
- Removes invalid hostname restriction

Signed-off-by: Rodrigo Pastrana <rodrigo.pastrana@lexisnexis.com>
Rodrigo Pastrana 8 年之前
父节点
当前提交
c474a2322a
共有 2 个文件被更改,包括 11 次插入3 次删除
  1. 1 1
      deployment/deployutils/deployutils.cpp
  2. 10 2
      esp/files/scripts/configmgr/common.js

+ 1 - 1
deployment/deployutils/deployutils.cpp

@@ -3373,7 +3373,7 @@ void formIPList(const char* ip, StringArray& formattedIpList)
           {
               //we should only enter this section IF we encounter a true ip range, not just a hostname with a dash
               IpAddress range;
-              if(range.ipsetrange(ip) >1 && !range.isHost())
+              if(range.ipsetrange(ip) > 1)
               {
                 StringArray rangeArr, commIPPart ;
                 StringBuffer comip;

+ 10 - 2
esp/files/scripts/configmgr/common.js

@@ -300,7 +300,7 @@ function isValidNetworkAddress(addressList, theName, ignoredot, checkspecial)
     {
       if (match[1])
             errorString = errorString + theName + ": " + currentAddress + " contains a URL connection protocol.\n";
-      else if (match[2] == null)
+      else if (match[2] === null || match[2] === undefined)
           errorString = errorString + theName + ": " + currentAddress + " does not appear to contain a host.";
       else if (match[3] || match[4] || match[5] || match[6] || match[7] || match[8])
           errorString = errorString + theName + ": '" + currentAddress + "' should only contain a host name or ip/ip range.\n";
@@ -320,7 +320,15 @@ function isValidNetworkAddress(addressList, theName, ignoredot, checkspecial)
                 errorString = errorString + theName + ': ' + IPvalue + ' is a special IP address and cannot be used here.';
             }
 
-            if(ipRangeMatch[5] != null) //IP range format detected
+            for (var currIPIndex = 1; currIPIndex < 5; currIPIndex++)
+            {
+              if ( !isInteger(ipRangeMatch[currIPIndex]) || (parseInt(ipRangeMatch[currIPIndex]) > 255))
+              {
+                errorString = errorString + theName + ": " + currentAddress + " contains an invalid octet.";
+              }
+            }
+
+            if(ipRangeMatch[5]) //IP range format detected
             {
                 var invalidIPSubNet = isValidIPSubNetRange(ipRangeMatch[4], ipRangeMatch[5]);
                 if (invalidIPSubNet)