diff options
Diffstat (limited to 'OpenSim/Framework/Communications/UserManagerBase.cs')
-rw-r--r-- | OpenSim/Framework/Communications/UserManagerBase.cs | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs index 58174a0..bf4f331 100644 --- a/OpenSim/Framework/Communications/UserManagerBase.cs +++ b/OpenSim/Framework/Communications/UserManagerBase.cs | |||
@@ -44,7 +44,8 @@ namespace OpenSim.Framework.Communications | |||
44 | /// <summary> | 44 | /// <summary> |
45 | /// Base class for user management (create, read, etc) | 45 | /// Base class for user management (create, read, etc) |
46 | /// </summary> | 46 | /// </summary> |
47 | public abstract class UserManagerBase : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication | 47 | public abstract class UserManagerBase |
48 | : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication | ||
48 | { | 49 | { |
49 | private static readonly ILog m_log | 50 | private static readonly ILog m_log |
50 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -649,15 +650,17 @@ namespace OpenSim.Framework.Communications | |||
649 | public virtual UUID AddUser( | 650 | public virtual UUID AddUser( |
650 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) | 651 | string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID) |
651 | { | 652 | { |
652 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty); | ||
653 | 653 | ||
654 | UserProfileData user = new UserProfileData(); | 654 | UserProfileData user = new UserProfileData(); |
655 | |||
656 | user.PasswordSalt = Util.Md5Hash(UUID.Random().ToString()); | ||
657 | string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + user.PasswordSalt); | ||
658 | |||
655 | user.HomeLocation = new Vector3(128, 128, 100); | 659 | user.HomeLocation = new Vector3(128, 128, 100); |
656 | user.ID = SetUUID; | 660 | user.ID = SetUUID; |
657 | user.FirstName = firstName; | 661 | user.FirstName = firstName; |
658 | user.SurName = lastName; | 662 | user.SurName = lastName; |
659 | user.PasswordHash = md5PasswdHash; | 663 | user.PasswordHash = md5PasswdHash; |
660 | user.PasswordSalt = String.Empty; | ||
661 | user.Created = Util.UnixTimeSinceEpoch(); | 664 | user.Created = Util.UnixTimeSinceEpoch(); |
662 | user.HomeLookAt = new Vector3(100, 100, 100); | 665 | user.HomeLookAt = new Vector3(100, 100, 100); |
663 | user.HomeRegionX = regX; | 666 | user.HomeRegionX = regX; |
@@ -891,7 +894,10 @@ namespace OpenSim.Framework.Communications | |||
891 | 894 | ||
892 | if (userProfile != null && userProfile.CurrentAgent != null) | 895 | if (userProfile != null && userProfile.CurrentAgent != null) |
893 | { | 896 | { |
894 | m_log.DebugFormat("[USER AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID); | 897 | m_log.DebugFormat( |
898 | "[USER AUTH]: Verifying session {0} for {1}; current session {2}", | ||
899 | sessionID, userID, userProfile.CurrentAgent.SessionID); | ||
900 | |||
895 | if (userProfile.CurrentAgent.SessionID == sessionID) | 901 | if (userProfile.CurrentAgent.SessionID == sessionID) |
896 | { | 902 | { |
897 | return true; | 903 | return true; |
@@ -901,6 +907,26 @@ namespace OpenSim.Framework.Communications | |||
901 | return false; | 907 | return false; |
902 | } | 908 | } |
903 | 909 | ||
910 | public virtual bool AuthenticateUserByPassword(UUID userID, string password) | ||
911 | { | ||
912 | // m_log.DebugFormat("[USER AUTH]: Authenticating user {0} given password {1}", userID, password); | ||
913 | |||
914 | UserProfileData userProfile = GetUserProfile(userID); | ||
915 | |||
916 | if (null == userProfile) | ||
917 | return false; | ||
918 | |||
919 | string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt); | ||
920 | |||
921 | // m_log.DebugFormat( | ||
922 | // "[USER AUTH]: Submitted hash {0}, stored hash {1}", md5PasswordHash, userProfile.PasswordHash); | ||
923 | |||
924 | if (md5PasswordHash == userProfile.PasswordHash) | ||
925 | return true; | ||
926 | else | ||
927 | return false; | ||
928 | } | ||
929 | |||
904 | #endregion | 930 | #endregion |
905 | } | 931 | } |
906 | } | 932 | } |