From 63bf0029aa98735cd1e8c8b31c9cbe0915f6e5e4 Mon Sep 17 00:00:00 2001 From: woogerboy21 Date: Fri, 15 Jul 2016 21:14:39 -0400 Subject: [PATCH] Updated client id generation to use host ip rather than name --- cockatrice/src/remoteclient.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/remoteclient.cpp b/cockatrice/src/remoteclient.cpp index 59b8e73b..cd664d36 100644 --- a/cockatrice/src/remoteclient.cpp +++ b/cockatrice/src/remoteclient.cpp @@ -1,7 +1,10 @@ +#include #include #include #include #include +#include +#include #include "remoteclient.h" #include "settingscache.h" #include "pending_command.h" @@ -365,7 +368,15 @@ void RemoteClient::disconnectFromServer() QString RemoteClient::getSrvClientID(const QString _hostname) { QString srvClientID = settingsCache->getClientID(); - srvClientID += _hostname; + QHostInfo hostInfo = QHostInfo::fromName(_hostname); + if (!hostInfo.error()) { + QHostAddress hostAddress = hostInfo.addresses().first(); + srvClientID += hostAddress.toString(); + } + else { + qDebug() << "Warning: ClientID generation host lookup failure [" << hostInfo.errorString() << "]"; + srvClientID += _hostname; + } QString uniqueServerClientID = QCryptographicHash::hash(srvClientID.toUtf8(), QCryptographicHash::Sha1).toHex().right(15); return uniqueServerClientID; } \ No newline at end of file