From 934afb5c57fce6d28ce0d7ae8ac1450e8d833b17 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Fri, 8 Feb 2013 10:09:09 +0200 Subject: Fix loading of SSL certificate of DER files. DER certificates should not be opened as text files, so we only pass the QIODevice::Text flag when the format is QSsl::Pem. Change-Id: I4bad98023c397b967d5beeec0aaa6c414e06fd9c Reviewed-by: Richard J. Moore --- src/network/ssl/qsslcertificate.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index db20f5618b..8b5be7ae00 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -876,8 +876,11 @@ QList QSslCertificate::fromPath(const QString &path, // Check if the path is a file. if (QFileInfo(sourcePath).isFile()) { QFile file(sourcePath); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - return QSslCertificate::fromData(file.readAll(),format); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + return QSslCertificate::fromData(file.readAll(), format); return QList(); } } @@ -899,8 +902,11 @@ QList QSslCertificate::fromPath(const QString &path, continue; QFile file(filePath); - if (file.open(QIODevice::ReadOnly | QIODevice::Text)) - certs += QSslCertificate::fromData(file.readAll(),format); + QIODevice::OpenMode openMode = QIODevice::ReadOnly; + if (format == QSsl::Pem) + openMode |= QIODevice::Text; + if (file.open(openMode)) + certs += QSslCertificate::fromData(file.readAll(), format); } return certs; } -- cgit v1.2.3 From 7f15506548e82e85560a9b6a57bfdb372883c367 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 5 Feb 2013 19:22:11 +0100 Subject: Remove Nokia from ssl linking exception. Change-Id: I559d4dd8789a249af855f6fe9bfe013ba1d77132 Reviewed-by: Richard J. Moore Reviewed-by: Lars Knoll --- src/network/ssl/qsslconfiguration.h | 8 ++++---- src/network/ssl/qsslconfiguration_p.h | 8 ++++---- src/network/ssl/qsslsocket_openssl.cpp | 15 +++++++++++++++ src/network/ssl/qsslsocket_openssl_p.h | 14 ++++++++++++++ src/network/ssl/qsslsocket_openssl_symbols.cpp | 14 ++++++++++++++ src/network/ssl/qsslsocket_openssl_symbols_p.h | 14 ++++++++++++++ 6 files changed, 65 insertions(+), 8 deletions(-) (limited to 'src/network/ssl') diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h index 701dc4cfe1..ae6e225ce5 100644 --- a/src/network/ssl/qsslconfiguration.h +++ b/src/network/ssl/qsslconfiguration.h @@ -41,10 +41,10 @@ /**************************************************************************** ** -** In addition, as a special exception, Nokia gives permission to link -** the code of its release of Qt with the OpenSSL project's "OpenSSL" library -** (or modified versions of the "OpenSSL" library that use the same license -** as the original version), and distribute the linked executables. +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. ** ** You must comply with the GNU General Public License version 2 in all ** respects for all of the code used other than the "OpenSSL" code. If you diff --git a/src/network/ssl/qsslconfiguration_p.h b/src/network/ssl/qsslconfiguration_p.h index 3e6e43361d..30f1ed66f9 100644 --- a/src/network/ssl/qsslconfiguration_p.h +++ b/src/network/ssl/qsslconfiguration_p.h @@ -41,10 +41,10 @@ /**************************************************************************** ** -** In addition, as a special exception, Nokia gives permission to link -** the code of its release of Qt with the OpenSSL project's "OpenSSL" library -** (or modified versions of the "OpenSSL" library that use the same license -** as the original version), and distribute the linked executables. +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. ** ** You must comply with the GNU General Public License version 2 in all ** respects for all of the code used other than the "OpenSSL" code. If you diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index fd5e12fec3..f846bf2d8b 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -39,6 +39,21 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ + //#define QSSLSOCKET_DEBUG #include "qsslsocket_openssl_p.h" diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h index 9acdcbd1c5..d6675197b4 100644 --- a/src/network/ssl/qsslsocket_openssl_p.h +++ b/src/network/ssl/qsslsocket_openssl_p.h @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #ifndef QSSLSOCKET_OPENSSL_P_H #define QSSLSOCKET_OPENSSL_P_H diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 5829170320..9f271f863a 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #include "qsslsocket_openssl_symbols_p.h" diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index 782725407e..ccd9d3cfb9 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -39,6 +39,20 @@ ** ****************************************************************************/ +/**************************************************************************** +** +** In addition, as a special exception, the copyright holders listed above give +** permission to link the code of its release of Qt with the OpenSSL project's +** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the +** same license as the original version), and distribute the linked executables. +** +** You must comply with the GNU General Public License version 2 in all +** respects for all of the code used other than the "OpenSSL" code. If you +** modify this file, you may extend this exception to your version of the file, +** but you are not obligated to do so. If you do not wish to do so, delete +** this exception statement from your version of this file. +** +****************************************************************************/ #ifndef QSSLSOCKET_OPENSSL_SYMBOLS_P_H #define QSSLSOCKET_OPENSSL_SYMBOLS_P_H -- cgit v1.2.3