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 | |
parent | fixed propagation of normalized sculpt mesh vertex normals (diff) | |
download | opensim-SC-0d37907c581f0417b7dece11417bd2e61de5a61e.zip opensim-SC-0d37907c581f0417b7dece11417bd2e61de5a61e.tar.gz opensim-SC-0d37907c581f0417b7dece11417bd2e61de5a61e.tar.bz2 opensim-SC-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 '')
-rw-r--r-- | OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Client/MXP/MXPModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Client/MXP/PacketHandler/MXPPacketServer.cs | 45 |
3 files changed, 36 insertions, 16 deletions
diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index 5ca85f1..9052443 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs | |||
@@ -45,7 +45,7 @@ using MXP.Common.Proto; | |||
45 | 45 | ||
46 | namespace OpenSim.Client.MXP.ClientStack | 46 | namespace OpenSim.Client.MXP.ClientStack |
47 | { | 47 | { |
48 | class MXPClientView : IClientAPI, IClientCore | 48 | public class MXPClientView : IClientAPI, IClientCore |
49 | { | 49 | { |
50 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 50 | internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
51 | 51 | ||
diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index e0891ca..6ec7744 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs | |||
@@ -38,6 +38,9 @@ using OpenSim.Region.Framework.Scenes; | |||
38 | 38 | ||
39 | namespace OpenSim.Client.MXP | 39 | namespace OpenSim.Client.MXP |
40 | { | 40 | { |
41 | /** | ||
42 | * MXP Client Module which adds MXP support to client / region communication. | ||
43 | */ | ||
41 | public class MXPModule : IRegionModule | 44 | public class MXPModule : IRegionModule |
42 | { | 45 | { |
43 | 46 | ||
@@ -70,7 +73,7 @@ namespace OpenSim.Client.MXP | |||
70 | 73 | ||
71 | m_port = con.GetInt("Port", m_port); | 74 | m_port = con.GetInt("Port", m_port); |
72 | 75 | ||
73 | m_server = new MXPPacketServer(m_port, m_scenes); | 76 | m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); |
74 | 77 | ||
75 | m_ticker.AutoReset = false; | 78 | m_ticker.AutoReset = false; |
76 | m_ticker.Elapsed += ticker_Elapsed; | 79 | m_ticker.Elapsed += ticker_Elapsed; |
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() |