[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - xmlsecurity/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Jun 28 08:11:39 UTC 2017


 xmlsecurity/source/gpg/SecurityEnvironment.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 40c2e584df0cbef84d21c03ca889078a3b093a0f
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Fri Jun 23 10:18:01 2017 +0200

    tdf#108692 gpg4libre: List all gpg keys
    
    Change-Id: I7300da36215233fa91b7a04a42b1c9bf907ad78b
    (cherry picked from commit 91ffe409e35479d024f629fe1b5ce474993a0f54)
    Reviewed-on: https://gerrit.libreoffice.org/39163
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
index 9892ec6ac5c8..bc7611fa7968 100644
--- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx
+++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx
@@ -65,6 +65,7 @@ OUString SecurityEnvironmentGpg::getSecurityEnvironmentInformation()
 Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertificates()
 {
     CertificateImpl* xCert;
+    std::list< GpgME::Key > keyList;
     std::list< CertificateImpl* > certsList;
 
     m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL);
@@ -74,13 +75,19 @@ Sequence< Reference < XCertificate > > SecurityEnvironmentGpg::getPersonalCertif
         if (err)
             break;
         if (!k.isInvalid()) {
-            xCert = new CertificateImpl();
-            xCert->setCertificate(m_ctx.get(),k);
-            certsList.push_back(xCert);
+            // We can't create CertificateImpl here as CertificateImpl::setCertificate uses GpgME API
+            // which interrupts our key listing here. So first get the keys from GpgME, then create the CertificateImpls
+            keyList.push_back(k);
         }
     }
     m_ctx->endKeyListing();
 
+    for (auto const& key : keyList) {
+        xCert = new CertificateImpl();
+        xCert->setCertificate(m_ctx.get(),key);
+        certsList.push_back(xCert);
+    }
+
     Sequence< Reference< XCertificate > > xCertificateSequence(certsList.size());
     std::list< CertificateImpl* >::iterator xcertIt;
     int i;


More information about the Libreoffice-commits mailing list