|
43 | 43 | import javax.inject.Inject; |
44 | 44 | import javax.naming.ConfigurationException; |
45 | 45 |
|
| 46 | +import com.cloud.network.vpc.VpcVO; |
46 | 47 | import org.apache.cloudstack.acl.ControlledEntity; |
47 | 48 | import org.apache.cloudstack.acl.SecurityChecker; |
48 | 49 | import org.apache.cloudstack.affinity.AffinityGroupProcessor; |
@@ -2648,12 +2649,21 @@ public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(final ListP |
2648 | 2649 | } |
2649 | 2650 |
|
2650 | 2651 | if (associatedNetworkId != null) { |
2651 | | - _accountMgr.checkAccess(caller, null, false, networkDao.findById(associatedNetworkId)); |
2652 | | - sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2652 | + NetworkVO associatedNetwork = networkDao.findById(associatedNetworkId); |
| 2653 | + |
| 2654 | + if (associatedNetwork != null) { |
| 2655 | + _accountMgr.checkAccess(caller, null, false, associatedNetwork); |
| 2656 | + sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2657 | + } |
2653 | 2658 | } |
| 2659 | + |
2654 | 2660 | if (vpcId != null) { |
2655 | | - _accountMgr.checkAccess(caller, null, false, _vpcDao.findById(vpcId)); |
2656 | | - sc.setParameters("vpcId", vpcId); |
| 2661 | + VpcVO vpc = _vpcDao.findById(vpcId); |
| 2662 | + |
| 2663 | + if (vpc != null) { |
| 2664 | + _accountMgr.checkAccess(caller, null, false, vpc); |
| 2665 | + sc.setParameters("vpcId", vpcId); |
| 2666 | + } |
2657 | 2667 | } |
2658 | 2668 |
|
2659 | 2669 | addrs = _publicIpAddressDao.search(sc, searchFilter); // Allocated |
|
0 commit comments