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. --- .../Framework/Communications/UserManagerBase.cs | 32 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 58174a0..1abd733 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -44,7 +44,8 @@ namespace OpenSim.Framework.Communications /// /// Base class for user management (create, read, etc) /// - public abstract class UserManagerBase : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication + public abstract class UserManagerBase + : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -93,9 +94,9 @@ namespace OpenSim.Framework.Communications public void AddPlugin(string provider, string connect) { m_plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect)); - } + } - #region UserProfile + #region UserProfile public virtual void AddTemporaryUserProfile(UserProfileData userProfile) { @@ -891,7 +892,10 @@ namespace OpenSim.Framework.Communications if (userProfile != null && userProfile.CurrentAgent != null) { - m_log.DebugFormat("[USER AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID); + m_log.DebugFormat( + "[USER AUTH]: Verifying session {0} for {1}; current session {2}", + sessionID, userID, userProfile.CurrentAgent.SessionID); + if (userProfile.CurrentAgent.SessionID == sessionID) { return true; @@ -901,6 +905,26 @@ namespace OpenSim.Framework.Communications return false; } + public virtual bool AuthenticateUserByPassword(UUID userID, string password) + { +// m_log.DebugFormat("[USER AUTH]: Authenticating user {0} given password {1}", userID, password); + + UserProfileData userProfile = GetUserProfile(userID); + + if (null == userProfile) + return false; + + string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt); + +// m_log.DebugFormat( +// "[USER AUTH]: Submitted hash {0}, stored hash {1}", md5PasswordHash, userProfile.PasswordHash); + + if (md5PasswordHash == userProfile.PasswordHash) + return true; + else + return false; + } + #endregion } } -- cgit v1.1 From 1006a2254c733655bf11d3cf25e41d1b43bd5f6a Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 30 Sep 2009 13:36:03 +0100 Subject: Make create user to the Right Thing with regard to salting user passwords --- OpenSim/Framework/Communications/UserManagerBase.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 1abd733..86238b1 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -650,15 +650,17 @@ namespace OpenSim.Framework.Communications public virtual UUID AddUser( string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) { - string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); UserProfileData user = new UserProfileData(); + + user.PasswordSalt = Util.Md5Hash(UUID.Random().ToString()); + string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + user.PasswordSalt); + user.HomeLocation = new Vector3(128, 128, 100); user.ID = SetUUID; user.FirstName = firstName; user.SurName = lastName; user.PasswordHash = md5PasswdHash; - user.PasswordSalt = String.Empty; user.Created = Util.UnixTimeSinceEpoch(); user.HomeLookAt = new Vector3(100, 100, 100); user.HomeRegionX = regX; -- cgit v1.1 From ee205e7e812e170f670e690a4e0fa9caa652f226 Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Thu, 1 Oct 2009 01:00:09 +0900 Subject: Formatting cleanup. --- OpenSim/Framework/Communications/UserManagerBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs') diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 86238b1..bf4f331 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs @@ -94,9 +94,9 @@ namespace OpenSim.Framework.Communications public void AddPlugin(string provider, string connect) { m_plugins.AddRange(DataPluginFactory.LoadDataPlugins(provider, connect)); - } + } - #region UserProfile + #region UserProfile public virtual void AddTemporaryUserProfile(UserProfileData userProfile) { @@ -924,8 +924,8 @@ namespace OpenSim.Framework.Communications if (md5PasswordHash == userProfile.PasswordHash) return true; else - return false; - } + return false; + } #endregion } -- cgit v1.1