cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [3/4] git commit: updated refs/heads/master to 1acec83
Date Mon, 09 Sep 2013 20:58:21 GMT
CLOUDSTACK-4346 uses of parseInt and parseLong secured


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

Branch: refs/heads/master
Commit: 25c8cee01a450ee924fe108cafe54b046485ab2b
Parents: 947f49d
Author: Daan Hoogland <daan@onecht.net>
Authored: Wed Sep 4 09:20:42 2013 +0200
Committer: Daan Hoogland <daan@onecht.net>
Committed: Mon Sep 9 22:19:59 2013 +0200

----------------------------------------------------------------------
 .../com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java  | 2 ++
 .../src/com/cloud/network/resource/JuniperSrxResource.java    | 7 ++++---
 .../src/com/cloud/network/guru/ExternalGuestNetworkGuru.java  | 2 ++
 .../com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java  | 6 +++---
 4 files changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25c8cee0/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
index 48233c4..daf65a1 100644
--- a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
+++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java
@@ -165,6 +165,8 @@ public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru {
             throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet
as a " +
                         "part of network " + network + " implement ", DataCenter.class, dcId);
         }
+        // when supporting more types of networks this need to become
+//        int vlan = Integer.parseInt(BroadcastDomainType.getValue(vnet));
         int vlan = Integer.parseInt(vnet);
 
         // Name is either the given name or the uuid

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25c8cee0/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
index 3bcbf2d..46ef332 100644
--- a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
+++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java
@@ -65,6 +65,7 @@ import com.cloud.agent.api.to.IpAddressTO;
 import com.cloud.agent.api.to.PortForwardingRuleTO;
 import com.cloud.agent.api.to.StaticNatRuleTO;
 import com.cloud.host.Host;
+import com.cloud.network.Networks.BroadcastDomainType;
 import com.cloud.network.rules.FirewallRule;
 import com.cloud.network.rules.FirewallRule.Purpose;
 import com.cloud.resource.ServerResource;
@@ -698,8 +699,7 @@ public class JuniperSrxResource implements ServerResource {
             Long publicVlanTag = null;
             if (ip.getVlanId() != null && !ip.getVlanId().equals("untagged")) {
             	try {
-                    // TODO BroadcastDomain.getValue(ip.getVlanId) ???
-            		publicVlanTag = Long.parseLong(ip.getVlanId());
+                    publicVlanTag = Long.parseLong(BroadcastDomainType.getValue(ip.getVlanId()));
             	} catch (Exception e) {
             		throw new ExecutionException("Could not parse public VLAN tag: " + ip.getVlanId());
             	}
@@ -3581,7 +3581,8 @@ public class JuniperSrxResource implements ServerResource {
     	Long publicVlanTag = null;
     	if (!vlan.equals("untagged")) {
     		try {
-    			publicVlanTag = Long.parseLong(vlan);
+                // make sure this vlan is numeric
+                publicVlanTag = Long.parseLong(BroadcastDomainType.getValue(vlan));
     		} catch (Exception e) {
     			throw new ExecutionException("Unable to parse VLAN tag: " + vlan);
     		}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25c8cee0/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
index 79a4053..55a33cc 100644
--- a/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
+++ b/server/src/com/cloud/network/guru/ExternalGuestNetworkGuru.java
@@ -143,6 +143,8 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
                 UseSystemGuestVlans.valueIn(config.getAccountId()));
 
             try {
+                // when supporting more types of networks this need to become
+//              int vlantag = Integer.parseInt(BroadcastDomainType.getValue(vnet));
                 vlanTag = Integer.parseInt(vnet);
             } catch (NumberFormatException e) {
                 throw new CloudRuntimeException("Obtained an invalid guest vlan tag. Exception:
" + e.getMessage());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/25c8cee0/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index 1cd1deb..ac34b49 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -499,10 +499,10 @@ public class HypervisorHostHelper {
 
             if(vlanId != null && !UNTAGGED_VLAN_NAME.equalsIgnoreCase(vlanId)) {
                 createGCTag = true;
-                vid = Integer.parseInt(vlanId);
+                vid = Integer.parseInt(BroadcastDomainType.getValue(vlanId));
             }
             if (secondaryvlanId != null) {
-                spvlanid = Integer.parseInt(secondaryvlanId);
+                spvlanid = Integer.parseInt(BroadcastDomainType.getValue(secondaryvlanId));
             }
         }
 
@@ -937,7 +937,7 @@ public class HypervisorHostHelper {
 
             if(vlanId != null && !UNTAGGED_VLAN_NAME.equalsIgnoreCase(vlanId) ) {
                 createGCTag = true;
-                vid = Integer.parseInt(vlanId);
+                vid = Integer.parseInt(BroadcastDomainType.getValue(vlanId));
             }
         }
 


Mime
View raw message