aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2010-01-18 16:34:23 -0800
committerDiva Canto2010-01-18 16:34:23 -0800
commit3d536944153d4931cf891d6a788a47484f3e6f4d (patch)
tree53802c5f051e8fbb089aeed02e0b9de760fabd8a /OpenSim/Region
parent* Added missing GatekeeperServiceConnector (diff)
downloadopensim-SC_OLD-3d536944153d4931cf891d6a788a47484f3e6f4d.zip
opensim-SC_OLD-3d536944153d4931cf891d6a788a47484f3e6f4d.tar.gz
opensim-SC_OLD-3d536944153d4931cf891d6a788a47484f3e6f4d.tar.bz2
opensim-SC_OLD-3d536944153d4931cf891d6a788a47484f3e6f4d.tar.xz
Go Home works. With security!!
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs20
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs69
-rw-r--r--OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs (renamed from OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs)3
5 files changed, 94 insertions, 10 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
index 3c4fa72..ffd2546 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs
@@ -38,6 +38,7 @@ using OpenMetaverse.Packets;
38using OpenSim.Framework; 38using OpenSim.Framework;
39using OpenSim.Framework.Statistics; 39using OpenSim.Framework.Statistics;
40using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
41using OpenSim.Services.Interfaces;
41using OpenMetaverse; 42using OpenMetaverse;
42 43
43using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket; 44using TokenBucket = OpenSim.Region.ClientStack.LindenUDP.TokenBucket;
@@ -900,6 +901,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
900 901
901 if (!m_scene.TryGetClient(agentID, out existingClient)) 902 if (!m_scene.TryGetClient(agentID, out existingClient))
902 { 903 {
904 IHomeUsersSecurityService security = m_scene.RequestModuleInterface<IHomeUsersSecurityService>();
905 if (security != null)
906 {
907 IPEndPoint ep = security.GetEndPoint(sessionID);
908 if (ep != null && ep.ToString() != remoteEndPoint.ToString())
909 {
910 // uh-oh, this is fishy
911 m_log.WarnFormat("[LLUDPSERVER]: Agent {0} with session {1} connecting with unidentified end point. Refusing service.", agentID, sessionID);
912 m_log.WarnFormat("[LLUDPSERVER]: EP was {0}, now is {1}", ep.ToString(), remoteEndPoint.ToString());
913 return;
914 }
915 else if (ep != null)
916 {
917 // ok, you're home, welcome back
918 m_log.InfoFormat("LLUDPSERVER]: Agent {0} is coming back to this grid", agentID);
919 security.RemoveEndPoint(sessionID);
920 }
921 }
922
903 // Create the LLClientView 923 // Create the LLClientView
904 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); 924 LLClientView client = new LLClientView(remoteEndPoint, m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode);
905 client.OnLogout += LogoutHandler; 925 client.OnLogout += LogoutHandler;
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index e85f270..ed8c0fd 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -134,8 +134,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
134 if (!sp.Scene.Permissions.CanTeleport(sp.UUID)) 134 if (!sp.Scene.Permissions.CanTeleport(sp.UUID))
135 return; 135 return;
136 136
137 bool destRegionUp = true;
138
139 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>(); 137 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
140 138
141 // Reset animations; the viewer does that in teleports. 139 // Reset animations; the viewer does that in teleports.
@@ -240,8 +238,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
240 protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq) 238 protected void DoTeleport(ScenePresence sp, GridRegion reg, GridRegion finalDestination, Vector3 position, Vector3 lookAt, uint teleportFlags, IEventQueue eq)
241 { 239 {
242 m_log.DebugFormat( 240 m_log.DebugFormat(
243 "[ENTITY TRANSFER MODULE]: RequestTeleportToLocation to {0} in {1}", 241 "[ENTITY TRANSFER MODULE]: Request Teleport to {0}:{1}:{2}/{3} final destination {4}",
244 position, reg.RegionName); 242 reg.ExternalHostName, reg.HttpPort, reg.RegionName, position, finalDestination.RegionName);
245 243
246 uint newRegionX = (uint)(reg.RegionHandle >> 40); 244 uint newRegionX = (uint)(reg.RegionHandle >> 40);
247 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8); 245 uint newRegionY = (((uint)(reg.RegionHandle)) >> 8);
@@ -297,7 +295,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
297 string reason = String.Empty; 295 string reason = String.Empty;
298 296
299 // Let's create an agent there if one doesn't exist yet. 297 // Let's create an agent there if one doesn't exist yet.
300 if (!CreateAgent(reg, finalDestination, agentCircuit, teleportFlags, out reason)) 298 if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason))
301 { 299 {
302 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}", 300 sp.ControllingClient.SendTeleportFailed(String.Format("Destination refused: {0}",
303 reason)); 301 reason));
@@ -458,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
458 } 456 }
459 457
460 458
461 protected virtual bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 459 protected virtual bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
462 { 460 {
463 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason); 461 return m_aScene.SimulationService.CreateAgent(finalDestination, agentCircuit, teleportFlags, out reason);
464 } 462 }
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
index 0e6323b..d39537d 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
@@ -34,6 +34,7 @@ using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 34using OpenSim.Region.Framework.Scenes;
35using OpenSim.Services.Connectors.Hypergrid; 35using OpenSim.Services.Connectors.Hypergrid;
36using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
37using OpenSim.Server.Base;
37 38
38using GridRegion = OpenSim.Services.Interfaces.GridRegion; 39using GridRegion = OpenSim.Services.Interfaces.GridRegion;
39 40
@@ -59,6 +60,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
59 } 60 }
60 61
61 private GatekeeperServiceConnector m_GatekeeperConnector; 62 private GatekeeperServiceConnector m_GatekeeperConnector;
63 private IHomeUsersSecurityService m_Security;
62 64
63 #region ISharedRegionModule 65 #region ISharedRegionModule
64 66
@@ -77,12 +79,42 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
77 { 79 {
78 m_agentsInTransit = new List<UUID>(); 80 m_agentsInTransit = new List<UUID>();
79 m_GatekeeperConnector = new GatekeeperServiceConnector(); 81 m_GatekeeperConnector = new GatekeeperServiceConnector();
82
83 IConfig config = source.Configs["HGEntityTransferModule"];
84 if (config != null)
85 {
86 string dll = config.GetString("HomeUsersSecurityService", string.Empty);
87 if (dll != string.Empty)
88 {
89 Object[] args = new Object[] { source };
90 m_Security = ServerUtils.LoadPlugin<IHomeUsersSecurityService>(dll, args);
91 if (m_Security == null)
92 m_log.Debug("[HG ENTITY TRANSFER MODULE]: Unable to load Home Users Security service");
93 else
94 m_log.Debug("[HG ENTITY TRANSFER MODULE]: Home Users Security service loaded");
95 }
96 }
97
80 m_Enabled = true; 98 m_Enabled = true;
81 m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name); 99 m_log.InfoFormat("[HG ENTITY TRANSFER MODULE]: {0} enabled.", Name);
82 } 100 }
83 } 101 }
84 } 102 }
85 103
104 public override void AddRegion(Scene scene)
105 {
106 base.AddRegion(scene);
107 if (m_Enabled)
108 scene.RegisterModuleInterface<IHomeUsersSecurityService>(m_Security);
109 }
110
111 public override void RemoveRegion(Scene scene)
112 {
113 base.AddRegion(scene);
114 if (m_Enabled)
115 scene.UnregisterModuleInterface<IHomeUsersSecurityService>(m_Security);
116 }
117
86 118
87 #endregion 119 #endregion
88 120
@@ -98,13 +130,25 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
98 return true; 130 return true;
99 } 131 }
100 132
101 protected override bool CreateAgent(GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason) 133 protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason)
102 { 134 {
103 reason = string.Empty; 135 reason = string.Empty;
104 if (reg.RegionLocX != finalDestination.RegionLocX && reg.RegionLocY != finalDestination.RegionLocY) 136 if (reg.RegionLocX != finalDestination.RegionLocX || reg.RegionLocY != finalDestination.RegionLocY)
105 { 137 {
106 // this user is going to another grid 138 // this user is going to another grid
107 reg.RegionName = finalDestination.RegionName; 139 reg.RegionName = finalDestination.RegionName;
140 reg.RegionID = finalDestination.RegionID;
141 reg.RegionLocX = finalDestination.RegionLocX;
142 reg.RegionLocY = finalDestination.RegionLocY;
143
144 // Log their session and remote endpoint in the home users security service
145 IHomeUsersSecurityService security = sp.Scene.RequestModuleInterface<IHomeUsersSecurityService>();
146 if (security != null)
147 security.SetEndPoint(sp.ControllingClient.SessionId, sp.ControllingClient.RemoteEndPoint);
148
149 // Log them out of this grid
150 sp.Scene.PresenceService.LogoutAgent(agentCircuit.SessionID, sp.AbsolutePosition, sp.Lookat);
151
108 return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason); 152 return m_GatekeeperConnector.CreateAgent(reg, agentCircuit, teleportFlags, out reason);
109 } 153 }
110 154
@@ -145,6 +189,26 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
145 189
146 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY; 190 Vector3 position = Vector3.UnitY, lookAt = Vector3.UnitY;
147 GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt); 191 GridRegion finalDestination = m_GatekeeperConnector.GetHomeRegion(homeGatekeeper, aCircuit.AgentID, out position, out lookAt);
192 if (finalDestination == null)
193 {
194 client.SendTeleportFailed("Your home region could not be found");
195 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent's home region not found");
196 return;
197 }
198
199 ScenePresence sp = ((Scene)(client.Scene)).GetScenePresence(client.AgentId);
200 if (sp == null)
201 {
202 client.SendTeleportFailed("Internal error");
203 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Agent not found in the scene where it is supposed to be");
204 return;
205 }
206
207 m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: teleporting user {0} {1} home to {2} via {3}:{4}:{5}",
208 aCircuit.firstname, aCircuit.lastname, finalDestination.RegionName, homeGatekeeper.ExternalHostName, homeGatekeeper.HttpPort, homeGatekeeper.RegionName);
209
210 IEventQueue eq = sp.Scene.RequestModuleInterface<IEventQueue>();
211 DoTeleport(sp, homeGatekeeper, finalDestination, position, lookAt, (uint)(Constants.TeleportFlags.SetLastToTarget | Constants.TeleportFlags.ViaHome), eq);
148 } 212 }
149 #endregion 213 #endregion
150 214
@@ -159,6 +223,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
159 region.ExternalHostName = uri.Host; 223 region.ExternalHostName = uri.Host;
160 region.HttpPort = (uint)uri.Port; 224 region.HttpPort = (uint)uri.Port;
161 region.RegionName = string.Empty; 225 region.RegionName = string.Empty;
226 region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0);
162 return region; 227 return region;
163 } 228 }
164 } 229 }
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
index c61198d..0e3739a 100644
--- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
+++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml
@@ -62,7 +62,7 @@
62 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" /> 62 <RegionModule id="InventoryServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory.InventoryServiceInConnectorModule" />
63 <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" /> 63 <RegionModule id="LandServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Land.LandServiceInConnectorModule" />
64 <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \ 64 <RegionModule id="NeighbourServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour.NeighbourServiceInConnectorModule" /> \
65 <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.HypergridServiceInConnectorModule" /> \ 65 <RegionModule id="HypergridServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid.HypergridServiceInConnectorModule" /> \
66 <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \ 66 <RegionModule id="LLLoginServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Login.LLLoginServiceInConnectorModule" /> \
67 <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \ 67 <RegionModule id="SimulationServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation.SimulationServiceInConnectorModule" /> \
68 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \ 68 <RegionModule id="GridInfoServiceInConnectorModule" type="OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid.GridInfoServiceInConnectorModule" /> \
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 6ec0fcf..6e6946c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -40,7 +40,7 @@ using OpenSim.Server.Handlers.Hypergrid;
40using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
41using GridRegion = OpenSim.Services.Interfaces.GridRegion; 41using GridRegion = OpenSim.Services.Interfaces.GridRegion;
42 42
43namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid 43namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
44{ 44{
45 public class HypergridServiceInConnectorModule : ISharedRegionModule 45 public class HypergridServiceInConnectorModule : ISharedRegionModule
46 { 46 {
@@ -119,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid
119 ISimulationService simService = scene.RequestModuleInterface<ISimulationService>(); 119 ISimulationService simService = scene.RequestModuleInterface<ISimulationService>();
120 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); 120 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
121 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args); 121 //ServerUtils.LoadPlugin<HypergridServiceInConnector>("OpenSim.Server.Handlers.dll:HypergridServiceInConnector", args);
122 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
122 } 123 }
123 } 124 }
124 125