CLOUDSTACK-2477: [GSLB] CloudStack currently allows admin to map LB rule
of one account to GSLB rule of a different account

ensuring account id of GSLB rule and LB rule are same


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

Branch: refs/heads/vmware-storage-motion
Commit: c8a0c40a2f50fdabab085a0d6896edcdb8226ef4
Parents: 2b93969
Author: Murali Reddy <muralimmre...@gmail.com>
Authored: Wed May 29 17:01:54 2013 +0530
Committer: Murali Reddy <muralimmre...@gmail.com>
Committed: Wed May 29 18:54:35 2013 +0530

----------------------------------------------------------------------
 .../gslb/GlobalLoadBalancingRulesServiceImpl.java  |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c8a0c40a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
 
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
index a803f9f..96ac76e 100644
--- 
a/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
+++ 
b/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
@@ -204,6 +204,10 @@ public class GlobalLoadBalancingRulesServiceImpl 
implements GlobalLoadBalancingR
 
             _accountMgr.checkAccess(caller, null, true, loadBalancer);
 
+            if (gslbRule.getAccountId() != loadBalancer.getAccountId()) {
+                throw new InvalidParameterValueException("GSLB rule and load 
balancer rule does not belong to same account");
+            }
+
             if (loadBalancer.getState() == LoadBalancer.State.Revoke) {
                 throw new InvalidParameterValueException("Load balancer ID " + 
loadBalancer.getUuid()  + " is in revoke state");
             }

Reply via email to