Temporary fix for FIRE-2813. --login should work now

Wolfspirit 2011-08-28 08:59:13 +02:00
parent 1aad372c78
commit 13ee9d8ec0
5 changed files with 68 additions and 3 deletions

View File

@ -279,7 +279,7 @@
<key>count</key>
<integer>3</integer>
<key>map-to</key>
<string>UserLoginInfo</string>
<string>UserLoginInfo1</string>
</map>
<key>god</key>

View File

@ -13886,6 +13886,16 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<string />
</map>
<key>UserLoginInfo1</key>
<map>
<key>Comment</key>
<string>Users loging data.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>LLSD</string>
<key>Value</key>
</map>
<key>UseLSLBridge</key>
<map>
<key>Comment</key>

View File

@ -148,4 +148,56 @@ bool LLLoginHandler::handle(const LLSD& tokens,
LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
}
return true;
}
}
// 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<LLCredential> LLLoginHandler::initializeLoginInfo()
{
LLPointer<LLCredential> result = NULL;
// so try to load it from the UserLoginInfo
result = loadSavedUserLoginInfo();
if (result.isNull())
{
result = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
}
return result;
}
LLPointer<LLCredential> 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;
}

View File

@ -44,6 +44,9 @@ class LLLoginHandler : public LLCommandHandler
// Web-based login unsupported
//LLUUID getWebLoginKey() const { return mWebLoginKey; }
LLPointer<LLCredential> loadSavedUserLoginInfo();
LLPointer<LLCredential> initializeLoginInfo();
private:
void parse(const LLSD& queryMap);

View File

@ -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())