summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-29 21:34:23 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-08-30 09:12:56 +0200
commit59bcc90cad1bf07e6841dbd01ef503c10032ff0b (patch)
tree7166cb6102ce67ba3ea2ebc1de2cd751b488fadd /xmlsecurity
parent07b71a93278f39c3cdac12e18643c70dc5042cdc (diff)
xmlsecurity: use comphelper::containerToSequence()
Allows not iterating the certificate chain twice. Change-Id: I3993f8af24b28bef505d0e8c24bce8065580c2cf Reviewed-on: https://gerrit.libreoffice.org/59780 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx16
1 files changed, 6 insertions, 10 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 3f928b05bcc8..7e19c995ae88 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -40,6 +40,7 @@
#include <vector>
#include <memory>
#include <osl/thread.h>
+#include <comphelper/sequence.hxx>
#include "secerror.hxx"
@@ -438,15 +439,10 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi
}
if( certChain != nullptr ) {
- X509Certificate_NssImpl* pCert ;
- CERTCertListNode* node ;
- int len ;
+ std::vector<uno::Reference<security::XCertificate>> aCertChain;
- for( len = 0, node = CERT_LIST_HEAD( certChain ); !CERT_LIST_END( node, certChain ); node = CERT_LIST_NEXT( node ), len ++ ) ;
- Sequence< Reference< XCertificate > > xCertChain( len ) ;
-
- for( len = 0, node = CERT_LIST_HEAD( certChain ); !CERT_LIST_END( node, certChain ); node = CERT_LIST_NEXT( node ), len ++ ) {
- pCert = new X509Certificate_NssImpl() ;
+ for (CERTCertListNode* node = CERT_LIST_HEAD(certChain); !CERT_LIST_END(node, certChain); node = CERT_LIST_NEXT(node)) {
+ X509Certificate_NssImpl* pCert = new X509Certificate_NssImpl();
if( pCert == nullptr ) {
CERT_DestroyCertList( certChain ) ;
throw RuntimeException() ;
@@ -454,12 +450,12 @@ Sequence< Reference < XCertificate > > SecurityEnvironment_NssImpl::buildCertifi
pCert->setCert( node->cert ) ;
- xCertChain[len] = pCert ;
+ aCertChain.push_back(pCert);
}
CERT_DestroyCertList( certChain ) ;
- return xCertChain ;
+ return comphelper::containerToSequence(aCertChain);
}
return Sequence< Reference < XCertificate > >();