Fixed issues with LoginServer

This commit is contained in:
seefo
2018-01-15 20:47:19 -05:00
parent fcdad8ed44
commit d760a794dd
2 changed files with 31 additions and 31 deletions

View File

@@ -215,39 +215,39 @@ void ClientConnection::validateClient(const std::string & id, const std::string
{
LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
}
CURL *curl;
CURLcode res;
std::string readBuffer;
curl = curl_easy_init();
if (curl)
else
{
std::string username(curl_easy_escape(curl, id.c_str(), id.length()));
std::string password(curl_easy_escape(curl, key.c_str(), key.length()));
CURL *curl;
CURLcode res;
std::string readBuffer;
curl_easy_setopt(curl, CURLOPT_URL, ("phpauthurl" + username + "&pw=" + password).c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (ConfigLoginServer::getAuthentication() == true)
{
curl = curl_easy_init();
if (curl)
{
std::string username(curl_easy_escape(curl, id.c_str(), id.length()));
std::string password(curl_easy_escape(curl, key.c_str(), key.length()));
if(readBuffer == "1")
{
LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
}
else if(readBuffer == "2")
{
ErrorMessage err("Login Failed", "Banned");
this->send(err, true);
}
else
{
ErrorMessage err("Login Failed", "Invalid Username or Password");
this->send(err, true);
}
}
curl_easy_setopt(curl, CURLOPT_URL, ("http://google.com/" + username + "&pw=" + password).c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if(readBuffer == "1")
{
LoginServer::getInstance().onValidateClient(suid, id, this, true, NULL, 0xFFFFFFFF, 0xFFFFFFFF);
}
else if(readBuffer == "2")
{
ErrorMessage err("Login Failed", "Banned");
this->send(err, true);
}
else
{
ErrorMessage err("Login Failed", "Invalid Username or Password");
this->send(err, true);
}
}
}
}
}

View File

@@ -1566,7 +1566,7 @@ void LoginServer::sendClusterStatus(ClientConnection &conn) const
// size_t connectionServerChoice = Random::random(cle->m_connectionServers.size() - 1); //lint !e713 !e732 // loss of precision (arg no 1)
ConnectionServerEntry &connServer = cle->m_connectionServers[0];
item.m_connectionServerAddress = connServer.clientServiceAddress;
item.m_connectionServerAddress = cle->m_address;
if(clientIsPrivate)
{
item.m_connectionServerPort = connServer.clientServicePortPrivate;