|
44 | 44 | import javax.inject.Inject; |
45 | 45 | import javax.naming.ConfigurationException; |
46 | 46 |
|
| 47 | +import com.cloud.network.vpc.VpcVO; |
47 | 48 | import org.apache.cloudstack.acl.ControlledEntity; |
48 | 49 | import org.apache.cloudstack.acl.SecurityChecker; |
49 | 50 | import org.apache.cloudstack.affinity.AffinityGroupProcessor; |
@@ -2580,12 +2581,21 @@ public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(final ListP |
2580 | 2581 | } |
2581 | 2582 |
|
2582 | 2583 | if (associatedNetworkId != null) { |
2583 | | - _accountMgr.checkAccess(caller, null, false, networkDao.findById(associatedNetworkId)); |
2584 | | - sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2584 | + NetworkVO associatedNetwork = networkDao.findById(associatedNetworkId); |
| 2585 | + |
| 2586 | + if (associatedNetwork != null) { |
| 2587 | + _accountMgr.checkAccess(caller, null, false, associatedNetwork); |
| 2588 | + sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2589 | + } |
2585 | 2590 | } |
| 2591 | + |
2586 | 2592 | if (vpcId != null) { |
2587 | | - _accountMgr.checkAccess(caller, null, false, _vpcDao.findById(vpcId)); |
2588 | | - sc.setParameters("vpcId", vpcId); |
| 2593 | + VpcVO vpc = _vpcDao.findById(vpcId); |
| 2594 | + |
| 2595 | + if (vpc != null) { |
| 2596 | + _accountMgr.checkAccess(caller, null, false, vpc); |
| 2597 | + sc.setParameters("vpcId", vpcId); |
| 2598 | + } |
2589 | 2599 | } |
2590 | 2600 |
|
2591 | 2601 | addrs = _publicIpAddressDao.search(sc, searchFilter); // Allocated |
|
0 commit comments