From c8c143e7741d2b93b589d770b64c265228293564 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Thu, 18 Aug 2016 13:05:30 -0700 Subject: SL-323: first pass at ripping out old updater --- indra/newview/lllogininstance.cpp | 568 +------------------------------------- 1 file changed, 3 insertions(+), 565 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b4d0bb6823..b9e9c12aec 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -50,13 +50,12 @@ #include "llwindow.h" #include "llviewerwindow.h" #include "llprogressview.h" -#if LL_LINUX || LL_SOLARIS +#if LL_LINUX #include "lltrans.h" #endif #include "llsecapi.h" #include "llstartup.h" #include "llmachineid.h" -#include "llupdaterservice.h" #include "llevents.h" #include "llappviewer.h" @@ -68,406 +67,11 @@ public: virtual ~Disposable() {} }; -namespace { - class MandatoryUpdateMachine: - public LLLoginInstance::Disposable - { - public: - MandatoryUpdateMachine(LLLoginInstance & loginInstance, LLUpdaterService & updaterService); - - void start(void); - - LLNotificationsInterface& getNotificationsInterface() const - { - return mLoginInstance.getNotificationsInterface(); - } - - private: - class State; - class CheckingForUpdate; - class Error; - class ReadyToInstall; - class StartingUpdaterService; - class WaitingForDownload; - - boost::scoped_ptr mState; - LLLoginInstance & mLoginInstance; - LLUpdaterService & mUpdaterService; - - void setCurrentState(State * newState); - }; - - - class MandatoryUpdateMachine::State { - public: - virtual ~State() {} - virtual void enter(void) {} - virtual void exit(void) {} - }; - - - class MandatoryUpdateMachine::CheckingForUpdate: - public MandatoryUpdateMachine::State - { - public: - CheckingForUpdate(MandatoryUpdateMachine & machine); - - virtual void enter(void); - virtual void exit(void); - - private: - LLTempBoundListener mConnection; - MandatoryUpdateMachine & mMachine; - LLProgressView * mProgressView; - - bool onEvent(LLSD const & event); - }; - - - class MandatoryUpdateMachine::Error: - public MandatoryUpdateMachine::State - { - public: - Error(MandatoryUpdateMachine & machine); - - virtual void enter(void); - virtual void exit(void); - void onButtonClicked(const LLSD &, const LLSD &); - - private: - MandatoryUpdateMachine & mMachine; - }; - - - class MandatoryUpdateMachine::ReadyToInstall: - public MandatoryUpdateMachine::State - { - public: - ReadyToInstall(MandatoryUpdateMachine & machine); - - virtual void enter(void); - virtual void exit(void); - - private: - //MandatoryUpdateMachine & mMachine; - }; - - - class MandatoryUpdateMachine::StartingUpdaterService: - public MandatoryUpdateMachine::State - { - public: - StartingUpdaterService(MandatoryUpdateMachine & machine); - - virtual void enter(void); - virtual void exit(void); - void onButtonClicked(const LLSD & uiform, const LLSD & result); - private: - MandatoryUpdateMachine & mMachine; - }; - - - class MandatoryUpdateMachine::WaitingForDownload: - public MandatoryUpdateMachine::State - { - public: - WaitingForDownload(MandatoryUpdateMachine & machine); - - virtual void enter(void); - virtual void exit(void); - - private: - LLTempBoundListener mConnection; - MandatoryUpdateMachine & mMachine; - LLProgressView * mProgressView; - - bool onEvent(LLSD const & event); - }; -} - static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback"; static const char * const TOS_LISTENER_NAME = "lllogininstance_tos"; std::string construct_start_string(); - - -// MandatoryUpdateMachine -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::MandatoryUpdateMachine(LLLoginInstance & loginInstance, LLUpdaterService & updaterService): - mLoginInstance(loginInstance), - mUpdaterService(updaterService) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::start(void) -{ - LL_INFOS() << "starting mandatory update machine" << LL_ENDL; - - if(mUpdaterService.isChecking()) { - switch(mUpdaterService.getState()) { - case LLUpdaterService::UP_TO_DATE: - mUpdaterService.stopChecking(); - mUpdaterService.startChecking(); - // Fall through. - case LLUpdaterService::INITIAL: - case LLUpdaterService::CHECKING_FOR_UPDATE: - setCurrentState(new CheckingForUpdate(*this)); - break; - case LLUpdaterService::TEMPORARY_ERROR: - setCurrentState(new Error(*this)); - break; - case LLUpdaterService::DOWNLOADING: - setCurrentState(new WaitingForDownload(*this)); - break; - case LLUpdaterService::TERMINAL: - if(LLUpdaterService::updateReadyToInstall()) { - setCurrentState(new ReadyToInstall(*this)); - } else { - setCurrentState(new Error(*this)); - } - break; - case LLUpdaterService::FAILURE: - setCurrentState(new Error(*this)); - break; - default: - llassert(!"unpossible case"); - break; - } - } else { - setCurrentState(new StartingUpdaterService(*this)); - } -} - - -void MandatoryUpdateMachine::setCurrentState(State * newStatePointer) -{ - { - boost::scoped_ptr newState(newStatePointer); - if(mState != 0) mState->exit(); - mState.swap(newState); - - // Old state will be deleted on exit from this block before the new state - // is entered. - } - if(mState != 0) mState->enter(); -} - - - -// MandatoryUpdateMachine::CheckingForUpdate -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::CheckingForUpdate::CheckingForUpdate(MandatoryUpdateMachine & machine): - mMachine(machine) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::CheckingForUpdate::enter(void) -{ - LL_INFOS() << "entering checking for update" << LL_ENDL; - - mProgressView = gViewerWindow->getProgressView(); - mProgressView->setMessage("Looking for update..."); - mProgressView->setText("There is a required update for your Second Life installation."); - mProgressView->setPercent(0); - mProgressView->setVisible(true); - mConnection = LLEventPumps::instance().obtain(LLUpdaterService::pumpName()). - listen("MandatoryUpdateMachine::CheckingForUpdate", boost::bind(&MandatoryUpdateMachine::CheckingForUpdate::onEvent, this, _1)); -} - - -void MandatoryUpdateMachine::CheckingForUpdate::exit(void) -{ -} - - -bool MandatoryUpdateMachine::CheckingForUpdate::onEvent(LLSD const & event) -{ - if(event["type"].asInteger() == LLUpdaterService::STATE_CHANGE) { - switch(event["state"].asInteger()) { - case LLUpdaterService::DOWNLOADING: - mMachine.setCurrentState(new WaitingForDownload(mMachine)); - break; - case LLUpdaterService::TEMPORARY_ERROR: - case LLUpdaterService::UP_TO_DATE: - case LLUpdaterService::TERMINAL: - case LLUpdaterService::FAILURE: - mProgressView->setVisible(false); - mMachine.setCurrentState(new Error(mMachine)); - break; - case LLUpdaterService::INSTALLING: - llassert(!"can't possibly be installing"); - break; - default: - break; - } - } else { - ; // Ignore. - } - - return false; -} - - - -// MandatoryUpdateMachine::Error -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::Error::Error(MandatoryUpdateMachine & machine): - mMachine(machine) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::Error::enter(void) -{ - LL_INFOS() << "entering error" << LL_ENDL; - mMachine.getNotificationsInterface().add("FailedRequiredUpdateInstall", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::Error::onButtonClicked, this, _1, _2)); -} - - -void MandatoryUpdateMachine::Error::exit(void) -{ - LLAppViewer::instance()->forceQuit(); -} - - -void MandatoryUpdateMachine::Error::onButtonClicked(const LLSD &, const LLSD &) -{ - mMachine.setCurrentState(0); -} - - - -// MandatoryUpdateMachine::ReadyToInstall -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::ReadyToInstall::ReadyToInstall(MandatoryUpdateMachine & machine) //: - //mMachine(machine) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::ReadyToInstall::enter(void) -{ - LL_INFOS() << "entering ready to install" << LL_ENDL; - // Open update ready dialog. -} - - -void MandatoryUpdateMachine::ReadyToInstall::exit(void) -{ - // Restart viewer. -} - - - -// MandatoryUpdateMachine::StartingUpdaterService -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::StartingUpdaterService::StartingUpdaterService(MandatoryUpdateMachine & machine): - mMachine(machine) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::StartingUpdaterService::enter(void) -{ - LL_INFOS() << "entering start update service" << LL_ENDL; - mMachine.getNotificationsInterface().add("UpdaterServiceNotRunning", LLSD(), LLSD(), boost::bind(&MandatoryUpdateMachine::StartingUpdaterService::onButtonClicked, this, _1, _2)); -} - - -void MandatoryUpdateMachine::StartingUpdaterService::exit(void) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::StartingUpdaterService::onButtonClicked(const LLSD & uiform, const LLSD & result) -{ - if(result["OK_okcancelbuttons"].asBoolean()) { - mMachine.mUpdaterService.startChecking(false); - mMachine.setCurrentState(new CheckingForUpdate(mMachine)); - } else { - LLAppViewer::instance()->forceQuit(); - } -} - - - -// MandatoryUpdateMachine::WaitingForDownload -//----------------------------------------------------------------------------- - - -MandatoryUpdateMachine::WaitingForDownload::WaitingForDownload(MandatoryUpdateMachine & machine): - mMachine(machine), - mProgressView(0) -{ - ; // No op. -} - - -void MandatoryUpdateMachine::WaitingForDownload::enter(void) -{ - LL_INFOS() << "entering waiting for download" << LL_ENDL; - mProgressView = gViewerWindow->getProgressView(); - mProgressView->setMessage("Downloading update..."); - std::ostringstream stream; - stream << "There is a required update for your Second Life installation." << std::endl << - "Version " << mMachine.mUpdaterService.updatedVersion(); - mProgressView->setText(stream.str()); - mProgressView->setPercent(0); - mProgressView->setVisible(true); - mConnection = LLEventPumps::instance().obtain(LLUpdaterService::pumpName()). - listen("MandatoryUpdateMachine::CheckingForUpdate", boost::bind(&MandatoryUpdateMachine::WaitingForDownload::onEvent, this, _1)); -} - - -void MandatoryUpdateMachine::WaitingForDownload::exit(void) -{ - mProgressView->setVisible(false); -} - - -bool MandatoryUpdateMachine::WaitingForDownload::onEvent(LLSD const & event) -{ - switch(event["type"].asInteger()) { - case LLUpdaterService::DOWNLOAD_COMPLETE: - mMachine.setCurrentState(new ReadyToInstall(mMachine)); - break; - case LLUpdaterService::DOWNLOAD_ERROR: - mMachine.setCurrentState(new Error(mMachine)); - break; - case LLUpdaterService::PROGRESS: { - double downloadSize = event["download_size"].asReal(); - double bytesDownloaded = event["bytes_downloaded"].asReal(); - mProgressView->setPercent(100. * bytesDownloaded / downloadSize); - break; - } - default: - break; - } - - return false; -} - - - // LLLoginInstance //----------------------------------------------------------------------------- @@ -476,11 +80,9 @@ LLLoginInstance::LLLoginInstance() : mLoginModule(new LLLogin()), mNotifications(NULL), mLoginState("offline"), - mSkipOptionalUpdate(false), mAttemptComplete(false), mTransferRate(0.0f), - mDispatcher("LLLoginInstance", "change"), - mUpdaterService(0) + mDispatcher("LLLoginInstance", "change") { mLoginModule->getEventPump().listen("lllogininstance", boost::bind(&LLLoginInstance::handleLoginEvent, this, _1)); @@ -590,18 +192,11 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia // (re)initialize the request params with creds. LLSD request_params = user_credential->getLoginParams(); - unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE]; - if ( ! llHashedUniqueID(hashed_unique_id_string) ) - { - LL_WARNS() << "Not providing a unique id in request params" << LL_ENDL; - } request_params["start"] = construct_start_string(); - request_params["skipoptional"] = mSkipOptionalUpdate; request_params["agree_to_tos"] = false; // Always false here. Set true in request_params["read_critical"] = false; // handleTOSResponse request_params["last_exec_event"] = mLastExecEvent; request_params["last_exec_duration"] = mLastExecDuration; - request_params["mac"] = (char*)hashed_unique_id_string; request_params["version"] = LLVersionInfo::getVersion(); request_params["channel"] = LLVersionInfo::getChannel(); request_params["platform"] = mPlatform; @@ -698,19 +293,6 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) boost::bind(&LLLoginInstance::handleTOSResponse, this, _1, "read_critical")); } - else if(reason_response == "update" || gSavedSettings.getBOOL("ForceMandatoryUpdate")) - { - LL_INFOS() << "LLLoginInstance::handleLoginFailure update" << LL_ENDL; - - gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); - updateApp(true, message_response); - } - else if(reason_response == "optional") - { - LL_INFOS() << "LLLoginInstance::handleLoginFailure optional" << LL_ENDL; - - updateApp(false, message_response); - } else { LL_INFOS() << "LLLoginInstance::handleLoginFailure attemptComplete" << LL_ENDL; @@ -722,22 +304,7 @@ void LLLoginInstance::handleLoginSuccess(const LLSD& event) { LL_INFOS() << "LLLoginInstance::handleLoginSuccess" << LL_ENDL; - if(gSavedSettings.getBOOL("ForceMandatoryUpdate")) - { - LLSD response = event["data"]; - std::string message_response = response["message"].asString(); - - // Testing update... - gSavedSettings.setBOOL("ForceMandatoryUpdate", FALSE); - - // Don't confuse startup by leaving login "online". - mLoginModule->disconnect(); - updateApp(true, message_response); - } - else - { - attemptComplete(); - } + attemptComplete(); } void LLLoginInstance::handleDisconnect(const LLSD& event) @@ -787,135 +354,6 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) return true; } - -void LLLoginInstance::updateApp(bool mandatory, const std::string& auth_msg) -{ - if(mandatory) - { - gViewerWindow->setShowProgress(false); - MandatoryUpdateMachine * machine = new MandatoryUpdateMachine(*this, *mUpdaterService); - mUpdateStateMachine.reset(machine); - machine->start(); - return; - } - - // store off config state, as we might quit soon - gSavedSettings.saveToFile(gSavedSettings.getString("ClientSettingsFile"), TRUE); - LLUIColorTable::instance().saveUserSettings(); - - std::ostringstream message; - std::string msg; - if (!auth_msg.empty()) - { - msg = "(" + auth_msg + ") \n"; - } - - LLSD args; - args["MESSAGE"] = msg; - - LLSD payload; - payload["mandatory"] = mandatory; - - /* - * We're constructing one of the following 9 strings here: - * "DownloadWindowsMandatory" - * "DownloadWindowsReleaseForDownload" - * "DownloadWindows" - * "DownloadMacMandatory" - * "DownloadMacReleaseForDownload" - * "DownloadMac" - * "DownloadLinuxMandatory" - * "DownloadLinuxReleaseForDownload" - * "DownloadLinux" - * - * I've called them out explicitly in this comment so that they can be grepped for. - */ - std::string notification_name = "Download"; - -#if LL_WINDOWS - notification_name += "Windows"; -#elif LL_DARWIN - notification_name += "Mac"; -#else - notification_name += "Linux"; -#endif - - if (mandatory) - { - notification_name += "Mandatory"; - } - else - { -#if LL_RELEASE_FOR_DOWNLOAD - notification_name += "ReleaseForDownload"; -#endif - } - - if(mNotifications) - { - mNotifications->add(notification_name, args, payload, - boost::bind(&LLLoginInstance::updateDialogCallback, this, _1, _2)); - - gViewerWindow->setShowProgress(false); - } -} - -bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotification::getSelectedOption(notification, response); - std::string update_exe_path; - bool mandatory = notification["payload"]["mandatory"].asBoolean(); - -#if !LL_RELEASE_FOR_DOWNLOAD - if (option == 2) - { - // This condition attempts to skip the - // update if using a dev build. - // The relog probably won't work if the - // update is mandatory. :) - - // *REMOVE:Mani - Saving for reference... - //LLStartUp::setStartupState( STATE_LOGIN_AUTH_INIT ); - mSkipOptionalUpdate = true; - reconnect(); - return false; - } -#endif - - if (option == 1) - { - // ...user doesn't want to do it - if (mandatory) - { - // Mandatory update, user chose to not to update... - // The login attemp is complete, startup should - // quit when detecting this. - attemptComplete(); - - // *REMOVE:Mani - Saving for reference... - //LLAppViewer::instance()->forceQuit(); - // // Bump them back to the login screen. - // //reset_login(); - } - else - { - // Optional update, user chose to skip - mSkipOptionalUpdate = true; - reconnect(); - } - return false; - } - - if(mUpdaterLauncher) - { - mUpdaterLauncher(); - } - - attemptComplete(); - - return false; -} - std::string construct_start_string() { std::string start; -- cgit v1.2.3 From 01ee14c0fc71e2b84d1f489b9856f87b667ad521 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Fri, 19 Aug 2016 12:12:48 -0700 Subject: SL-323: put back mac addr hash --- indra/newview/lllogininstance.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b9e9c12aec..374efa2986 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -192,11 +192,19 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia // (re)initialize the request params with creds. LLSD request_params = user_credential->getLoginParams(); + unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE]; + if ( ! llHashedUniqueID(hashed_unique_id_string) ) + { + + LL_WARNS() << "Not providing a unique id in request params" << LL_ENDL; + + } request_params["start"] = construct_start_string(); request_params["agree_to_tos"] = false; // Always false here. Set true in request_params["read_critical"] = false; // handleTOSResponse request_params["last_exec_event"] = mLastExecEvent; request_params["last_exec_duration"] = mLastExecDuration; + request_params["mac"] = (char*)hashed_unique_id_string; request_params["version"] = LLVersionInfo::getVersion(); request_params["channel"] = LLVersionInfo::getChannel(); request_params["platform"] = mPlatform; -- cgit v1.2.3 From 7a6a2db289581e43c509ca7dfff7d9b72897a10e Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 21 Apr 2017 15:27:10 -0400 Subject: DRTVWR-418: Send address_size with login and viewer stats. --- indra/newview/lllogininstance.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b4d0bb6823..a49a9ca840 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -606,6 +606,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia request_params["channel"] = LLVersionInfo::getChannel(); request_params["platform"] = mPlatform; request_params["platform_version"] = mPlatformVersion; + request_params["address_size"] = ADDRESS_SIZE; request_params["id0"] = mSerialNumber; request_params["host_id"] = gSavedSettings.getString("HostID"); request_params["extended_errors"] = true; // request message_id and message_args -- cgit v1.2.3 From 612ff7b6b3f3abb56ff6bf8331e2a1cd04c04066 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 14 Aug 2017 07:15:18 -0400 Subject: MAINT-7640: Notify the user if login is blocked for a required viewer update --- indra/newview/lllogininstance.cpp | 41 ++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 229703bb39..b953534e13 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -31,6 +31,7 @@ // llcommon #include "llevents.h" #include "stringize.h" +#include "llsdserialize.h" // llmessage (!) #include "llfiltersd2xmlrpc.h" // for xml_escape_string() @@ -47,12 +48,10 @@ #include "llstartup.h" #include "llfloaterreg.h" #include "llnotifications.h" +#include "llnotificationsutil.h" #include "llwindow.h" #include "llviewerwindow.h" #include "llprogressview.h" -#if LL_LINUX -#include "lltrans.h" -#endif #include "llsecapi.h" #include "llstartup.h" #include "llmachineid.h" @@ -250,8 +249,6 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) void LLLoginInstance::handleLoginFailure(const LLSD& event) { - - // Login has failed. // Figure out why and respond... LLSD response = event["data"]; @@ -302,13 +299,42 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) boost::bind(&LLLoginInstance::handleTOSResponse, this, _1, "read_critical")); } + else if(reason_response == "update") + { + // This shouldn't happen - the viewer manager should have forced an update; + // possibly the user ran the viewer directly and bypassed the update check + std::string required_version = response["message_args"]["VERSION"]; + LL_WARNS() << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; + + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); + + LLSD data(LLSD::emptyMap()); + data["VERSION"] = required_version; + LLNotificationsUtil::add("RequiredUpdate", data, LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); + } + else if(reason_response == "key") + { + // this is a password problem or other restriction + // an appropriate message has already been displayed + attemptComplete(); + } else { - LL_INFOS() << "LLLoginInstance::handleLoginFailure attemptComplete" << LL_ENDL; - attemptComplete(); + LL_WARNS() << "Login failed for an unknown reason: " << LLSDOStreamer(response) << LL_ENDL; + + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); + + LLNotificationsUtil::add("LoginFailedUnknown", LLSD::emptyMap(), LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); } } +void LLLoginInstance::handleLoginDisallowed(const LLSD& notification, const LLSD& response) +{ + attemptComplete(); +} + void LLLoginInstance::handleLoginSuccess(const LLSD& event) { LL_INFOS() << "LLLoginInstance::handleLoginSuccess" << LL_ENDL; @@ -363,6 +389,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) return true; } + std::string construct_start_string() { std::string start; -- cgit v1.2.3 From 4d71ffb430879c3d24d910465ca7afa3fae0b141 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 14 Aug 2017 11:52:41 -0400 Subject: MAINT-7640: code review fixes --- indra/newview/lllogininstance.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b953534e13..30fa23835b 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -299,35 +299,35 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) boost::bind(&LLLoginInstance::handleTOSResponse, this, _1, "read_critical")); } - else if(reason_response == "update") - { + else if(reason_response == "update") + { // This shouldn't happen - the viewer manager should have forced an update; // possibly the user ran the viewer directly and bypassed the update check std::string required_version = response["message_args"]["VERSION"]; - LL_WARNS() << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; + LL_WARNS() << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; - if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); - LLSD data(LLSD::emptyMap()); + LLSD data(LLSD::emptyMap()); data["VERSION"] = required_version; LLNotificationsUtil::add("RequiredUpdate", data, LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); - } - else if(reason_response == "key") - { + } + else if(reason_response == "key") + { // this is a password problem or other restriction // an appropriate message has already been displayed attemptComplete(); } - else - { - LL_WARNS() << "Login failed for an unknown reason: " << LLSDOStreamer(response) << LL_ENDL; + else + { + LL_WARNS() << "Login failed for an unknown reason: " << LLSDOStreamer(response) << LL_ENDL; - if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); LLNotificationsUtil::add("LoginFailedUnknown", LLSD::emptyMap(), LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); - } + } } void LLLoginInstance::handleLoginDisallowed(const LLSD& notification, const LLSD& response) -- cgit v1.2.3 From 4cc6d44ef88196c940e9f7e74243146549a11018 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Mon, 14 Aug 2017 11:55:31 -0400 Subject: fix indenting --- indra/newview/lllogininstance.cpp | 98 +++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 49 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index 30fa23835b..54459342a7 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -249,56 +249,56 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) void LLLoginInstance::handleLoginFailure(const LLSD& event) { - // Login has failed. - // Figure out why and respond... - LLSD response = event["data"]; - std::string reason_response = response["reason"].asString(); - std::string message_response = response["message"].asString(); - // For the cases of critical message or TOS agreement, - // start the TOS dialog. The dialog response will be handled - // by the LLLoginInstance::handleTOSResponse() callback. - // The callback intiates the login attempt next step, either - // to reconnect or to end the attempt in failure. - if(reason_response == "tos") - { - LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL; - - LLSD data(LLSD::emptyMap()); - data["message"] = message_response; - data["reply_pump"] = TOS_REPLY_PUMP; - if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); - LLFloaterReg::showInstance("message_tos", data); - LLEventPumps::instance().obtain(TOS_REPLY_PUMP) - .listen(TOS_LISTENER_NAME, - boost::bind(&LLLoginInstance::handleTOSResponse, - this, _1, "agree_to_tos")); - } - else if(reason_response == "critical") - { - LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL; + // Login has failed. + // Figure out why and respond... + LLSD response = event["data"]; + std::string reason_response = response["reason"].asString(); + std::string message_response = response["message"].asString(); + // For the cases of critical message or TOS agreement, + // start the TOS dialog. The dialog response will be handled + // by the LLLoginInstance::handleTOSResponse() callback. + // The callback intiates the login attempt next step, either + // to reconnect or to end the attempt in failure. + if(reason_response == "tos") + { + LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL; - LLSD data(LLSD::emptyMap()); - data["message"] = message_response; - data["reply_pump"] = TOS_REPLY_PUMP; - if(response.has("error_code")) - { - data["error_code"] = response["error_code"]; - } - if(response.has("certificate")) - { - data["certificate"] = response["certificate"]; - } - - if (gViewerWindow) - gViewerWindow->setShowProgress(FALSE); - - LLFloaterReg::showInstance("message_critical", data); - LLEventPumps::instance().obtain(TOS_REPLY_PUMP) - .listen(TOS_LISTENER_NAME, - boost::bind(&LLLoginInstance::handleTOSResponse, - this, _1, "read_critical")); - } + LLSD data(LLSD::emptyMap()); + data["message"] = message_response; + data["reply_pump"] = TOS_REPLY_PUMP; + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); + LLFloaterReg::showInstance("message_tos", data); + LLEventPumps::instance().obtain(TOS_REPLY_PUMP) + .listen(TOS_LISTENER_NAME, + boost::bind(&LLLoginInstance::handleTOSResponse, + this, _1, "agree_to_tos")); + } + else if(reason_response == "critical") + { + LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL; + + LLSD data(LLSD::emptyMap()); + data["message"] = message_response; + data["reply_pump"] = TOS_REPLY_PUMP; + if(response.has("error_code")) + { + data["error_code"] = response["error_code"]; + } + if(response.has("certificate")) + { + data["certificate"] = response["certificate"]; + } + + if (gViewerWindow) + gViewerWindow->setShowProgress(FALSE); + + LLFloaterReg::showInstance("message_critical", data); + LLEventPumps::instance().obtain(TOS_REPLY_PUMP) + .listen(TOS_LISTENER_NAME, + boost::bind(&LLLoginInstance::handleTOSResponse, + this, _1, "read_critical")); + } else if(reason_response == "update") { // This shouldn't happen - the viewer manager should have forced an update; -- cgit v1.2.3 From 6980f5bcc247bc12fd0672164cc713db2e93198a Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 22 Aug 2017 16:38:15 -0400 Subject: MAINT-7594: add platform name string to login request (and add request parameter logging at DEBUG) --- indra/newview/lllogininstance.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index b4d0bb6823..4eb1909042 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -493,10 +493,12 @@ LLLoginInstance::LLLoginInstance() : } void LLLoginInstance::setPlatformInfo(const std::string platform, - const std::string platform_version) + const std::string platform_version, + const std::string platform_name) { mPlatform = platform; mPlatformVersion = platform_version; + mPlatformVersionName = platform_name; } LLLoginInstance::~LLLoginInstance() @@ -565,7 +567,6 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia requested_options.append("event_notifications"); requested_options.append("classified_categories"); requested_options.append("adult_compliant"); - //requested_options.append("inventory-targets"); requested_options.append("buddy-list"); requested_options.append("newuser-config"); requested_options.append("ui-config"); @@ -587,8 +588,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia requested_options.append("god-connect"); } - // (re)initialize the request params with creds. - LLSD request_params = user_credential->getLoginParams(); + LLSD request_params; unsigned char hashed_unique_id_string[MD5HEX_STR_SIZE]; if ( ! llHashedUniqueID(hashed_unique_id_string) ) @@ -606,10 +606,24 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia request_params["channel"] = LLVersionInfo::getChannel(); request_params["platform"] = mPlatform; request_params["platform_version"] = mPlatformVersion; + request_params["platform_string"] = mPlatformVersionName; request_params["id0"] = mSerialNumber; request_params["host_id"] = gSavedSettings.getString("HostID"); request_params["extended_errors"] = true; // request message_id and message_args + // log request_params _before_ adding the credentials + LL_DEBUGS("LLLogin") << "Login parameters: " << LLSDOStreamer(request_params) << LL_ENDL; + + // Copy the credentials into the request after logging the rest + LLSD credentials(user_credential->getLoginParams()); + for (LLSD::map_const_iterator it = credentials.beginMap(); + it != credentials.endMap(); + it++ + ) + { + request_params[it->first] = it->second; + } + mRequestData.clear(); mRequestData["method"] = "login_to_simulator"; mRequestData["params"] = request_params; -- cgit v1.2.3 From f938ee99d1e2cd729834441c9eb0285992c35896 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 15 Sep 2017 12:03:05 -0400 Subject: additional logging to help with MAINT 7807 --- indra/newview/lllogininstance.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index a92fb047ef..bb55a3a6c0 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -195,7 +195,7 @@ void LLLoginInstance::constructAuthParams(LLPointer user_credentia if ( ! llHashedUniqueID(hashed_unique_id_string) ) { - LL_WARNS() << "Not providing a unique id in request params" << LL_ENDL; + LL_WARNS("LLLogin") << "Not providing a unique id in request params" << LL_ENDL; } request_params["start"] = construct_start_string(); @@ -242,7 +242,7 @@ bool LLLoginInstance::handleLoginEvent(const LLSD& event) if(!(event.has("state") && event.has("change") && event.has("progress"))) { - LL_ERRS() << "Unknown message from LLLogin: " << event << LL_ENDL; + LL_ERRS("LLLogin") << "Unknown message from LLLogin: " << event << LL_ENDL; } mLoginState = event["state"].asString(); @@ -268,6 +268,9 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) LLSD response = event["data"]; std::string reason_response = response["reason"].asString(); std::string message_response = response["message"].asString(); + LL_DEBUGS("LLLogin") << "reason " << reason_response + << " message " << message_response + << LL_ENDL; // For the cases of critical message or TOS agreement, // start the TOS dialog. The dialog response will be handled // by the LLLoginInstance::handleTOSResponse() callback. @@ -275,7 +278,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) // to reconnect or to end the attempt in failure. if(reason_response == "tos") { - LL_INFOS() << "LLLoginInstance::handleLoginFailure ToS" << LL_ENDL; + LL_INFOS("LLLogin") << " ToS" << LL_ENDL; LLSD data(LLSD::emptyMap()); data["message"] = message_response; @@ -290,7 +293,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else if(reason_response == "critical") { - LL_INFOS() << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleLoginFailure Crit" << LL_ENDL; LLSD data(LLSD::emptyMap()); data["message"] = message_response; @@ -318,7 +321,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) // This shouldn't happen - the viewer manager should have forced an update; // possibly the user ran the viewer directly and bypassed the update check std::string required_version = response["message_args"]["VERSION"]; - LL_WARNS() << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; + LL_WARNS("LLLogin") << "Login failed because an update to version " << required_version << " is required." << LL_ENDL; if (gViewerWindow) gViewerWindow->setShowProgress(FALSE); @@ -335,7 +338,7 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) } else { - LL_WARNS() << "Login failed for an unknown reason: " << LLSDOStreamer(response) << LL_ENDL; + LL_WARNS("LLLogin") << "Login failed for an unknown reason: " << LLSDOStreamer(response) << LL_ENDL; if (gViewerWindow) gViewerWindow->setShowProgress(FALSE); @@ -351,7 +354,7 @@ void LLLoginInstance::handleLoginDisallowed(const LLSD& notification, const LLSD void LLLoginInstance::handleLoginSuccess(const LLSD& event) { - LL_INFOS() << "LLLoginInstance::handleLoginSuccess" << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleLoginSuccess" << LL_ENDL; attemptComplete(); } @@ -360,7 +363,7 @@ void LLLoginInstance::handleDisconnect(const LLSD& event) { // placeholder - LL_INFOS() << "LLLoginInstance::handleDisconnect placeholder " << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleDisconnect placeholder " << LL_ENDL; } void LLLoginInstance::handleIndeterminate(const LLSD& event) @@ -374,7 +377,7 @@ void LLLoginInstance::handleIndeterminate(const LLSD& event) LLSD message = event.get("data").get("message"); if(message.isDefined()) { - LL_INFOS() << "LLLoginInstance::handleIndeterminate " << message.asString() << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleIndeterminate " << message.asString() << LL_ENDL; LLSD progress_update; progress_update["desc"] = message; @@ -386,7 +389,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) { if(accepted) { - LL_INFOS() << "LLLoginInstance::handleTOSResponse: accepted" << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleTOSResponse: accepted" << LL_ENDL; // Set the request data to true and retry login. mRequestData["params"][key] = true; @@ -394,7 +397,7 @@ bool LLLoginInstance::handleTOSResponse(bool accepted, const std::string& key) } else { - LL_INFOS() << "LLLoginInstance::handleTOSResponse: attemptComplete" << LL_ENDL; + LL_INFOS("LLLogin") << "LLLoginInstance::handleTOSResponse: attemptComplete" << LL_ENDL; attemptComplete(); } -- cgit v1.2.3 From 545b03da7110b9b37f0275bb34e8089f10770e0d Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 22 Sep 2017 15:33:33 -0400 Subject: MAINT-7827: suppress doubled notices on various login problems --- indra/newview/lllogininstance.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/lllogininstance.cpp') diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp index bb55a3a6c0..242a845abe 100644 --- a/indra/newview/lllogininstance.cpp +++ b/indra/newview/lllogininstance.cpp @@ -330,10 +330,12 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event) data["VERSION"] = required_version; LLNotificationsUtil::add("RequiredUpdate", data, LLSD::emptyMap(), boost::bind(&LLLoginInstance::handleLoginDisallowed, this, _1, _2)); } - else if(reason_response == "key") + else if( reason_response == "key" + || reason_response == "presence" + || reason_response == "connect" + ) { - // this is a password problem or other restriction - // an appropriate message has already been displayed + // these are events that have already been communicated elsewhere attemptComplete(); } else -- cgit v1.2.3