diff options
9 files changed, 57 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 85d26f3..ef2ed4f 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -817,7 +817,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
817 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", | 817 | "[ENTITY TRANSFER MODULE]: UpdateAgent failed on teleport of {0} to {1} from {2}. Keeping avatar in source region.", |
818 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 818 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
819 | 819 | ||
820 | Fail(sp, finalDestination, logout, "Connection between viewer and destination region could not be established."); | 820 | Fail(sp, finalDestination, logout, Util.Md5Hash(currentAgentCircuit.Id0), "Connection between viewer and destination region could not be established."); |
821 | return; | 821 | return; |
822 | } | 822 | } |
823 | 823 | ||
@@ -829,7 +829,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
829 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", | 829 | "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", |
830 | sp.Name, finalDestination.RegionName, sp.Scene.Name); | 830 | sp.Name, finalDestination.RegionName, sp.Scene.Name); |
831 | 831 | ||
832 | CleanupFailedInterRegionTeleport(sp, finalDestination); | 832 | CleanupFailedInterRegionTeleport(sp, Util.Md5Hash(currentAgentCircuit.Id0), finalDestination); |
833 | 833 | ||
834 | return; | 834 | return; |
835 | } | 835 | } |
@@ -873,7 +873,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
873 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", | 873 | "[ENTITY TRANSFER MODULE]: Teleport of {0} to {1} from {2} failed due to no callback from destination region. Returning avatar to source region.", |
874 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); | 874 | sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); |
875 | 875 | ||
876 | Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); | 876 | Fail(sp, finalDestination, logout, Util.Md5Hash(currentAgentCircuit.Id0), "Destination region did not signal teleport completion."); |
877 | 877 | ||
878 | return; | 878 | return; |
879 | } | 879 | } |
@@ -927,7 +927,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
927 | /// <remarks> | 927 | /// <remarks> |
928 | /// <param name='sp'> </param> | 928 | /// <param name='sp'> </param> |
929 | /// <param name='finalDestination'></param> | 929 | /// <param name='finalDestination'></param> |
930 | protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, GridRegion finalDestination) | 930 | protected virtual void CleanupFailedInterRegionTeleport(ScenePresence sp, string auth_token, GridRegion finalDestination) |
931 | { | 931 | { |
932 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); | 932 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.CleaningUp); |
933 | 933 | ||
@@ -938,7 +938,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
938 | 938 | ||
939 | // Finally, kill the agent we just created at the destination. | 939 | // Finally, kill the agent we just created at the destination. |
940 | // XXX: Possibly this should be done asynchronously. | 940 | // XXX: Possibly this should be done asynchronously. |
941 | Scene.SimulationService.CloseAgent(finalDestination, sp.UUID); | 941 | Scene.SimulationService.CloseAgent(finalDestination, sp.UUID, auth_token); |
942 | } | 942 | } |
943 | 943 | ||
944 | /// <summary> | 944 | /// <summary> |
@@ -948,9 +948,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
948 | /// <param name='finalDestination'></param> | 948 | /// <param name='finalDestination'></param> |
949 | /// <param name='logout'></param> | 949 | /// <param name='logout'></param> |
950 | /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param> | 950 | /// <param name='reason'>Human readable reason for teleport failure. Will be sent to client.</param> |
951 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string reason) | 951 | protected virtual void Fail(ScenePresence sp, GridRegion finalDestination, bool logout, string auth_code, string reason) |
952 | { | 952 | { |
953 | CleanupFailedInterRegionTeleport(sp, finalDestination); | 953 | CleanupFailedInterRegionTeleport(sp, auth_code, finalDestination); |
954 | 954 | ||
955 | m_interRegionTeleportFailures.Value++; | 955 | m_interRegionTeleportFailures.Value++; |
956 | 956 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 2dc3d2a..6d5039b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs | |||
@@ -286,7 +286,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
286 | return false; | 286 | return false; |
287 | } | 287 | } |
288 | 288 | ||
289 | public bool CloseAgent(GridRegion destination, UUID id) | 289 | public bool CloseAgent(GridRegion destination, UUID id, string auth_token) |
290 | { | 290 | { |
291 | if (destination == null) | 291 | if (destination == null) |
292 | return false; | 292 | return false; |
@@ -297,7 +297,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
297 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", | 297 | // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", |
298 | // s.RegionInfo.RegionName, destination.RegionHandle); | 298 | // s.RegionInfo.RegionName, destination.RegionHandle); |
299 | 299 | ||
300 | m_scenes[destination.RegionID].IncomingCloseAgent(id, false); | 300 | m_scenes[destination.RegionID].IncomingCloseAgent(id, false, auth_token); |
301 | return true; | 301 | return true; |
302 | } | 302 | } |
303 | 303 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 4aa2d2a..8722b80 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs | |||
@@ -245,18 +245,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation | |||
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | public bool CloseAgent(GridRegion destination, UUID id) | 248 | public bool CloseAgent(GridRegion destination, UUID id, string auth_token) |
249 | { | 249 | { |
250 | if (destination == null) | 250 | if (destination == null) |
251 | return false; | 251 | return false; |
252 | 252 | ||
253 | // Try local first | 253 | // Try local first |
254 | if (m_localBackend.CloseAgent(destination, id)) | 254 | if (m_localBackend.CloseAgent(destination, id, auth_token)) |
255 | return true; | 255 | return true; |
256 | 256 | ||
257 | // else do the remote thing | 257 | // else do the remote thing |
258 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) | 258 | if (!m_localBackend.IsLocalRegion(destination.RegionID)) |
259 | return m_remoteConnector.CloseAgent(destination, id); | 259 | return m_remoteConnector.CloseAgent(destination, id, auth_token); |
260 | 260 | ||
261 | return false; | 261 | return false; |
262 | } | 262 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 54956ee..becea1f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3452,7 +3452,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3452 | regions.Remove(RegionInfo.RegionHandle); | 3452 | regions.Remove(RegionInfo.RegionHandle); |
3453 | 3453 | ||
3454 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. | 3454 | // This ends up being done asynchronously so that a logout isn't held up where there are many present but unresponsive neighbours. |
3455 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3455 | m_sceneGridService.SendCloseChildAgentConnections(agentID, Util.Md5Hash(acd.Id0), regions); |
3456 | } | 3456 | } |
3457 | 3457 | ||
3458 | m_eventManager.TriggerClientClosed(agentID, this); | 3458 | m_eventManager.TriggerClientClosed(agentID, this); |
@@ -4277,6 +4277,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
4277 | 4277 | ||
4278 | return false; | 4278 | return false; |
4279 | } | 4279 | } |
4280 | /// <summary> | ||
4281 | /// Authenticated close (via network) | ||
4282 | /// </summary> | ||
4283 | /// <param name="agentID"></param> | ||
4284 | /// <param name="force"></param> | ||
4285 | /// <param name="auth_token"></param> | ||
4286 | /// <returns></returns> | ||
4287 | public bool IncomingCloseAgent(UUID agentID, bool force, string auth_token) | ||
4288 | { | ||
4289 | //m_log.DebugFormat("[SCENE]: Processing incoming close agent {0} in region {1} with auth_token {2}", agentID, RegionInfo.RegionName, auth_token); | ||
4290 | |||
4291 | // Check that the auth_token is valid | ||
4292 | AgentCircuitData acd = AuthenticateHandler.GetAgentCircuitData(agentID); | ||
4293 | if (acd != null && Util.Md5Hash(acd.Id0) == auth_token) | ||
4294 | return IncomingCloseAgent(agentID, force); | ||
4295 | else | ||
4296 | m_log.ErrorFormat("[SCENE]: Request to close agent {0} with invalid authorization token {1}", agentID, auth_token); | ||
4297 | return false; | ||
4298 | } | ||
4280 | 4299 | ||
4281 | /// <summary> | 4300 | /// <summary> |
4282 | /// Tell a single agent to disconnect from the region. | 4301 | /// Tell a single agent to disconnect from the region. |
@@ -4292,12 +4311,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
4292 | 4311 | ||
4293 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); | 4312 | ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); |
4294 | if (presence != null) | 4313 | if (presence != null) |
4295 | { | ||
4296 | presence.ControllingClient.Close(force); | 4314 | presence.ControllingClient.Close(force); |
4297 | return true; | ||
4298 | } | ||
4299 | 4315 | ||
4300 | // Agent not here | 4316 | // Agent not here |
4301 | return false; | 4317 | return false; |
4302 | } | 4318 | } |
4303 | 4319 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 8238e23..77889fa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -197,7 +197,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | /// <summary> | 197 | /// <summary> |
198 | /// Closes a child agent on a given region | 198 | /// Closes a child agent on a given region |
199 | /// </summary> | 199 | /// </summary> |
200 | protected void SendCloseChildAgent(UUID agentID, ulong regionHandle) | 200 | protected void SendCloseChildAgent(UUID agentID, ulong regionHandle, string auth_token) |
201 | { | 201 | { |
202 | // let's do our best, but there's not much we can do if the neighbour doesn't accept. | 202 | // let's do our best, but there's not much we can do if the neighbour doesn't accept. |
203 | 203 | ||
@@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
210 | m_log.DebugFormat( | 210 | m_log.DebugFormat( |
211 | "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); | 211 | "[SCENE COMMUNICATION SERVICE]: Sending close agent ID {0} to {1}", agentID, destination.RegionName); |
212 | 212 | ||
213 | m_scene.SimulationService.CloseAgent(destination, agentID); | 213 | m_scene.SimulationService.CloseAgent(destination, agentID, auth_token); |
214 | } | 214 | } |
215 | 215 | ||
216 | /// <summary> | 216 | /// <summary> |
@@ -219,14 +219,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
219 | /// </summary> | 219 | /// </summary> |
220 | /// <param name="agentID"></param> | 220 | /// <param name="agentID"></param> |
221 | /// <param name="regionslst"></param> | 221 | /// <param name="regionslst"></param> |
222 | public void SendCloseChildAgentConnections(UUID agentID, List<ulong> regionslst) | 222 | public void SendCloseChildAgentConnections(UUID agentID, string auth_code, List<ulong> regionslst) |
223 | { | 223 | { |
224 | foreach (ulong handle in regionslst) | 224 | foreach (ulong handle in regionslst) |
225 | { | 225 | { |
226 | // We must take a copy here since handle is acts like a reference when used in an iterator. | 226 | // We must take a copy here since handle is acts like a reference when used in an iterator. |
227 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. | 227 | // This leads to race conditions if directly passed to SendCloseChildAgent with more than one neighbour region. |
228 | ulong handleCopy = handle; | 228 | ulong handleCopy = handle; |
229 | Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy); }); | 229 | Util.FireAndForget((o) => { SendCloseChildAgent(agentID, handleCopy, auth_code); }); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 11b15a7..5991a34 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3167,7 +3167,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3167 | { | 3167 | { |
3168 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); | 3168 | m_log.Debug("[SCENE PRESENCE]: Closing " + byebyeRegions.Count + " child agents"); |
3169 | 3169 | ||
3170 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, byebyeRegions); | 3170 | AgentCircuitData acd = Scene.AuthenticateHandler.GetAgentCircuitData(UUID); |
3171 | string auth = string.Empty; | ||
3172 | if (acd != null) | ||
3173 | auth = Util.Md5Hash(acd.Id0); | ||
3174 | m_scene.SceneGridService.SendCloseChildAgentConnections(ControllingClient.AgentId, auth, byebyeRegions); | ||
3171 | } | 3175 | } |
3172 | 3176 | ||
3173 | foreach (ulong handle in byebyeRegions) | 3177 | foreach (ulong handle in byebyeRegions) |
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs index 17a8ef4..cd172e4 100644 --- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs | |||
@@ -27,11 +27,13 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Specialized; | ||
30 | using System.IO; | 31 | using System.IO; |
31 | using System.IO.Compression; | 32 | using System.IO.Compression; |
32 | using System.Reflection; | 33 | using System.Reflection; |
33 | using System.Net; | 34 | using System.Net; |
34 | using System.Text; | 35 | using System.Text; |
36 | using System.Web; | ||
35 | 37 | ||
36 | using OpenSim.Server.Base; | 38 | using OpenSim.Server.Base; |
37 | using OpenSim.Server.Handlers.Base; | 39 | using OpenSim.Server.Handlers.Base; |
@@ -92,7 +94,11 @@ namespace OpenSim.Server.Handlers.Simulation | |||
92 | string method = (string)request["http-method"]; | 94 | string method = (string)request["http-method"]; |
93 | if (method.Equals("DELETE")) | 95 | if (method.Equals("DELETE")) |
94 | { | 96 | { |
95 | DoAgentDelete(request, responsedata, agentID, action, regionID); | 97 | string auth_token = string.Empty; |
98 | if (request.ContainsKey("auth")) | ||
99 | auth_token = request["auth"].ToString(); | ||
100 | |||
101 | DoAgentDelete(request, responsedata, agentID, action, regionID, auth_token); | ||
96 | return responsedata; | 102 | return responsedata; |
97 | } | 103 | } |
98 | else if (method.Equals("QUERYACCESS")) | 104 | else if (method.Equals("QUERYACCESS")) |
@@ -151,9 +157,9 @@ namespace OpenSim.Server.Handlers.Simulation | |||
151 | // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); | 157 | // Console.WriteLine("str_response_string [{0}]", responsedata["str_response_string"]); |
152 | } | 158 | } |
153 | 159 | ||
154 | protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID) | 160 | protected void DoAgentDelete(Hashtable request, Hashtable responsedata, UUID id, string action, UUID regionID, string auth_token) |
155 | { | 161 | { |
156 | m_log.Debug(" >>> DoDelete action:" + action + "; RegionID:" + regionID); | 162 | m_log.DebugFormat("[AGENT HANDLER]: >>> DELETE action: {0}; RegionID: {1}; from: {2}; auth_code: {3}", action, regionID, Util.GetCallerIP(request), auth_token); |
157 | 163 | ||
158 | GridRegion destination = new GridRegion(); | 164 | GridRegion destination = new GridRegion(); |
159 | destination.RegionID = regionID; | 165 | destination.RegionID = regionID; |
@@ -161,12 +167,12 @@ namespace OpenSim.Server.Handlers.Simulation | |||
161 | if (action.Equals("release")) | 167 | if (action.Equals("release")) |
162 | ReleaseAgent(regionID, id); | 168 | ReleaseAgent(regionID, id); |
163 | else | 169 | else |
164 | Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id); }); | 170 | Util.FireAndForget(delegate { m_SimulationService.CloseAgent(destination, id, auth_token); }); |
165 | 171 | ||
166 | responsedata["int_response_code"] = HttpStatusCode.OK; | 172 | responsedata["int_response_code"] = HttpStatusCode.OK; |
167 | responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); | 173 | responsedata["str_response_string"] = "OpenSim agent " + id.ToString(); |
168 | 174 | ||
169 | m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); | 175 | //m_log.DebugFormat("[AGENT HANDLER]: Agent {0} Released/Deleted from region {1}", id, regionID); |
170 | } | 176 | } |
171 | 177 | ||
172 | protected virtual void ReleaseAgent(UUID regionID, UUID id) | 178 | protected virtual void ReleaseAgent(UUID regionID, UUID id) |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 7eb8c24..aca414b 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs | |||
@@ -367,11 +367,10 @@ namespace OpenSim.Services.Connectors.Simulation | |||
367 | 367 | ||
368 | /// <summary> | 368 | /// <summary> |
369 | /// </summary> | 369 | /// </summary> |
370 | public bool CloseAgent(GridRegion destination, UUID id) | 370 | public bool CloseAgent(GridRegion destination, UUID id, string auth_code) |
371 | { | 371 | { |
372 | // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent start"); | 372 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/?auth=" + auth_code; |
373 | 373 | m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CloseAgent {0}", uri); | |
374 | string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; | ||
375 | 374 | ||
376 | try | 375 | try |
377 | { | 376 | { |
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index c9cbd1a..1c82b3e 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs | |||
@@ -93,7 +93,7 @@ namespace OpenSim.Services.Interfaces | |||
93 | /// <param name="regionHandle"></param> | 93 | /// <param name="regionHandle"></param> |
94 | /// <param name="id"></param> | 94 | /// <param name="id"></param> |
95 | /// <returns></returns> | 95 | /// <returns></returns> |
96 | bool CloseAgent(GridRegion destination, UUID id); | 96 | bool CloseAgent(GridRegion destination, UUID id, string auth_token); |
97 | 97 | ||
98 | #endregion Agents | 98 | #endregion Agents |
99 | 99 | ||