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 #33000.6.5-rc1
parent
fa5fef33a9
commit
0d37907c58
|
@ -45,7 +45,7 @@ using MXP.Common.Proto;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP.ClientStack
|
namespace OpenSim.Client.MXP.ClientStack
|
||||||
{
|
{
|
||||||
class MXPClientView : IClientAPI, IClientCore
|
public class MXPClientView : IClientAPI, IClientCore
|
||||||
{
|
{
|
||||||
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
internal static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP
|
namespace OpenSim.Client.MXP
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* MXP Client Module which adds MXP support to client / region communication.
|
||||||
|
*/
|
||||||
public class MXPModule : IRegionModule
|
public class MXPModule : IRegionModule
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ namespace OpenSim.Client.MXP
|
||||||
|
|
||||||
m_port = con.GetInt("Port", m_port);
|
m_port = con.GetInt("Port", m_port);
|
||||||
|
|
||||||
m_server = new MXPPacketServer(m_port, m_scenes);
|
m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true));
|
||||||
|
|
||||||
m_ticker.AutoReset = false;
|
m_ticker.AutoReset = false;
|
||||||
m_ticker.Elapsed += ticker_Elapsed;
|
m_ticker.Elapsed += ticker_Elapsed;
|
||||||
|
|
|
@ -39,6 +39,7 @@ using OpenMetaverse;
|
||||||
using OpenSim.Client.MXP.ClientStack;
|
using OpenSim.Client.MXP.ClientStack;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Region.Framework.Scenes;
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Framework.Communications;
|
||||||
|
|
||||||
namespace OpenSim.Client.MXP.PacketHandler
|
namespace OpenSim.Client.MXP.PacketHandler
|
||||||
{
|
{
|
||||||
|
@ -59,6 +60,8 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
|
private readonly IList<MXPClientView> m_sessionsToRemove = new List<MXPClientView>();
|
||||||
|
|
||||||
private readonly int m_port;
|
private readonly int m_port;
|
||||||
|
private readonly bool m_accountsAuthenticate;
|
||||||
|
|
||||||
private readonly String m_programName;
|
private readonly String m_programName;
|
||||||
private readonly byte m_programMajorVersion;
|
private readonly byte m_programMajorVersion;
|
||||||
private readonly byte m_programMinorVersion;
|
private readonly byte m_programMinorVersion;
|
||||||
|
@ -67,13 +70,13 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes)
|
public MXPPacketServer(int port, Dictionary<UUID, Scene> scenes, bool accountsAuthenticate)
|
||||||
{
|
{
|
||||||
this.m_port = port;
|
m_port = port;
|
||||||
|
m_accountsAuthenticate = accountsAuthenticate;
|
||||||
|
|
||||||
m_scenes = scenes;
|
m_scenes = scenes;
|
||||||
|
|
||||||
|
|
||||||
m_programMinorVersion = 63;
|
m_programMinorVersion = 63;
|
||||||
m_programMajorVersion = 0;
|
m_programMajorVersion = 0;
|
||||||
m_programName = "OpenSimulator";
|
m_programName = "OpenSimulator";
|
||||||
|
@ -270,21 +273,35 @@ namespace OpenSim.Client.MXP.PacketHandler
|
||||||
lastName = nameParts[1];
|
lastName = nameParts[1];
|
||||||
|
|
||||||
UserProfileData userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
|
UserProfileData userProfile = m_scenes[sceneId].CommsManager.UserService.GetUserProfile(firstName, lastName);
|
||||||
if (userProfile == null)
|
if (userProfile == null && !m_accountsAuthenticate)
|
||||||
{
|
{
|
||||||
m_log.Info("Login failed as user was not found: " + participantName);
|
userId = ((UserManagerBase)m_scenes[sceneId].CommsManager.UserService).AddUser(firstName, lastName, "test", "", 1000, 1000);
|
||||||
return false;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (userProfile == null)
|
||||||
|
{
|
||||||
|
m_log.Info("Login failed as user was not found: " + participantName);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
userId = userProfile.ID;
|
||||||
}
|
}
|
||||||
userId = userProfile.ID;
|
|
||||||
|
|
||||||
if (!password.StartsWith("$1$"))
|
if (m_accountsAuthenticate)
|
||||||
{
|
{
|
||||||
password = "$1$" + Util.Md5Hash(password);
|
if (!password.StartsWith("$1$"))
|
||||||
|
{
|
||||||
|
password = "$1$" + Util.Md5Hash(password);
|
||||||
|
}
|
||||||
|
password = password.Remove(0, 3); //remove $1$
|
||||||
|
string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt);
|
||||||
|
return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
||||||
|
|| userProfile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
password = password.Remove(0, 3); //remove $1$
|
|
||||||
string s = Util.Md5Hash(password + ":" + userProfile.PasswordSalt);
|
|
||||||
return (userProfile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|
|
||||||
|| userProfile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ProcessMessages()
|
public void ProcessMessages()
|
||||||
|
|
Loading…
Reference in New Issue