From 7870152d23db4cb6f5834d4921fac17feb717220 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 14:54:12 +0100 Subject: Allow load/save iar password checks to be done in grid mode This should allow load/save iar to work for grid mode as long as the grid user service is later than this revision Grid services of earlier revisions will always erroneously report incorrect password. This will be addressed shortly. --- .../Communications/Local/LocalUserServices.cs | 19 +++++++++- .../Region/Communications/OGS1/OGS1UserServices.cs | 43 +++++++++++++++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs index af4fb37..d18937e 100644 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs @@ -80,6 +80,21 @@ namespace OpenSim.Region.Communications.Local throw new Exception("[LOCAL USER SERVICES]: Unknown master user UUID. Possible reason: UserServer is not running."); } return data; - } + } + + public override bool AuthenticateUserByPassword(UUID userID, string password) + { + UserProfileData userProfile = GetUserProfile(userID); + + if (null == userProfile) + return false; + + string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt); + + if (md5PasswordHash == userProfile.PasswordHash) + return true; + else + return false; + } } -} +} \ No newline at end of file diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index dff8305..89b3e42 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -140,6 +140,47 @@ namespace OpenSim.Region.Communications.OGS1 { m_log.DebugFormat("[OGS1 USER SERVICES]: Verifying user session for " + userID); return AuthClient.VerifySession(GetUserServerURL(userID), userID, sessionID); - } + } + + public override bool AuthenticateUserByPassword(UUID userID, string password) + { + try + { + Hashtable param = new Hashtable(); + param["user_uuid"] = userID.ToString(); + param["password"] = password; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); + Hashtable respData = (Hashtable)resp.Value; + +// foreach (object key in respData.Keys) +// { +// Console.WriteLine("respData {0}, {1}", key, respData[key]); +// } + +// m_log.DebugFormat( +// "[OGS1 USER SERVICES]: AuthenticatedUserByPassword response for {0} is [{1}]", +// userID, respData["auth_user"]); + + if ((string)respData["auth_user"] == "TRUE") + { + return true; + } + else + { + return false; + } + } + catch (Exception e) + { + m_log.ErrorFormat( + "[OGS1 USER SERVICES]: Error when trying to authenticate user by password from remote user server: {0}", + e); + + return false; + } + } } } \ No newline at end of file -- cgit v1.1 From f62b5e6cec31fe496ec4b9f7dcd6ae1f4063bead Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 15:19:47 +0100 Subject: Produce a different error message if the user service does not have the authenticate method available --- .../Region/Communications/OGS1/OGS1UserServices.cs | 46 +++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index 89b3e42..a55b62e 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -144,16 +144,25 @@ namespace OpenSim.Region.Communications.OGS1 public override bool AuthenticateUserByPassword(UUID userID, string password) { - try + Hashtable param = new Hashtable(); + param["user_uuid"] = userID.ToString(); + param["password"] = password; + IList parameters = new ArrayList(); + parameters.Add(param); + XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters); + XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); + + // Temporary measure to deal with older services + if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD) + //if ((string)respData["fault_code"] != null && (string)respData["fault_code"] == { - Hashtable param = new Hashtable(); - param["user_uuid"] = userID.ToString(); - param["password"] = password; - IList parameters = new ArrayList(); - parameters.Add(param); - XmlRpcRequest req = new XmlRpcRequest("authenticate_user_by_password", parameters); - XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); - Hashtable respData = (Hashtable)resp.Value; + throw new Exception( + String.Format( + "XMLRPC method 'authenticate_user_by_password' not yet implemented by user service at {0}", + m_commsManager.NetworkServersInfo.UserURL)); + } + + Hashtable respData = (Hashtable)resp.Value; // foreach (object key in respData.Keys) // { @@ -164,23 +173,14 @@ namespace OpenSim.Region.Communications.OGS1 // "[OGS1 USER SERVICES]: AuthenticatedUserByPassword response for {0} is [{1}]", // userID, respData["auth_user"]); - if ((string)respData["auth_user"] == "TRUE") - { - return true; - } - else - { - return false; - } + if ((string)respData["auth_user"] == "TRUE") + { + return true; } - catch (Exception e) + else { - m_log.ErrorFormat( - "[OGS1 USER SERVICES]: Error when trying to authenticate user by password from remote user server: {0}", - e); - return false; - } + } } } } \ No newline at end of file -- cgit v1.1 From e1abc3d4c49ae4068faf7b8d1dcb220829429757 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 24 Sep 2009 15:22:47 +0100 Subject: re-enable registration of user service authentication method I accidentally disabled a few commits ago load/save iar on a grid should now work, provided that the user service is this revision or newer --- OpenSim/Region/Communications/OGS1/OGS1UserServices.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'OpenSim/Region/Communications') diff --git a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs index a55b62e..51ba2e9 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1UserServices.cs @@ -153,8 +153,7 @@ namespace OpenSim.Region.Communications.OGS1 XmlRpcResponse resp = req.Send(m_commsManager.NetworkServersInfo.UserURL, 30000); // Temporary measure to deal with older services - if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD) - //if ((string)respData["fault_code"] != null && (string)respData["fault_code"] == + if (resp.IsFault && resp.FaultCode == XmlRpcErrorCodes.SERVER_ERROR_METHOD) { throw new Exception( String.Format( @@ -164,15 +163,6 @@ namespace OpenSim.Region.Communications.OGS1 Hashtable respData = (Hashtable)resp.Value; -// foreach (object key in respData.Keys) -// { -// Console.WriteLine("respData {0}, {1}", key, respData[key]); -// } - -// m_log.DebugFormat( -// "[OGS1 USER SERVICES]: AuthenticatedUserByPassword response for {0} is [{1}]", -// userID, respData["auth_user"]); - if ((string)respData["auth_user"] == "TRUE") { return true; -- cgit v1.1