Originally this was in the WebFlowCredentials class. Since we've abstracted everything
from there already, let's also move this in case some other code may use
KeychainChunk::ReadJob prior to WebFlowCredentials.
Signed-off-by: Michael Schuster <michael@schuster.ms>
}
#endif
} else {
- if (readJob->error() != QKeychain::Error::EntryNotFound ||
- ((readJob->error() == QKeychain::Error::EntryNotFound) && _chunkCount == 0)) {
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+ if (!readJob->insecureFallback()) { // If insecureFallback is set, the next test would be pointless
+ if (_retryOnKeyChainError && (readJob->error() == QKeychain::NoBackendAvailable
+ || readJob->error() == QKeychain::OtherError)) {
+ // Could be that the backend was not yet available. Wait some extra seconds.
+ // (Issues #4274 and #6522)
+ // (For kwallet, the error is OtherError instead of NoBackendAvailable, maybe a bug in QtKeychain)
+ qCInfo(lcKeychainChunk) << "Backend unavailable (yet?) Retrying in a few seconds." << readJob->errorString();
+ QTimer::singleShot(10000, this, &ReadJob::start);
+ _retryOnKeyChainError = false;
+ readJob->deleteLater();
+ return;
+ }
+ _retryOnKeyChainError = false;
+ }
+#endif
+
+ if (readJob->error() != QKeychain::EntryNotFound ||
+ ((readJob->error() == QKeychain::EntryNotFound) && _chunkCount == 0)) {
_error = readJob->error();
_errorString = readJob->errorString();
qCWarning(lcKeychainChunk) << "Unable to read" << readJob->key() << "chunk" << QString::number(_chunkCount) << readJob->errorString();
private slots:
void slotReadJobDone(QKeychain::Job *incomingJob);
+
+#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
+private:
+ bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
+#endif
}; // class ReadJob
} // namespace KeychainChunk
void WebFlowCredentials::slotReadClientCertPEMJobDone(KeychainChunk::ReadJob *readJob)
{
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
- Q_ASSERT(!readJob->insecureFallback()); // If insecureFallback is set, the next test would be pointless
- if (_retryOnKeyChainError && (readJob->error() == QKeychain::NoBackendAvailable
- || readJob->error() == QKeychain::OtherError)) {
- // Could be that the backend was not yet available. Wait some extra seconds.
- // (Issues #4274 and #6522)
- // (For kwallet, the error is OtherError instead of NoBackendAvailable, maybe a bug in QtKeychain)
- qCInfo(lcWebFlowCredentials) << "Backend unavailable (yet?) Retrying in a few seconds." << readJob->errorString();
- QTimer::singleShot(10000, this, &WebFlowCredentials::fetchFromKeychainHelper);
- _retryOnKeyChainError = false;
- return;
- }
- _retryOnKeyChainError = false;
-#endif
-
// Store PEM in memory
if (readJob->error() == NoError && readJob->binaryData().length() > 0) {
QList<QSslCertificate> sslCertificateList = QSslCertificate::fromData(readJob->binaryData(), QSsl::Pem);
bool _ready = false;
bool _credentialsValid = false;
bool _keychainMigration = false;
- bool _retryOnKeyChainError = true; // true if we haven't done yet any reading from keychain
WebFlowCredentialsDialog *_askDialog = nullptr;
};