[Libreoffice-commits] core.git: xmlsecurity/source

Franklin Weng (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 20 13:15:40 UTC 2019


 xmlsecurity/source/dialogs/certificatechooser.cxx |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

New commits:
commit 648990692c8253e3843c4c5954940e8b893d5f3e
Author:     Franklin Weng <franklin at goodhorse.idv.tw>
AuthorDate: Sun Aug 18 21:30:05 2019 +0800
Commit:     Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Tue Aug 20 15:14:48 2019 +0200

    tdf#116862 do not encrypt to self when encryption key is not set
    
    When "always encrypt to self" is checked but no encryption key is set,
    encrypting a file with GPG key would cause error.  So check if
    msPreferredKey is empty or not before comparing with sIssuer.
    
    Change-Id: I4d95f0b436cb1fafad1d57d50330fd2080902b69
    Reviewed-on: https://gerrit.libreoffice.org/77665
    Tested-by: Jenkins
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 32c688f2a257..795e9bf3ae07 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -220,13 +220,15 @@ void CertificateChooser::ImplInitialize()
 
 #if HAVE_FEATURE_GPGME
             // only GPG has preferred keys
-            if ( sIssuer == msPreferredKey )
-            {
-                if ( meAction == UserAction::Sign || meAction == UserAction::SelectSign )
-                    m_xCertLB->select(nRow);
-                else if ( meAction == UserAction::Encrypt &&
-                          aUserOpts.GetEncryptToSelf() )
-                    mxEncryptToSelf = xCert;
+            if ( !sIssuer.isEmpty() && !msPreferredKey.isEmpty() ) {
+                if ( sIssuer == msPreferredKey )
+                {
+                    if ( meAction == UserAction::Sign || meAction == UserAction::SelectSign )
+                        m_xCertLB->select(nRow);
+                    else if ( meAction == UserAction::Encrypt &&
+                              aUserOpts.GetEncryptToSelf() )
+                        mxEncryptToSelf = xCert;
+                }
             }
 #endif
         }


More information about the Libreoffice-commits mailing list