diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml index 15434f2b8f..946ca6b6b9 100644 --- a/indra/newview/app_settings/cmd_line.xml +++ b/indra/newview/app_settings/cmd_line.xml @@ -279,7 +279,7 @@ count 3 map-to - UserLoginInfo + UserLoginInfo1 god diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index abf6922d11..261bde0ef4 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13886,6 +13886,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value + UserLoginInfo1 + + Comment + Users loging data. + Persist + 1 + Type + LLSD + Value + UseLSLBridge Comment diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp index 8975e30cc6..d4072aca91 100644 --- a/indra/newview/llloginhandler.cpp +++ b/indra/newview/llloginhandler.cpp @@ -148,4 +148,56 @@ bool LLLoginHandler::handle(const LLSD& tokens, LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); } return true; -} \ No newline at end of file +} + + + +// Initialize the credentials +// If the passed in URL contains login info, parse +// that into a credential and web login key. Otherwise +// check the command line. If the command line +// does not contain any login creds, load the last saved +// ones from the protected credential store. +// This always returns with a credential structure set in the +// login handler +LLPointer LLLoginHandler::initializeLoginInfo() +{ + LLPointer result = NULL; + // so try to load it from the UserLoginInfo + result = loadSavedUserLoginInfo(); + if (result.isNull()) + { + result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid()); + } + + return result; +} + + +LLPointer LLLoginHandler::loadSavedUserLoginInfo() +{ + // load the saved user login info into a LLCredential. + // perhaps this should be moved. + LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo1"); + if (cmd_line_login.size() == 3) + { + + LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str()); + char md5pass[33]; /* Flawfinder: ignore */ + pass.hex_digest(md5pass); + LLSD identifier = LLSD::emptyMap(); + identifier["type"] = "agent"; + identifier["first_name"] = cmd_line_login[0]; + identifier["last_name"] = cmd_line_login[1]; + + LLSD authenticator = LLSD::emptyMap(); + authenticator["type"] = "hash"; + authenticator["algorithm"] = "md5"; + authenticator["secret"] = md5pass; + // yuck, we'll fix this with mani's changes. + gSavedSettings.setBOOL("AutoLogin", TRUE); + return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), + identifier, authenticator); + } + return NULL; +} diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h index 0e1f17c16a..1f2eacd094 100644 --- a/indra/newview/llloginhandler.h +++ b/indra/newview/llloginhandler.h @@ -44,6 +44,9 @@ class LLLoginHandler : public LLCommandHandler // Web-based login unsupported //LLUUID getWebLoginKey() const { return mWebLoginKey; } + LLPointer loadSavedUserLoginInfo(); + LLPointer initializeLoginInfo(); + private: void parse(const LLSD& queryMap); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ef88de019b..014c15fd30 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -790,7 +790,7 @@ bool idle_startup() // if (gUserCredential.isNull()) { - gUserCredential = gSecAPIHandler->loadCredential(gSavedSettings.getString("UserLoginInfo")); + gUserCredential = gLoginHandler.initializeLoginInfo(); } // Previous initializeLoginInfo may have generated user credentials. Re-check them. if (gUserCredential.isNull())