summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_openssl_p.h
diff options
context:
space:
mode:
authorJuha Turunen <turunen@iki.fi>2010-09-09 09:59:49 +0200
committerJason McDonald <jason.mcdonald@nokia.com>2010-09-10 18:38:38 +1000
commit657a1c6a96d78f18b92b72aba3e8d1621114d39b (patch)
treedd14796789defd173decd72ca6ed0b48584de766 /src/network/ssl/qsslsocket_openssl_p.h
parentd1bbab226ed859a2a2bf595df49ca8083d936d6b (diff)
QSslSocketPrivate::systemCaCertificates() hangs sometimes on Symbianv4.7.0
The patch fixes the hanging issues on some Symbian devices that occurs while retrieving certificates from the Symbian certificate store. The hanging was caused by the certificate info array not being closed before exiting the thread. This alone wouldn't make the existing implementation work, so the patch replaces it with a pure Symbian style implementation which doesn't seem to be affected (probably some OpenC threads issue). Merge-request: 808 Reviewed-by: Shane Kearns Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Task: QTBUG-13033 (cherry picked from commit 5342be5ceffc84b56476fff57dd7d5e1bbfeb471)
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl_p.h')
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h77
1 files changed, 33 insertions, 44 deletions
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index ca377d93c2..7716c95f6a 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -120,67 +120,56 @@ public:
};
#if defined(Q_OS_SYMBIAN)
+
+#include <QByteArray>
+#include <e32base.h>
+#include <f32file.h>
#include <unifiedcertstore.h> // link against certstore.lib
#include <ccertattributefilter.h> // link against ctframework.lib
-class QCertificateRetriever;
+// The purpose of this class is to wrap the asynchronous API of Symbian certificate store to one
+// synchronizable call. The user of this class needs to provide a TRequestStatus object which can
+// be used with User::WaitForRequest() unlike with the calls of the certificate store API.
+// A thread is used instead of a CActiveSchedulerWait scheme, because that would make the call
+// asynchronous (other events might be processed during the call even though the call would be seemingly
+// synchronous).
-class QCertificateConsumer : public QObject
+class CSymbianCertificateRetriever : public CActive
{
- Q_OBJECT
public:
- QCertificateConsumer(QObject* parent = 0);
- ~QCertificateConsumer();
-
- void finish();
-
- void addEncodedCertificate(const QByteArray& certificate)
- { certificates.append(certificate); }
- QList<QByteArray> encodedCertificates() const { return certificates; }
-
-public slots:
- void start();
+ static CSymbianCertificateRetriever* NewL();
+ ~CSymbianCertificateRetriever();
-signals:
- void finished();
+ int GetCertificates(QList<QByteArray> &aCertificates);
private:
- QList<QByteArray> certificates;
- QCertificateRetriever *retriever;
-};
-
-
-class QCertificateRetriever : public CActive
-{
-public:
- QCertificateRetriever(QCertificateConsumer* consumer);
- ~QCertificateRetriever();
-
- void fetch();
+ void ConstructL();
+ CSymbianCertificateRetriever();
+ static TInt ThreadEntryPoint(TAny* aParams);
+ void doThreadEntryL();
+ void GetCertificateL();
+ void DoCancel();
+ void RunL();
+ TInt RunError(TInt aError);
private:
- virtual void RunL();
- virtual void DoCancel();
-
- void run();
- void list();
- void retrieveNextCertificate();
-
enum {
Initializing,
Listing,
RetrievingCertificates
- } state;
-
- CUnifiedCertStore* certStore;
- RMPointerArray<CCTCertInfo> certs;
- CCertAttributeFilter* certFilter;
- QCertificateConsumer* consumer;
- int currentCertificateIndex;
- QByteArray currentCertificate;
- TPtr8 certDescriptor;
+ } iState;
+
+ RThread iThread;
+ CUnifiedCertStore* iCertStore;
+ RMPointerArray<CCTCertInfo> iCertInfos;
+ CCertAttributeFilter* iCertFilter;
+ TInt iCurrentCertIndex;
+ QByteArray iCertificateData;
+ QList<QByteArray>* iCertificates;
+ TInt iSequenceError;
};
+
#endif