mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4586 Added CIDR validation for SG Egress rules
This commit is contained in:
parent
8c3986df81
commit
b99962d27f
|
|
@ -207,13 +207,6 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
if(cidrList != null){
|
||||
for(String cidr : cidrList ){
|
||||
if (!NetUtils.isValidCIDR(cidr)){
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, cidr + " is an Invalid CIDR ");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<? extends SecurityRule> ingressRules = _securityGroupService.authorizeSecurityGroupIngress(this);
|
||||
if (ingressRules != null && !ingressRules.isEmpty()) {
|
||||
SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules);
|
||||
|
|
|
|||
|
|
@ -600,6 +600,14 @@ public class SecurityGroupManagerImpl extends ManagerBase implements SecurityGro
|
|||
protocol = NetUtils.ALL_PROTO;
|
||||
}
|
||||
|
||||
if(cidrList != null){
|
||||
for(String cidr : cidrList ){
|
||||
if (!NetUtils.isValidCIDR(cidr)){
|
||||
throw new InvalidParameterValueException("Invalid cidr " + cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!NetUtils.isValidSecurityGroupProto(protocol)) {
|
||||
throw new InvalidParameterValueException("Invalid protocol " + protocol);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue