From 4598f7042cd7c58c06e49c1841938ab82c70b503 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Wed, 14 Sep 2016 00:46:07 +0200 Subject: [PATCH] Remove CoreInfo from the ClientRegistered handshake message This string was only used by pre-0.5 clients, and even then only for displaying information on the connection dialog during the handshake phase, so it is safe to remove. This prevents the core from leaking information about itself before a successful login. (cherry picked from commit 3856cfd6126cdea97c91a22be7ded92ccc0a3577) --- src/common/protocol.h | 4 +--- src/common/protocols/datastream/datastreampeer.cpp | 2 +- src/common/protocols/legacy/legacypeer.cpp | 6 +++--- src/core/coreauthhandler.cpp | 14 ++------------ 4 files changed, 7 insertions(+), 19 deletions(-) diff --git a/src/common/protocol.h b/src/common/protocol.h index ba705303..4bff50ae 100644 --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -81,12 +81,11 @@ struct ClientDenied : public HandshakeMessage struct ClientRegistered : public HandshakeMessage { - inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported, const QString &coreInfo) + inline ClientRegistered(quint32 coreFeatures, bool coreConfigured, const QVariantList &backendInfo, bool sslSupported) : coreFeatures(coreFeatures) , coreConfigured(coreConfigured) , backendInfo(backendInfo) , sslSupported(sslSupported) - , coreInfo(coreInfo) {} quint32 coreFeatures; @@ -95,7 +94,6 @@ struct ClientRegistered : public HandshakeMessage // this is only used by the LegacyProtocol in compat mode bool sslSupported; - QString coreInfo; }; diff --git a/src/common/protocols/datastream/datastreampeer.cpp b/src/common/protocols/datastream/datastreampeer.cpp index d3bd1109..763679f7 100644 --- a/src/common/protocols/datastream/datastreampeer.cpp +++ b/src/common/protocols/datastream/datastreampeer.cpp @@ -124,7 +124,7 @@ void DataStreamPeer::handleHandshakeMessage(const QVariantList &mapData) } else if (msgType == "ClientInitAck") { - handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), false, QString())); // SupportsSsl and coreInfo obsolete + handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), false)); // SupportsSsl is obsolete } else if (msgType == "CoreSetupData") { diff --git a/src/common/protocols/legacy/legacypeer.cpp b/src/common/protocols/legacy/legacypeer.cpp index 6c4a7161..5283ecd1 100644 --- a/src/common/protocols/legacy/legacypeer.cpp +++ b/src/common/protocols/legacy/legacypeer.cpp @@ -170,7 +170,7 @@ void LegacyPeer::handleHandshakeMessage(const QVariant &msg) socket()->setProperty("UseCompression", true); #endif - handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool(), QString())); + handle(ClientRegistered(m["CoreFeatures"].toUInt(), m["Configured"].toBool(), m["StorageBackends"].toList(), m["SupportSsl"].toBool())); } else if (msgType == "CoreSetupData") { @@ -248,8 +248,8 @@ void LegacyPeer::dispatch(const ClientRegistered &msg) { m["SupportSsl"] = msg.sslSupported; m["SupportsCompression"] = socket()->property("UseCompression").toBool(); // this property gets already set in the ClientInit handler - // This is only used for old v10 clients (pre-0.5) - m["CoreInfo"] = msg.coreInfo; + // This is only used for display by really old v10 clients (pre-0.5), and we no longer set this + m["CoreInfo"] = QString(); m["LoginEnabled"] = m["Configured"] = msg.coreConfigured; diff --git a/src/core/coreauthhandler.cpp b/src/core/coreauthhandler.cpp index d4993010..a66a8e96 100644 --- a/src/core/coreauthhandler.cpp +++ b/src/core/coreauthhandler.cpp @@ -176,18 +176,8 @@ void CoreAuthHandler::handle(const RegisterClient &msg) if (!configured) backends = Core::backendInfo(); - int uptime = Core::instance()->startTime().secsTo(QDateTime::currentDateTime().toUTC()); - int updays = uptime / 86400; uptime %= 86400; - int uphours = uptime / 3600; uptime %= 3600; - int upmins = uptime / 60; - QString coreInfo = tr("Quassel Core Version %1
" - "Version date: %2
" - "Up %3d%4h%5m (since %6)").arg(Quassel::buildInfo().fancyVersionString) - .arg(Quassel::buildInfo().commitDate) - .arg(updays).arg(uphours, 2, 10, QChar('0')).arg(upmins, 2, 10, QChar('0')).arg(Core::instance()->startTime().toString(Qt::TextDate)); - - // useSsl and coreInfo are only used for the legacy protocol - _peer->dispatch(ClientRegistered(Quassel::features(), configured, backends, useSsl, coreInfo)); + // useSsl is only used for the legacy protocol + _peer->dispatch(ClientRegistered(Quassel::features(), configured, backends, useSsl)); if (_legacy && useSsl) startSsl(); -- 2.20.1