Updated Branches:
  refs/heads/master 390022c4e -> bd5ad442d

CLOUDSTACK-3084: Added check to disallow -ve number for ACL rule


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bd5ad442
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bd5ad442
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bd5ad442

Branch: refs/heads/master
Commit: bd5ad442d0f82467cf10fea409511a5dea0a5704
Parents: 390022c
Author: Kishan Kavala <kis...@cloud.com>
Authored: Mon Jun 24 17:13:52 2013 +0530
Committer: Kishan Kavala <kis...@cloud.com>
Committed: Mon Jun 24 17:20:29 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/network/vpc/NetworkACLServiceImpl.java | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bd5ad442/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java 
b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
index b0c807e..4c97869 100644
--- a/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
+++ b/server/src/com/cloud/network/vpc/NetworkACLServiceImpl.java
@@ -308,7 +308,7 @@ public class NetworkACLServiceImpl extends ManagerBase 
implements NetworkACLServ
         }
 
         validateNetworkACLItem(aclItemCmd.getSourcePortStart(), 
aclItemCmd.getSourcePortEnd(), aclItemCmd.getSourceCidrList(),
-                aclItemCmd.getProtocol(), aclItemCmd.getIcmpCode(), 
aclItemCmd.getIcmpType(), aclItemCmd.getAction());
+                aclItemCmd.getProtocol(), aclItemCmd.getIcmpCode(), 
aclItemCmd.getIcmpType(), aclItemCmd.getAction(), aclItemCmd.getNumber());
 
         return 
_networkAclMgr.createNetworkACLItem(aclItemCmd.getSourcePortStart(),
                 aclItemCmd.getSourcePortEnd(), aclItemCmd.getProtocol(), 
aclItemCmd.getSourceCidrList(), aclItemCmd.getIcmpCode(),
@@ -316,7 +316,7 @@ public class NetworkACLServiceImpl extends ManagerBase 
implements NetworkACLServ
     }
 
     private void validateNetworkACLItem(Integer portStart, Integer portEnd, 
List<String> sourceCidrList, String protocol, Integer icmpCode,
-                                        Integer icmpType, String action) {
+                                        Integer icmpType, String action, 
Integer number) {
 
         if (portStart != null && !NetUtils.isValidPort(portStart)) {
             throw new InvalidParameterValueException("publicPort is an invalid 
value: " + portStart);
@@ -388,6 +388,11 @@ public class NetworkACLServiceImpl extends ManagerBase 
implements NetworkACLServ
                 throw new InvalidParameterValueException("Invalid action. 
Allowed actions are Allow and Deny");
             }
         }
+
+        //Check for valid number
+        if(number != null && number < 1){
+            throw new InvalidParameterValueException("Invalid number. Number 
cannot be < 1");
+        }
     }
 
     @Override
@@ -526,7 +531,7 @@ public class NetworkACLServiceImpl extends ManagerBase 
implements NetworkACLServ
         }
 
         validateNetworkACLItem((sourcePortStart == null) ? 
aclItem.getSourcePortStart() : sourcePortStart, (sourcePortEnd == null) ? 
aclItem.getSourcePortEnd() : sourcePortEnd,
-                sourceCidrList, protocol, icmpCode, (icmpType == null) ? 
aclItem.getIcmpType() : icmpType, action);
+                sourceCidrList, protocol, icmpCode, (icmpType == null) ? 
aclItem.getIcmpType() : icmpType, action, number);
 
         return _networkAclMgr.updateNetworkACLItem(id, protocol, 
sourceCidrList, trafficType, action, number, sourcePortStart,
                 sourcePortEnd, icmpCode, icmpType);

Reply via email to