diff options
Diffstat (limited to 'OpenSim/Region/Communications/Local/LocalUserServices.cs')
-rw-r--r-- | OpenSim/Region/Communications/Local/LocalUserServices.cs | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs deleted file mode 100644 index 89b55c4..0000000 --- a/OpenSim/Region/Communications/Local/LocalUserServices.cs +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using OpenMetaverse; | ||
30 | using OpenSim.Framework; | ||
31 | using OpenSim.Framework.Communications; | ||
32 | using log4net; | ||
33 | using System.Reflection; | ||
34 | |||
35 | namespace OpenSim.Region.Communications.Local | ||
36 | { | ||
37 | public class LocalUserServices : UserManagerBase | ||
38 | { | ||
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | private readonly uint m_defaultHomeX; | ||
41 | private readonly uint m_defaultHomeY; | ||
42 | |||
43 | /// <summary> | ||
44 | /// User services used when OpenSim is running in standalone mode. | ||
45 | /// </summary> | ||
46 | /// <param name="defaultHomeLocX"></param> | ||
47 | /// <param name="defaultHomeLocY"></param> | ||
48 | /// <param name="commsManager"></param> | ||
49 | public LocalUserServices( | ||
50 | uint defaultHomeLocX, uint defaultHomeLocY, CommunicationsManager commsManager) | ||
51 | : base(commsManager) | ||
52 | { | ||
53 | m_defaultHomeX = defaultHomeLocX; | ||
54 | m_defaultHomeY = defaultHomeLocY; | ||
55 | } | ||
56 | |||
57 | public override UserProfileData SetupMasterUser(string firstName, string lastName) | ||
58 | { | ||
59 | return SetupMasterUser(firstName, lastName, String.Empty); | ||
60 | } | ||
61 | |||
62 | public override UserProfileData SetupMasterUser(string firstName, string lastName, string password) | ||
63 | { | ||
64 | UserProfileData profile = GetUserProfile(firstName, lastName); | ||
65 | if (profile != null) | ||
66 | { | ||
67 | return profile; | ||
68 | } | ||
69 | |||
70 | m_log.Debug("Unknown Master User. Sandbox Mode: Creating Account"); | ||
71 | AddUser(firstName, lastName, password, "", m_defaultHomeX, m_defaultHomeY); | ||
72 | return GetUserProfile(firstName, lastName); | ||
73 | } | ||
74 | |||
75 | public override UserProfileData SetupMasterUser(UUID uuid) | ||
76 | { | ||
77 | UserProfileData data = GetUserProfile(uuid); | ||
78 | if (data == null) | ||
79 | { | ||
80 | throw new Exception("[LOCAL USER SERVICES]: Unknown master user UUID. Possible reason: UserServer is not running."); | ||
81 | } | ||
82 | return data; | ||
83 | } | ||
84 | |||
85 | public override bool AuthenticateUserByPassword(UUID userID, string password) | ||
86 | { | ||
87 | UserProfileData userProfile = GetUserProfile(userID); | ||
88 | |||
89 | if (null == userProfile) | ||
90 | return false; | ||
91 | |||
92 | string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt); | ||
93 | |||
94 | if (md5PasswordHash == userProfile.PasswordHash) | ||
95 | return true; | ||
96 | else | ||
97 | return false; | ||
98 | } | ||
99 | } | ||
100 | } \ No newline at end of file | ||