From 329701a34ee4d3bd439913aebed88c4b9f5b0437 Mon Sep 17 00:00:00 2001 From: Aetf Date: Thu, 7 Nov 2019 21:28:49 -0500 Subject: [PATCH] Secret Service Integration Fixes (#3761) * FdoSecrets: create prompt object only when necessary * FdoSecrets: negotiationOutput should always return a valid QVariant otherwise QDBus will fail to create a reply, causing timeout in client. * FdoSecrets: include in debug info --- src/core/Tools.cpp | 3 +++ src/fdosecrets/objects/Service.cpp | 8 ++++++-- src/fdosecrets/objects/SessionCipher.cpp | 5 ----- src/fdosecrets/objects/SessionCipher.h | 7 ++++++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/core/Tools.cpp b/src/core/Tools.cpp index 9035a96a7..2dbf0093d 100644 --- a/src/core/Tools.cpp +++ b/src/core/Tools.cpp @@ -108,6 +108,9 @@ namespace Tools #ifdef WITH_XC_TOUCHID extensions += "\n- " + QObject::tr("TouchID"); #endif +#ifdef WITH_XC_FDOSECRETS + extensions += "\n- " + QObject::tr("Secret Service Integration"); +#endif if (extensions.isEmpty()) extensions = " " + QObject::tr("None"); diff --git a/src/fdosecrets/objects/Service.cpp b/src/fdosecrets/objects/Service.cpp index cf9dfdbf7..6bca1f12c 100644 --- a/src/fdosecrets/objects/Service.cpp +++ b/src/fdosecrets/objects/Service.cpp @@ -303,7 +303,9 @@ namespace FdoSecrets toUnlock << coll; } } - prompt = new UnlockCollectionsPrompt(this, toUnlock); + if (!toUnlock.isEmpty()) { + prompt = new UnlockCollectionsPrompt(this, toUnlock); + } return unlocked; } @@ -339,7 +341,9 @@ namespace FdoSecrets toLock << coll; } } - prompt = new LockCollectionsPrompt(this, toLock); + if (!toLock.isEmpty()) { + prompt = new LockCollectionsPrompt(this, toLock); + } return locked; } diff --git a/src/fdosecrets/objects/SessionCipher.cpp b/src/fdosecrets/objects/SessionCipher.cpp index 374580eed..dcdbc1932 100644 --- a/src/fdosecrets/objects/SessionCipher.cpp +++ b/src/fdosecrets/objects/SessionCipher.cpp @@ -44,11 +44,6 @@ namespace namespace FdoSecrets { - QVariant CipherPair::negotiationOutput() const - { - return {}; - } - DhIetf1024Sha256Aes128CbcPkcs7::DhIetf1024Sha256Aes128CbcPkcs7(const QByteArray& clientPublicKeyBytes) : m_valid(false) { diff --git a/src/fdosecrets/objects/SessionCipher.h b/src/fdosecrets/objects/SessionCipher.h index 7d1d32d42..124636fdd 100644 --- a/src/fdosecrets/objects/SessionCipher.h +++ b/src/fdosecrets/objects/SessionCipher.h @@ -35,7 +35,7 @@ namespace FdoSecrets virtual SecretStruct encrypt(const SecretStruct& input) = 0; virtual SecretStruct decrypt(const SecretStruct& input) = 0; virtual bool isValid() const = 0; - virtual QVariant negotiationOutput() const; + virtual QVariant negotiationOutput() const = 0; }; class PlainCipher : public CipherPair @@ -57,6 +57,11 @@ namespace FdoSecrets { return true; } + + QVariant negotiationOutput() const override + { + return QStringLiteral(""); + } }; class DhIetf1024Sha256Aes128CbcPkcs7 : public CipherPair