|
44 | 44 | import javax.inject.Inject; |
45 | 45 | import javax.naming.ConfigurationException; |
46 | 46 |
|
| 47 | +import com.cloud.network.vpc.VpcVO; |
47 | 48 | import com.cloud.utils.security.CertificateHelper; |
48 | 49 | import com.cloud.api.query.dao.ManagementServerJoinDao; |
49 | 50 | import com.cloud.api.query.vo.ManagementServerJoinVO; |
@@ -2499,12 +2500,20 @@ public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(final ListP |
2499 | 2500 | } |
2500 | 2501 |
|
2501 | 2502 | if (associatedNetworkId != null) { |
2502 | | - _accountMgr.checkAccess(caller, null, false, networkDao.findById(associatedNetworkId)); |
2503 | | - sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2503 | + NetworkVO associatedNetwork = networkDao.findById(associatedNetworkId); |
| 2504 | + |
| 2505 | + if (associatedNetwork != null) { |
| 2506 | + _accountMgr.checkAccess(caller, null, false, associatedNetwork); |
| 2507 | + sc.setParameters("associatedNetworkIdEq", associatedNetworkId); |
| 2508 | + } |
2504 | 2509 | } |
2505 | 2510 | if (vpcId != null) { |
2506 | | - _accountMgr.checkAccess(caller, null, false, _vpcDao.findById(vpcId)); |
2507 | | - sc.setParameters("vpcId", vpcId); |
| 2511 | + VpcVO vpc = _vpcDao.findById(vpcId); |
| 2512 | + |
| 2513 | + if (vpc != null) { |
| 2514 | + _accountMgr.checkAccess(caller, null, false, vpc); |
| 2515 | + sc.setParameters("vpcId", vpcId); |
| 2516 | + } |
2508 | 2517 | } |
2509 | 2518 |
|
2510 | 2519 | addrs = _publicIpAddressDao.search(sc, searchFilter); // Allocated |
|
0 commit comments