Skip to content

Commit

Permalink
OutgoingClient: Fix ssl connection/setting invalid ssl config
Browse files Browse the repository at this point in the history
Constructing a `QSslConfiguration()` result in a null/empty
configuration. The fact that it worked with Qt 5 is pure luck, ie Qt bug.
The bug eventually get fixed in Qt 6 but not backported which lead to
this needed fix. We need to init from the default configuration else we
have no certificates filled.
  • Loading branch information
pasnox authored and lnjX committed Jan 23, 2025
1 parent 6a104ed commit e961331
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/client/QXmppOutgoingClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,16 @@ void QXmppOutgoingClientPrivate::connectToHost(const QString &host, quint16 port
{
q->info(QString("Connecting to %1:%2").arg(host, QString::number(port)));

auto sslConfig = QSslConfiguration::defaultConfiguration();

// override CA certificates if requested
if (!config.caCertificates().isEmpty()) {
QSslConfiguration newSslConfig;
newSslConfig.setCaCertificates(config.caCertificates());
q->socket()->setSslConfiguration(newSslConfig);
sslConfig.setCaCertificates(config.caCertificates());
}

// set new ssl config
q->socket()->setSslConfiguration(sslConfig);

// respect proxy
q->socket()->setProxy(config.networkProxy());

Expand Down

0 comments on commit e961331

Please sign in to comment.