diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-18 15:01:14 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-18 15:27:58 (GMT) |
commit | 102f415e39772086e9066f2e9954c0c22725a23e (patch) | |
tree | e5b3a42fb2bebf48a783543ebf8737eeee41a4b8 /src | |
parent | 74a3dc292d3e48e74836fb953fe793b65e652c54 (diff) | |
download | Qt-102f415e39772086e9066f2e9954c0c22725a23e.zip Qt-102f415e39772086e9066f2e9954c0c22725a23e.tar.gz Qt-102f415e39772086e9066f2e9954c0c22725a23e.tar.bz2 |
Fix QSslCertificate issues
Thank you Matthew Cattell for the fix!
Task-number: QTBUG-6466
Reviewed-by: joao
Diffstat (limited to 'src')
-rw-r--r-- | src/network/ssl/qsslcertificate.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index dd50c38..8993e72 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -304,6 +304,7 @@ static QString _q_SubjectInfoToString(QSslCertificate::SubjectInfo info) */ QString QSslCertificate::issuerInfo(SubjectInfo info) const { + // lazy init if (d->issuerInfo.isEmpty() && d->x509) d->issuerInfo = _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); @@ -320,7 +321,11 @@ QString QSslCertificate::issuerInfo(SubjectInfo info) const */ QString QSslCertificate::issuerInfo(const QByteArray &tag) const { - // ### Use a QByteArray for the keys in the map + // lazy init + if (d->issuerInfo.isEmpty() && d->x509) + d->issuerInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_issuer_name(d->x509), 0, 0)); + return d->issuerInfo.value(QString::fromLatin1(tag)); } @@ -335,6 +340,7 @@ QString QSslCertificate::issuerInfo(const QByteArray &tag) const */ QString QSslCertificate::subjectInfo(SubjectInfo info) const { + // lazy init if (d->subjectInfo.isEmpty() && d->x509) d->subjectInfo = _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); @@ -350,7 +356,11 @@ QString QSslCertificate::subjectInfo(SubjectInfo info) const */ QString QSslCertificate::subjectInfo(const QByteArray &tag) const { - // ### Use a QByteArray for the keys in the map + // lazy init + if (d->subjectInfo.isEmpty() && d->x509) + d->subjectInfo = + _q_mapFromOnelineName(q_X509_NAME_oneline(q_X509_get_subject_name(d->x509), 0, 0)); + return d->subjectInfo.value(QString::fromLatin1(tag)); } |