aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Client/MXP/PacketHandler
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Client/MXP/PacketHandler')
-rw-r--r--OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs45
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;
39using OpenSim.Client.MXP.ClientStack; 39using OpenSim.Client.MXP.ClientStack;
40using OpenSim.Framework; 40using OpenSim.Framework;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Framework.Communications;
42 43
43namespace OpenSim.Client.MXP.PacketHandler 44namespace 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()