From 0a9d76228f2a8de70fb813d01d86e7669429c137 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Mon, 5 Mar 2012 03:35:18 +1000 Subject: Fixes http://redmine.kokuaviewer.org/issues/1124 and makes sure there are no other ways to side step the SecondLife grid checks. --- linden/indra/newview/hippogridmanager.cpp | 21 ++++++++++++++++++++- linden/indra/newview/hippogridmanager.h | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'linden/indra') diff --git a/linden/indra/newview/hippogridmanager.cpp b/linden/indra/newview/hippogridmanager.cpp index 4c46d3e..1dfb9ac 100644 --- a/linden/indra/newview/hippogridmanager.cpp +++ b/linden/indra/newview/hippogridmanager.cpp @@ -51,7 +51,7 @@ #include "llxorcipher.h" // saved password, MAC address #include "hipporestrequest.h" - +#include // ******************************************************************** // Global Variables @@ -101,9 +101,27 @@ HippoGridInfo::HippoGridInfo(const std::string& gridNick) : mGridNick = sanitizeGridNick(nick); } +// Check if this really is a SecondLife grid, to prevent cheating. +void HippoGridInfo::checkLoginURIforSecondLifeness() +{ + LLURI loginURI(mLoginURI); + std::string host = loginURI.hostName(); + size_t found; + + boost::algorithm::to_lower(host); + + found = host.rfind("lindenlab.com"); + if ((found + 13) == host.size()) + mPlatform = PLATFORM_SECONDLIFE; + found = host.rfind("secondlife.com"); + if ((found + 14) == host.size()) + mPlatform = PLATFORM_SECONDLIFE; +} + void HippoGridInfo::setPlatform(Platform platform) { mPlatform = platform; + checkLoginURIforSecondLifeness(); if (mPlatform == PLATFORM_SECONDLIFE) { mCurrencySymbol = "L$"; @@ -136,6 +154,7 @@ void HippoGridInfo::setLoginURI(const std::string& loginURI) { std::string uri = loginURI; mLoginURI = sanitizeURI(uri); + checkLoginURIforSecondLifeness(); } void HippoGridInfo::setHelperURI(const std::string& helperURI) diff --git a/linden/indra/newview/hippogridmanager.h b/linden/indra/newview/hippogridmanager.h index c983c9d..8e77f99 100644 --- a/linden/indra/newview/hippogridmanager.h +++ b/linden/indra/newview/hippogridmanager.h @@ -165,6 +165,8 @@ private: }; XmlState mXmlState; + void checkLoginURIforSecondLifeness(); + static std::string sanitizeURI(std::string &uri); void formatFee(std::string &fee, S32 cost, bool showFree) const; -- cgit v1.1