aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-08-26 05:29:08 +0100
committerUbitUmarov2015-08-26 05:29:08 +0100
commitce883e9b436a0d63cfe1d5c81f83477a266e727e (patch)
treea8b674cf6fa5e737ea2babaed6fd81eef205afe5
parentchange teleport version number to v0.3, without actually adding the checks (diff)
downloadopensim-SC_OLD-ce883e9b436a0d63cfe1d5c81f83477a266e727e.zip
opensim-SC_OLD-ce883e9b436a0d63cfe1d5c81f83477a266e727e.tar.gz
opensim-SC_OLD-ce883e9b436a0d63cfe1d5c81f83477a266e727e.tar.bz2
opensim-SC_OLD-ce883e9b436a0d63cfe1d5c81f83477a266e727e.tar.xz
add more of the v03 checks and homeURL. Sending side only for now
-rw-r--r--OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs22
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs8
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs16
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs8
-rw-r--r--OpenSim/Services/Interfaces/ISimulationService.cs14
6 files changed, 69 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
index ef9f8df..e3cf43c 100644
--- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs
@@ -750,9 +750,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
750 string version; 750 string version;
751 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 751 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
752 if (!Scene.SimulationService.QueryAccess( 752 if (!Scene.SimulationService.QueryAccess(
753 finalDestination, sp.ControllingClient.AgentId, position, out version, out reason)) 753 finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
754// if (!Scene.SimulationService.QueryAccess(
755// finalDestination, sp.ControllingClient.AgentId, homeURI, true, position, myversion, out version, out reason))
756 { 754 {
757 sp.ControllingClient.SendTeleportFailed(reason); 755 sp.ControllingClient.SendTeleportFailed(reason);
758 756
@@ -1470,8 +1468,12 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1470 } 1468 }
1471 1469
1472 Scene ascene = agent.Scene; 1470 Scene ascene = agent.Scene;
1471 string homeURI = ascene.GetAgentHomeURI(agentID);
1472 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
1473
1473 1474
1474 if (!ascene.SimulationService.QueryAccess(destiny, agentID, position, out version, out reason)) 1475 if (!ascene.SimulationService.QueryAccess(destiny, agentID, homeURI, false, position,
1476 myversion, out version, out reason))
1475 { 1477 {
1476 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0); 1478 m_bannedRegionCache.Add(destinyHandle, agentID, 30.0, 30.0);
1477 return false; 1479 return false;
@@ -1490,6 +1492,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1490 // see that it is actually outside the current region), find the new region that the 1492 // see that it is actually outside the current region), find the new region that the
1491 // point is actually in. 1493 // point is actually in.
1492 // Returns the coordinates and information of the new region or 'null' of it doesn't exist. 1494 // Returns the coordinates and information of the new region or 'null' of it doesn't exist.
1495
1496 // now only works for crossings
1497
1493 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos, 1498 public GridRegion GetDestination(Scene scene, UUID agentID, Vector3 pos,
1494 out string version, out Vector3 newpos, out string failureReason) 1499 out string version, out Vector3 newpos, out string failureReason)
1495 { 1500 {
@@ -1529,8 +1534,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1529 1534
1530 // Check to see if we have access to the target region. 1535 // Check to see if we have access to the target region.
1531 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion); 1536 string myversion = string.Format("{0}/{1}", OutgoingTransferVersionName, MaxOutgoingTransferVersion);
1537 string homeURI = scene.GetAgentHomeURI(agentID);
1532 if (neighbourRegion != null 1538 if (neighbourRegion != null
1533 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, newpos, out version, out failureReason)) 1539 && !scene.SimulationService.QueryAccess(neighbourRegion, agentID, homeURI, false, newpos, myversion, out version, out failureReason))
1534 { 1540 {
1535 // remember banned 1541 // remember banned
1536 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID); 1542 m_bannedRegionCache.Add(neighbourRegion.RegionHandle, agentID);
@@ -1581,7 +1587,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
1581 agent.IsInTransit = false; 1587 agent.IsInTransit = false;
1582 } 1588 }
1583 1589
1584
1585 public ScenePresence CrossAsync(ScenePresence agent, bool isFlying) 1590 public ScenePresence CrossAsync(ScenePresence agent, bool isFlying)
1586 { 1591 {
1587 uint x; 1592 uint x;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
index 361bf34..81990d5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs
@@ -264,7 +264,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
264 return true; 264 return true;
265 } 265 }
266 266
267 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 267 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason)
268 { 268 {
269 reason = "Communications failure"; 269 reason = "Communications failure";
270 version = ServiceVersion; 270 version = ServiceVersion;
@@ -277,7 +277,25 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
277// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", 277// "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate",
278// s.RegionInfo.RegionName, destination.RegionHandle); 278// s.RegionInfo.RegionName, destination.RegionHandle);
279 279
280 return m_scenes[destination.RegionID].QueryAccess(id, position, out reason); 280
281 // not really need on a grid running var regions sims
282
283 uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX;
284
285 float theirVersionNumber = 0f;
286 string[] versionComponents = theirversion.Split(new char[] { '/' });
287 if (versionComponents.Length >= 2)
288 float.TryParse(versionComponents[1], out theirVersionNumber);
289
290 // Var regions here, and the requesting simulator is in an older version.
291 // We will forbide this, because it crashes the viewers
292 if (theirVersionNumber < 0.3f && size > 256)
293 {
294 reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading.";
295 m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber);
296 return false;
297 }
298 return m_scenes[destination.RegionID].QueryAccess(agentID, position, out reason);
281 } 299 }
282 300
283 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess"); 301 //m_log.Debug("[LOCAL COMMS]: region not found for QueryAccess");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
index ab912ed..580109e 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
207 return m_remoteConnector.UpdateAgent(destination, cAgentData); 207 return m_remoteConnector.UpdateAgent(destination, cAgentData);
208 } 208 }
209 209
210 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 210 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason)
211 { 211 {
212 reason = "Communications failure"; 212 reason = "Communications failure";
213 version = "Unknown"; 213 version = "Unknown";
@@ -216,12 +216,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation
216 return false; 216 return false;
217 217
218 // Try local first 218 // Try local first
219 if (m_localBackend.QueryAccess(destination, id, position, out version, out reason)) 219 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason))
220 return true;
220 return true; 221 return true;
221 222
222 // else do the remote thing 223 // else do the remote thing
223 if (!m_localBackend.IsLocalRegion(destination.RegionID)) 224 if (!m_localBackend.IsLocalRegion(destination.RegionID))
224 return m_remoteConnector.QueryAccess(destination, id, position, out version, out reason); 225 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason);
226
225 227
226 return false; 228 return false;
227 } 229 }
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index f912758..76b593a 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Simulation
117 117
118 } 118 }
119 119
120 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID id, UUID regionID) 120 protected virtual void DoQueryAccess(Hashtable request, Hashtable responsedata, UUID agentID, UUID regionID)
121 { 121 {
122 if (m_SimulationService == null) 122 if (m_SimulationService == null)
123 { 123 {
@@ -132,16 +132,28 @@ namespace OpenSim.Server.Handlers.Simulation
132 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]); 132 // m_log.DebugFormat("[AGENT HANDLER]: Received QUERYACCESS with {0}", (string)request["body"]);
133 OSDMap args = Utils.GetOSDMap((string)request["body"]); 133 OSDMap args = Utils.GetOSDMap((string)request["body"]);
134 134
135 bool viaTeleport = true;
136 if (args.ContainsKey("viaTeleport"))
137 viaTeleport = args["viaTeleport"].AsBoolean();
138
135 Vector3 position = Vector3.Zero; 139 Vector3 position = Vector3.Zero;
136 if (args.ContainsKey("position")) 140 if (args.ContainsKey("position"))
137 position = Vector3.Parse(args["position"].AsString()); 141 position = Vector3.Parse(args["position"].AsString());
138 142
143 string agentHomeURI = null;
144 if (args.ContainsKey("agent_home_uri"))
145 agentHomeURI = args["agent_home_uri"].AsString();
146
147 string theirVersion = string.Empty;
148 if (args.ContainsKey("my_version"))
149 theirVersion = args["my_version"].AsString();
150
139 GridRegion destination = new GridRegion(); 151 GridRegion destination = new GridRegion();
140 destination.RegionID = regionID; 152 destination.RegionID = regionID;
141 153
142 string reason; 154 string reason;
143 string version; 155 string version;
144 bool result = m_SimulationService.QueryAccess(destination, id, position, out version, out reason); 156 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason);
145 157
146 responsedata["int_response_code"] = HttpStatusCode.OK; 158 responsedata["int_response_code"] = HttpStatusCode.OK;
147 159
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
index 0e74073..75c5b35 100644
--- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs
@@ -275,7 +275,7 @@ namespace OpenSim.Services.Connectors.Simulation
275 275
276 /// <summary> 276 /// <summary>
277 /// </summary> 277 /// </summary>
278 public bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason) 278 public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string myversion, out string version, out string reason)
279 { 279 {
280 reason = "Failed to contact destination"; 280 reason = "Failed to contact destination";
281 version = "Unknown"; 281 version = "Unknown";
@@ -286,10 +286,14 @@ namespace OpenSim.Services.Connectors.Simulation
286 if (ext == null) return false; 286 if (ext == null) return false;
287 287
288 // Eventually, we want to use a caps url instead of the agentID 288 // Eventually, we want to use a caps url instead of the agentID
289 string uri = destination.ServerURI + AgentPath() + id + "/" + destination.RegionID.ToString() + "/"; 289 string uri = destination.ServerURI + AgentPath() + agentID + "/" + destination.RegionID.ToString() + "/";
290 290
291 OSDMap request = new OSDMap(); 291 OSDMap request = new OSDMap();
292 request.Add("viaTeleport", OSD.FromBoolean(viaTeleport));
292 request.Add("position", OSD.FromString(position.ToString())); 293 request.Add("position", OSD.FromString(position.ToString()));
294 request.Add("my_version", OSD.FromString(myversion));
295 if (agentHomeURI != null)
296 request.Add("agent_home_uri", OSD.FromString(agentHomeURI));
293 297
294 try 298 try
295 { 299 {
diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs
index 1c82b3e..b629177 100644
--- a/OpenSim/Services/Interfaces/ISimulationService.cs
+++ b/OpenSim/Services/Interfaces/ISimulationService.cs
@@ -75,7 +75,19 @@ namespace OpenSim.Services.Interfaces
75 /// <returns></returns> 75 /// <returns></returns>
76 bool UpdateAgent(GridRegion destination, AgentPosition data); 76 bool UpdateAgent(GridRegion destination, AgentPosition data);
77 77
78 bool QueryAccess(GridRegion destination, UUID id, Vector3 position, out string version, out string reason); 78 /// <summary>
79 /// Returns whether a propspective user is allowed to visit the region.
80 /// </summary>
81 /// <param name="destination">Desired destination</param>
82 /// <param name="agentID">The visitor's User ID</param>
83 /// <param name="agentHomeURI">The visitor's Home URI. Will be missing (null) in older OpenSims.</param>
84 /// <param name="viaTeleport">True: via teleport; False: via cross (walking)</param>
85 /// <param name="position">Position in the region</param>
86 /// <param name="sversion">version that the requesting simulator is runing</param>
87 /// <param name="version">version that the target simulator is running</param>
88 /// <param name="reason">[out] Optional error message</param>
89 /// <returns>True: ok; False: not allowed</returns>
90 bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason);
79 91
80 /// <summary> 92 /// <summary>
81 /// Message from receiving region to departing region, telling it got contacted by the client. 93 /// Message from receiving region to departing region, telling it got contacted by the client.