[
https://issues.apache.org/jira/browse/CLOUDSTACK-9632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15710055#comment-15710055
]
ASF GitHub Bot commented on CLOUDSTACK-9632:
--------------------------------------------
Github user jburwell commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1799#discussion_r90338636
--- Diff: server/src/org/apache/cloudstack/network/lb/CertServiceImpl.java
---
@@ -240,68 +245,71 @@ public void deleteSslCert(DeleteSslCertCmd
deleteSslCertCmd) {
}
if (projectId != null) {
- Project project = _projectMgr.getProject(projectId);
+ final Project project = _projectMgr.getProject(projectId);
if (project == null) {
throw new InvalidParameterValueException("Found no project
with id: " + projectId);
}
- List<SslCertVO> projectCertVOList =
_sslCertDao.listByAccountId(project.getProjectAccountId());
- if (projectCertVOList == null || projectCertVOList.isEmpty())
+ final List<SslCertVO> projectCertVOList =
_sslCertDao.listByAccountId(project.getProjectAccountId());
+ if (projectCertVOList == null || projectCertVOList.isEmpty()) {
return certResponseList;
+ }
_accountMgr.checkAccess(caller,
SecurityChecker.AccessType.UseEntry, true, projectCertVOList.get(0));
- for (SslCertVO cert : projectCertVOList) {
+ for (final SslCertVO cert : projectCertVOList) {
certLbMap = _lbCertDao.listByCertId(cert.getId());
certResponseList.add(createCertResponse(cert, certLbMap));
}
return certResponseList;
}
//reached here look by accountId
- List<SslCertVO> certVOList =
_sslCertDao.listByAccountId(accountId);
- if (certVOList == null || certVOList.isEmpty())
+ final List<SslCertVO> certVOList =
_sslCertDao.listByAccountId(accountId);
+ if (certVOList == null || certVOList.isEmpty()) {
return certResponseList;
+ }
_accountMgr.checkAccess(caller,
SecurityChecker.AccessType.UseEntry, true, certVOList.get(0));
- for (SslCertVO cert : certVOList) {
+ for (final SslCertVO cert : certVOList) {
certLbMap = _lbCertDao.listByCertId(cert.getId());
certResponseList.add(createCertResponse(cert, certLbMap));
}
return certResponseList;
}
- private void validate(String certInput, String keyInput, String
password, String chainInput) {
+ private void validate(final String certInput, final String keyInput,
final String password, final String chainInput) {
Certificate cert;
PrivateKey key;
List<Certificate> chain = null;
try {
cert = parseCertificate(certInput);
- key = parsePrivateKey(keyInput, password);
+ key = parsePrivateKey(keyInput);
if (chainInput != null) {
- chain = parseChain(chainInput);
+ chain = CertificateHelper.parseChain(chainInput);
}
- } catch (IOException e) {
+ } catch (final IOException | CertificateException e) {
throw new IllegalArgumentException("Parsing certificate/key
failed: " + e.getMessage(), e);
}
validateCert(cert, chainInput != null ? true : false);
validateKeys(cert.getPublicKey(), key);
- if (chainInput != null)
+ if (chainInput != null) {
validateChain(chain, cert);
+ }
}
- public SslCertResponse createCertResponse(SslCertVO cert,
List<LoadBalancerCertMapVO> lbCertMap) {
- SslCertResponse response = new SslCertResponse();
+ public SslCertResponse createCertResponse(final SslCertVO cert, final
List<LoadBalancerCertMapVO> lbCertMap) {
--- End diff --
Please consider adding the following `Preconditions.checkArgument` checks:
* `cert` is not `null`
* `lbCertMap` is not `null`
> Upgrade bountycastle to 1.55+
> -----------------------------
>
> Key: CLOUDSTACK-9632
> URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9632
> Project: CloudStack
> Issue Type: Bug
> Security Level: Public(Anyone can view this level - this is the
> default.)
> Reporter: Rohit Yadav
> Assignee: Rohit Yadav
> Fix For: Future, 4.10.0.0
>
>
> Upgrade bountycastle library to latest versions.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)