From: Kevin Ottens Date: Tue, 8 Dec 2020 14:51:48 +0000 (+0100) Subject: Remove encrypt status job fetching from ClientSideEncryption X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~468^2~35 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b2533e64513e7909ebaca3def752a77ee4925659;p=nextcloud-desktop.git Remove encrypt status job fetching from ClientSideEncryption This is now unused. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/clientsideencryption.cpp b/src/libsync/clientsideencryption.cpp index 5585fdb31..69dfafc62 100644 --- a/src/libsync/clientsideencryption.cpp +++ b/src/libsync/clientsideencryption.cpp @@ -764,6 +764,8 @@ QByteArray encryptStringAsymmetric(EVP_PKEY *publicKey, const QByteArray& data) } } + + ClientSideEncryption::ClientSideEncryption() = default; void ClientSideEncryption::setAccount(AccountPtr account) @@ -1224,67 +1226,6 @@ void ClientSideEncryption::getPublicKeyFromServer() job->start(); } -void ClientSideEncryption::scheduleFolderEncryptedStatusJob(const QString &path) -{ - auto getEncryptedStatus = new GetFolderEncryptStatusJob(_account, path, this); - connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusReceived, - this, &ClientSideEncryption::folderEncryptedStatusFetched); - connect(getEncryptedStatus, &GetFolderEncryptStatusJob::encryptStatusError, - this, &ClientSideEncryption::folderEncryptedStatusError); - getEncryptedStatus->start(); - - _folderStatusJobs.append(getEncryptedStatus); -} - -void ClientSideEncryption::fetchFolderEncryptedStatus() -{ - _refreshingEncryptionStatus = true; - _folder2encryptedStatus.clear(); - scheduleFolderEncryptedStatusJob(QString()); -} - -void ClientSideEncryption::folderEncryptedStatusFetched(const QHash& result) -{ - auto job = static_cast(sender()); - Q_ASSERT(job); - - _folderStatusJobs.removeAll(job); - - qCDebug(lcCse) << "Retrieved correctly the encrypted status of the folders for" << job->folder() << result; - - // FIXME: Can be replaced by _folder2encryptedStatus.insert(result); once we depend on Qt 5.15 - for (auto it = result.constKeyValueBegin(); it != result.constKeyValueEnd(); ++it) { - _folder2encryptedStatus.insert((*it).first, (*it).second); - } - - for (const auto &folder : result.keys()) { - if (folder == job->folder()) { - continue; - } - scheduleFolderEncryptedStatusJob(folder); - } - - if (_folderStatusJobs.isEmpty()) { - _refreshingEncryptionStatus = false; - emit folderEncryptedStatusFetchDone(_folder2encryptedStatus); - } -} - -void ClientSideEncryption::folderEncryptedStatusError(int error) -{ - auto job = static_cast(sender()); - Q_ASSERT(job); - - qCDebug(lcCse) << "Failed to retrieve the status of the folders for" << job->folder() << error; - - _folderStatusJobs.removeAll(job); - - if (_folderStatusJobs.isEmpty()) { - _refreshingEncryptionStatus = false; - emit folderEncryptedStatusFetchDone(_folder2encryptedStatus); - } -} - FolderMetadata::FolderMetadata(AccountPtr account, const QByteArray& metadata, int statusCode) : _account(account) { if (metadata.isEmpty() || statusCode == 404) { diff --git a/src/libsync/clientsideencryption.h b/src/libsync/clientsideencryption.h index 5622c2d0b..37d220ec2 100644 --- a/src/libsync/clientsideencryption.h +++ b/src/libsync/clientsideencryption.h @@ -23,8 +23,6 @@ class ReadPasswordJob; namespace OCC { -class GetFolderEncryptStatusJob; - QString baseUrl(); namespace EncryptionHelper { @@ -80,7 +78,6 @@ public: void generateKeyPair(); void generateCSR(EVP_PKEY *keyPair); void encryptPrivateKey(); - void fetchFolderEncryptedStatus(); void forgetSensitiveData(); @@ -90,9 +87,6 @@ public slots: void slotRequestMnemonic(); private slots: - void folderEncryptedStatusFetched(const QHash &values); - void folderEncryptedStatusError(int error); - void publicKeyFetched(QKeychain::Job *incoming); void privateKeyFetched(QKeychain::Job *incoming); void mnemonicKeyFetched(QKeychain::Job *incoming); @@ -101,10 +95,8 @@ signals: void initializationFinished(); void mnemonicGenerated(const QString& mnemonic); void showMnemonic(const QString& mnemonic); - void folderEncryptedStatusFetchDone(const QHash &values); private: - void scheduleFolderEncryptedStatusJob(const QString &path); void getPrivateKeyFromServer(); void getPublicKeyFromServer(); void decryptPrivateKey(const QByteArray &key); @@ -117,10 +109,6 @@ private: AccountPtr _account; bool isInitialized = false; - bool _refreshingEncryptionStatus = false; - //TODO: Save this on disk. - QHash _folder2encryptedStatus; - QVector _folderStatusJobs; public: //QSslKey _privateKey;