diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-26 18:49:31 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-07-26 18:49:31 -0700 |
commit | 7b56020d66d18145256752f9c8d66a20d02f960c (patch) | |
tree | a343ad04e7d843da5b2b39048d43ec9433d79efa /indra | |
parent | 0254b74abfeadb1dea8b37435288512887baff0d (diff) |
ACME-755 Clear FB cookies by removing cookies from the .facebook.com domain
Diffstat (limited to 'indra')
-rwxr-xr-x | indra/llplugin/llplugincookiestore.cpp | 26 | ||||
-rwxr-xr-x | indra/llplugin/llplugincookiestore.h | 3 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 5 |
3 files changed, 32 insertions, 2 deletions
diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp index 82017ab3fa..9ccd3a655b 100755 --- a/indra/llplugin/llplugincookiestore.cpp +++ b/indra/llplugin/llplugincookiestore.cpp @@ -87,6 +87,16 @@ std::string LLPluginCookieStore::Cookie::getKey() const return result; } +std::string LLPluginCookieStore::Cookie::getDomain() const +{ + std::string result; + if(mDomainEnd > mDomainStart) + { + result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart); + } + return result; +} + bool LLPluginCookieStore::Cookie::parse(const std::string &host) { bool first_field = true; @@ -662,3 +672,19 @@ void LLPluginCookieStore::removeCookie(const std::string &key) } } +void LLPluginCookieStore::removeCookiesByDomain(const std::string &domain) +{ + cookie_map_t::iterator iter = mCookies.begin(); + while(iter != mCookies.end()) + { + if(iter->second->getDomain() == domain) + { + delete iter->second; + iter = mCookies.erase(iter); + } + else + { + ++iter; + } + } +} diff --git a/indra/llplugin/llplugincookiestore.h b/indra/llplugin/llplugincookiestore.h index 91289d38a5..a2fdeab647 100755 --- a/indra/llplugin/llplugincookiestore.h +++ b/indra/llplugin/llplugincookiestore.h @@ -67,6 +67,8 @@ public: // quote or unquote a string as per the definition of 'quoted-string' in rfc2616 static std::string quoteString(const std::string &s); static std::string unquoteString(const std::string &s); + + void removeCookiesByDomain(const std::string &domain); private: @@ -79,6 +81,7 @@ private: // Construct a string from the cookie that uniquely represents it, to be used as a key in a std::map. std::string getKey() const; + std::string getDomain() const; const std::string &getCookie() const { return mCookie; }; bool isSessionCookie() const { return mDate.isNull(); }; diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 129934ae16..8ca5043a35 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -39,6 +39,7 @@ #include "llresmgr.h" // LLLocale #include "llsdserialize.h" #include "llloadingindicator.h" +#include "llplugincookiestore.h" #include "llslurl.h" #include "lltrans.h" #include "llsnapshotlivepreview.h" @@ -759,8 +760,8 @@ void LLSocialAccountPanel::onConnect() { LLFacebookConnect::instance().checkConnectionToFacebook(true); - //Clears browser cookies so that the user must enter their FB creds when connecting/re-connecting - LLViewerMedia::clearAllCookies(); + //Clear only the facebook browser cookies so that the facebook login screen appears + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); } void LLSocialAccountPanel::onDisconnect() |