Moved circuit authorisation to the ClientConnection class
parent
6ce493947d
commit
10956993b7
|
@ -61,10 +61,6 @@ namespace OpenSim
|
||||||
formatter.RegisterField<AssetBase>(new AssetBaseField(formatter));
|
formatter.RegisterField<AssetBase>(new AssetBaseField(formatter));
|
||||||
|
|
||||||
}
|
}
|
||||||
~BerkeleyDatabases()
|
|
||||||
{
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BerkeleyDatabases dbs;
|
public BerkeleyDatabases dbs;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,9 @@ namespace OpenSim
|
||||||
public static SceneGraph Scene;
|
public static SceneGraph Scene;
|
||||||
public static AgentManager AgentManager;
|
public static AgentManager AgentManager;
|
||||||
public static PrimManager PrimManager;
|
public static PrimManager PrimManager;
|
||||||
|
public static UserServer UserServer;
|
||||||
public byte ConnectionType=1;
|
public byte ConnectionType=1;
|
||||||
|
private bool _authorised = false;
|
||||||
|
|
||||||
private Thread _mthread;
|
private Thread _mthread;
|
||||||
|
|
||||||
|
@ -69,32 +71,29 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
case PacketType.UseCircuitCode:
|
case PacketType.UseCircuitCode:
|
||||||
Console.WriteLine("new circuit");
|
Console.WriteLine("new circuit");
|
||||||
//should be a new user/circuit joining
|
|
||||||
// add agents profile to agentmanager
|
|
||||||
string first = "",last ="";
|
|
||||||
LLUUID baseFolder = null, inventoryFolder =null;
|
|
||||||
|
|
||||||
//rather than use IncomingLogins list, the logon object could be passed to this connection on creation
|
//should check that this session/circuit is authorised
|
||||||
lock(Globals.Instance.IncomingLogins)
|
UseCircuitCodePacket circuitPacket=(UseCircuitCodePacket)packet;
|
||||||
|
AuthenticateResponse sessionInfo = UserServer.AuthenticateSession(circuitPacket.CircuitCode.SessionID, circuitPacket.CircuitCode.ID, circuitPacket.CircuitCode.Code);
|
||||||
|
if(!sessionInfo.Authorised)
|
||||||
{
|
{
|
||||||
for(int i = 0; i < Globals.Instance.IncomingLogins.Count; i++)
|
//session/circuit not authorised
|
||||||
{
|
//so do something about it
|
||||||
if(Globals.Instance.IncomingLogins[i].Agent == this.NetInfo.User.AgentID)
|
|
||||||
{
|
|
||||||
first = Globals.Instance.IncomingLogins[i].First;
|
|
||||||
last = Globals.Instance.IncomingLogins[i].Last;
|
|
||||||
baseFolder = Globals.Instance.IncomingLogins[i].BaseFolder;
|
|
||||||
inventoryFolder = Globals.Instance.IncomingLogins[i].InventoryFolder;
|
|
||||||
Globals.Instance.IncomingLogins.RemoveAt(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(first != "")
|
else
|
||||||
{
|
{
|
||||||
|
//is authorised
|
||||||
|
string first = "",last ="";
|
||||||
|
LLUUID baseFolder = null, inventoryFolder =null;
|
||||||
|
first = sessionInfo.LogonInfo.First;
|
||||||
|
last = sessionInfo.LogonInfo.Last;
|
||||||
|
baseFolder = sessionInfo.LogonInfo.BaseFolder;
|
||||||
|
inventoryFolder = sessionInfo.LogonInfo.InventoryFolder;
|
||||||
AgentManager.NewAgent(this.NetInfo, first, last, baseFolder, inventoryFolder);
|
AgentManager.NewAgent(this.NetInfo, first, last, baseFolder, inventoryFolder);
|
||||||
|
this._authorised = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
//should check this circuit is authorised before processing any other packets
|
||||||
case PacketType.CompleteAgentMovement:
|
case PacketType.CompleteAgentMovement:
|
||||||
//Agent completing movement to region
|
//Agent completing movement to region
|
||||||
// so send region handshake
|
// so send region handshake
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Controller c = new Controller();
|
Controller c = new Controller();
|
||||||
bool Run=true;
|
bool Run = true;
|
||||||
while( Run )
|
while( Run )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -74,6 +74,7 @@ namespace OpenSim
|
||||||
ClientConnection.Grid = _gridManager;
|
ClientConnection.Grid = _gridManager;
|
||||||
ClientConnection.Scene = _scene;
|
ClientConnection.Scene = _scene;
|
||||||
ClientConnection.AgentManager = _agentManager;
|
ClientConnection.AgentManager = _agentManager;
|
||||||
|
ClientConnection.UserServer = _backboneServers.UserServer;
|
||||||
_viewerServer.Startup();
|
_viewerServer.Startup();
|
||||||
BerkeleyDatabases.Instance.Startup();
|
BerkeleyDatabases.Instance.Startup();
|
||||||
_primManager = new PrimManager();
|
_primManager = new PrimManager();
|
||||||
|
|
|
@ -51,8 +51,9 @@ namespace OpenSim
|
||||||
|
|
||||||
PrimAsset prim1 = this._localPrimDB.GetPrimFromStroage( new LLUUID("00000000-0000-0000-0000-000000000008"));
|
PrimAsset prim1 = this._localPrimDB.GetPrimFromStroage( new LLUUID("00000000-0000-0000-0000-000000000008"));
|
||||||
Console.WriteLine("prim recieved : "+prim1.Name + " "+ prim1.Description);
|
Console.WriteLine("prim recieved : "+prim1.Name + " "+ prim1.Description);
|
||||||
*/
|
|
||||||
//this._localPrimDB.ReadWholedatabase();
|
//this._localPrimDB.ReadWholedatabase();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
public Node RootNode;
|
public Node RootNode;
|
||||||
public Terrain Terrain;
|
public Terrain Terrain;
|
||||||
|
|
||||||
|
private Thread _mthread;
|
||||||
private PhysicsManager _physics;
|
private PhysicsManager _physics;
|
||||||
private Server _server;
|
private Server _server;
|
||||||
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
private System.Text.Encoding _enc = System.Text.Encoding.ASCII;
|
||||||
|
@ -71,6 +73,28 @@ namespace OpenSim
|
||||||
_updateSender.Startup();
|
_updateSender.Startup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Startup()
|
||||||
|
{
|
||||||
|
_mthread = new Thread(new System.Threading.ThreadStart(RunScene));
|
||||||
|
_mthread.IsBackground = true;
|
||||||
|
_mthread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RunScene()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
this.Update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
// run physics engine to update positions etc since last frame
|
// run physics engine to update positions etc since last frame
|
||||||
|
@ -516,7 +540,7 @@ namespace OpenSim
|
||||||
public class UpdateSender
|
public class UpdateSender
|
||||||
{
|
{
|
||||||
public BlockingQueue<SendInfo> SendList;
|
public BlockingQueue<SendInfo> SendList;
|
||||||
private Thread mthread;
|
private Thread _mthread;
|
||||||
private Server _server;
|
private Server _server;
|
||||||
private AgentManager _agentManager;
|
private AgentManager _agentManager;
|
||||||
|
|
||||||
|
@ -529,9 +553,9 @@ namespace OpenSim
|
||||||
|
|
||||||
public void Startup()
|
public void Startup()
|
||||||
{
|
{
|
||||||
mthread = new Thread(new System.Threading.ThreadStart(RunSender));
|
_mthread = new Thread(new System.Threading.ThreadStart(RunSender));
|
||||||
mthread.IsBackground = true;
|
_mthread.IsBackground = true;
|
||||||
mthread.Start();
|
_mthread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RunSender()
|
private void RunSender()
|
||||||
|
|
|
@ -117,14 +117,14 @@ namespace OpenSim
|
||||||
private System.Timers.Timer AckTimer;
|
private System.Timers.Timer AckTimer;
|
||||||
private Server_Settings Settings=new Server_Settings();
|
private Server_Settings Settings=new Server_Settings();
|
||||||
public ArrayList User_agents=new ArrayList();
|
public ArrayList User_agents=new ArrayList();
|
||||||
private IUserServer _userServer;
|
//private IUserServer _userServer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Server(IUserServer userServer)
|
public Server(IUserServer userServer)
|
||||||
{
|
{
|
||||||
this._userServer = userServer;
|
//this._userServer = userServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -429,24 +429,8 @@ namespace OpenSim
|
||||||
if (packet.Type == PacketType.UseCircuitCode)
|
if (packet.Type == PacketType.UseCircuitCode)
|
||||||
{
|
{
|
||||||
//new connection
|
//new connection
|
||||||
|
//for now it isn't authorised but we will let the clientconnection thread deal with that
|
||||||
UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet;
|
UseCircuitCodePacket cir_pack=(UseCircuitCodePacket)packet;
|
||||||
//should check that this session/circuit is authorised
|
|
||||||
AuthenticateResponse sessionInfo = this._userServer.AuthenticateSession(cir_pack.CircuitCode.SessionID, cir_pack.CircuitCode.ID, cir_pack.CircuitCode.Code);
|
|
||||||
if(!sessionInfo.Authorised)
|
|
||||||
{
|
|
||||||
//session/circuit not authorised
|
|
||||||
//so do something about it
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//is authorised so add the logon object to the incominglogin list
|
|
||||||
//should be a better way of doing this now the login server connects to the user server
|
|
||||||
// like passing the logon object straight to the ClientConnection
|
|
||||||
lock(Globals.Instance.IncomingLogins)
|
|
||||||
{
|
|
||||||
Globals.Instance.IncomingLogins.Add(sessionInfo.LogonInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
NetworkInfo new_user=new NetworkInfo();
|
NetworkInfo new_user=new NetworkInfo();
|
||||||
new_user.CircuitCode=cir_pack.CircuitCode.Code;
|
new_user.CircuitCode=cir_pack.CircuitCode.Code;
|
||||||
new_user.User.AgentID=cir_pack.CircuitCode.ID;
|
new_user.User.AgentID=cir_pack.CircuitCode.ID;
|
||||||
|
@ -458,7 +442,10 @@ namespace OpenSim
|
||||||
new_user.Connection.Start();
|
new_user.Connection.Start();
|
||||||
|
|
||||||
//this.CallbackObject.NewUserCallback(new_user);
|
//this.CallbackObject.NewUserCallback(new_user);
|
||||||
|
lock(this.User_agents)
|
||||||
|
{
|
||||||
this.User_agents.Add(new_user);
|
this.User_agents.Add(new_user);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,17 +453,20 @@ namespace OpenSim
|
||||||
IPEndPoint send_ip=(IPEndPoint)epSender;
|
IPEndPoint send_ip=(IPEndPoint)epSender;
|
||||||
// this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString());
|
// this.callback_object.error("incoming: address is "+send_ip.Address +"port number is: "+send_ip.Port.ToString());
|
||||||
|
|
||||||
for(int ii=0; ii<this.User_agents.Count ; ii++)
|
lock(this.User_agents)
|
||||||
{
|
{
|
||||||
temp_agent=(NetworkInfo)this.User_agents[ii];
|
for(int ii=0; ii<this.User_agents.Count ; ii++)
|
||||||
IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint;
|
|
||||||
//this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString());
|
|
||||||
|
|
||||||
if((ag_ip.Address.ToString()==send_ip.Address.ToString()) && (ag_ip.Port.ToString()==send_ip.Port.ToString()))
|
|
||||||
{
|
{
|
||||||
//this.callback_object.error("found user");
|
temp_agent=(NetworkInfo)this.User_agents[ii];
|
||||||
User_info=temp_agent;
|
IPEndPoint ag_ip=(IPEndPoint)temp_agent.endpoint;
|
||||||
break;
|
//this.callback_object.error("searching: address is "+ag_ip.Address +"port number is: "+ag_ip.Port.ToString());
|
||||||
|
|
||||||
|
if((ag_ip.Address.ToString()==send_ip.Address.ToString()) && (ag_ip.Port.ToString()==send_ip.Port.ToString()))
|
||||||
|
{
|
||||||
|
//this.callback_object.error("found user");
|
||||||
|
User_info=temp_agent;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue