aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
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/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs
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 '')
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs69
1 files changed, 67 insertions, 2 deletions
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 }