From 5a2315c68c7ccac2fafeb7e2cd51ecda863a9fa7 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 26 Mar 2010 12:21:05 -0700 Subject: * Fixed a bug with null value handling in WebUtil.BuildQueryString() * Changed the null check back in estate manager setup but fixed the case for an existing account being found * Implemented SetPassword() in the SimianGrid auth connector --- .../SimianAuthenticationServiceConnector.cs | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'OpenSim/Services/Connectors') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 29c9219..031b326 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -177,9 +177,46 @@ namespace OpenSim.Services.Connectors.SimianGrid public bool SetPassword(UUID principalID, string passwd) { - // TODO: Use GetIdentities to find the md5hash identity for principalID - // and then update it with AddIdentity - m_log.Error("[AUTH CONNECTOR]: Changing passwords is not implemented yet"); + // Fetch the user name first + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "GetUser" }, + { "UserID", principalID.ToString() } + }; + + OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs); + if (response["Success"].AsBoolean() && response["User"] is OSDMap) + { + OSDMap userMap = (OSDMap)response["User"]; + string identifier = userMap["Name"].AsString(); + + if (!String.IsNullOrEmpty(identifier)) + { + // Add/update the md5hash identity + requestArgs = new NameValueCollection + { + { "RequestMethod", "AddIdentity" }, + { "Identifier", identifier }, + { "Credential", "$1$" + Utils.MD5String(passwd) }, + { "Type", "md5hash" }, + { "UserID", principalID.ToString() } + }; + + response = WebUtil.PostToService(m_serverUrl, requestArgs); + bool success = response["Success"].AsBoolean(); + + if (!success) + m_log.WarnFormat("[AUTH CONNECTOR]: Failed to set password for {0} ({1})", identifier, principalID); + + return success; + } + } + else + { + m_log.Warn("[AUTH CONNECTOR]: Failed to retrieve identities for " + principalID + ": " + + response["Message"].AsString()); + } + return false; } -- cgit v1.1