diff options
author | Dahlia Trimble | 2009-03-15 16:17:01 +0000 |
---|---|---|
committer | Dahlia Trimble | 2009-03-15 16:17:01 +0000 |
commit | 0d37907c581f0417b7dece11417bd2e61de5a61e (patch) | |
tree | 27b152b39bf7d06b23e05f369b6f9ff22d40a865 /OpenSim/Client/MXP/PacketHandler | |
parent | fixed propagation of normalized sculpt mesh vertex normals (diff) | |
download | opensim-SC_OLD-0d37907c581f0417b7dece11417bd2e61de5a61e.zip opensim-SC_OLD-0d37907c581f0417b7dece11417bd2e61de5a61e.tar.gz opensim-SC_OLD-0d37907c581f0417b7dece11417bd2e61de5a61e.tar.bz2 opensim-SC_OLD-0d37907c581f0417b7dece11417bd2e61de5a61e.tar.xz |
Thanks Tommil for a patch which added support for creating user accounts automatically in local sandbox if
accounts authenticate is set off and connecting with MXP protocol. Mantis #3300
Diffstat (limited to 'OpenSim/Client/MXP/PacketHandler')
-rw-r--r-- | OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs index 4f77f2c..ba7bd00 100644 --- a/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs +++ b/OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | |||
@@ -39,6 +39,7 @@ using OpenMetaverse; | |||
39 | using OpenSim.Client.MXP.ClientStack; | 39 | using OpenSim.Client.MXP.ClientStack; |
40 | using OpenSim.Framework; | 40 | using OpenSim.Framework; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Framework.Communications; | ||
42 | 43 | ||
43 | namespace OpenSim.Client.MXP.PacketHandler | 44 | namespace OpenSim.Client.MXP.PacketHandler |
44 | { | 45 | { |
@@ -59,6 +60,8 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
59 | private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>(); | 60 | private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>(); |
60 | 61 | ||
61 | private readonly int m_port; | 62 | private readonly int m_port; |
63 | private readonly bool m_accountsAuthenticate; | ||
64 | |||
62 | private readonly String m_programName; | 65 | private readonly String m_programName; |
63 | private readonly byte m_programMajorVersion; | 66 | private readonly byte m_programMajorVersion; |
64 | private readonly byte m_programMinorVersion; | 67 | private readonly byte m_programMinorVersion; |
@@ -67,13 +70,13 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
67 | 70 | ||
68 | #region Constructors | 71 | #region Constructors |
69 | 72 | ||
70 | public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes) | 73 | public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate) |
71 | { | 74 | { |
72 | this.m_port = port; | 75 | m_port = port; |
76 | m_accountsAuthenticate = accountsAuthenticate; | ||
73 | 77 | ||
74 | m_scenes = scenes; | 78 | m_scenes = scenes; |
75 | 79 | ||
76 | |||
77 | m_programMinorVersion = 63; | 80 | m_programMinorVersion = 63; |
78 | m_programMajorVersion = 0; | 81 | m_programMajorVersion = 0; |
79 | m_programName = "OpenSimulator"; | 82 | m_programName = "OpenSimulator"; |
@@ -259,7 +262,7 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
259 | m_log.Info("Login failed as region was not found: " + sceneId); | 262 | m_log.Info("Login failed as region was not found: " + sceneId); |
260 | return false; | 263 | return false; |
261 | } | 264 | } |
262 | 265 | ||
263 | string[] nameParts=participantName.Split(' '); | 266 | string[] nameParts=participantName.Split(' '); |
264 | if (nameParts.Length != 2) | 267 | if (nameParts.Length != 2) |
265 | { | 268 | { |
@@ -270,21 +273,35 @@ namespace OpenSim.Client.MXP.PacketHandler | |||
270 | lastName = nameParts[1]; | 273 | lastName = nameParts[1]; |
271 | 274 | ||
272 | UserProfileData userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName); | 275 | UserProfileData userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName); |
273 | if (userProfile == null) | 276 | if (userProfile == null && !m_accountsAuthenticate) |
274 | { | 277 | { |
275 | m_log.Info("Login failed as user was not found: " + participantName); | 278 | userId = ((UserManagerBase)m_scenes[sceneId].CommsManager.UserService).AddUser(firstName, lastName, "test", "", 1000, 1000); |
276 | return false; | 279 | } |
280 | else | ||
281 | { | ||
282 | if (userProfile == null) | ||
283 | { | ||
284 | m_log.Info("Login failed as user was not found: " + participantName); | ||
285 | return false; | ||
286 | } | ||
287 | userId = userProfile.ID; | ||
277 | } | 288 | } |
278 | userId = userProfile.ID; | ||
279 | 289 | ||
280 | if (!password.StartsWith("$1$")) | 290 | if (m_accountsAuthenticate) |
291 | { | ||
292 | if (!password.StartsWith("$1$")) | ||
293 | { | ||
294 | password = "$1$" + Util.Md5Hash(password); | ||
295 | } | ||
296 | password = password.Remove(0, 3); //remove $1$ | ||
297 | string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt); | ||
298 | return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | ||
299 | || userProfile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); | ||
300 | } | ||
301 | else | ||
281 | { | 302 | { |
282 | password = "$1$" + Util.Md5Hash(password); | 303 | return true; |
283 | } | 304 | } |
284 | password = password.Remove(0, 3); //remove $1$ | ||
285 | string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt); | ||
286 | return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) | ||
287 | || userProfile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); | ||
288 | } | 305 | } |
289 | 306 | ||
290 | public void ProcessMessages() | 307 | public void ProcessMessages() |