From fe779128b0c50f44cf479444444754298d829910 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Fri, 6 Jun 2014 11:04:53 -0700 Subject: Added simulation version compatibility check so that agents coming from 0.7.6 to a varregion running in 0.8 and above will be denied teleport, rather than be allowed and crash the viewer. --- .../Simulation/LocalSimulationConnector.cs | 26 +++++++++++++++++++--- .../Simulation/RemoteSimulationConnector.cs | 6 ++--- 2 files changed, 26 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index 926ef05..e6de0b6 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -52,6 +52,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation /// Currently valid versions are "SIMULATION/0.1" and "SIMULATION/0.2" /// public string ServiceVersion { get; set; } + private float m_VersionNumber = 0.3f; /// /// Map region ID to scene. @@ -84,15 +85,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation public void InitialiseService(IConfigSource configSource) { - ServiceVersion = "SIMULATION/0.2"; + ServiceVersion = "SIMULATION/0.3"; IConfig config = configSource.Configs["SimulationService"]; if (config != null) { ServiceVersion = config.GetString("ConnectorProtocolVersion", ServiceVersion); - if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2") + if (ServiceVersion != "SIMULATION/0.1" && ServiceVersion != "SIMULATION/0.2" && ServiceVersion != "SIMULATION/0.3") throw new Exception(string.Format("Invalid ConnectorProtocolVersion {0}", ServiceVersion)); + string[] versionComponents = ServiceVersion.Split(new char[] { '/' }); + if (versionComponents.Length >= 2) + float.TryParse(versionComponents[1], out m_VersionNumber); + m_log.InfoFormat( "[LOCAL SIMULATION CONNECTOR]: Initialized with connector protocol version {0}", ServiceVersion); } @@ -264,7 +269,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return true; } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string theirversion, out string version, out string reason) { reason = "Communications failure"; version = ServiceVersion; @@ -276,6 +281,21 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // m_log.DebugFormat( // "[LOCAL SIMULATION CONNECTOR]: Found region {0} {1} to send AgentUpdate", // s.RegionInfo.RegionName, destination.RegionHandle); + uint size = m_scenes[destination.RegionID].RegionInfo.RegionSizeX; + + float theirVersionNumber = 0f; + string[] versionComponents = theirversion.Split(new char[] { '/' }); + if (versionComponents.Length >= 2) + float.TryParse(versionComponents[1], out theirVersionNumber); + + // Var regions here, and the requesting simulator is in an older version. + // We will forbide this, because it crashes the viewers + if (theirVersionNumber < 0.3f && size > 256) + { + reason = "Destination is a variable-sized region, and source is an old simulator. Consider upgrading."; + m_log.DebugFormat("[LOCAL SIMULATION CONNECTOR]: Request to access this variable-sized region from {0} simulator was denied", theirVersionNumber); + return false; + } return m_scenes[destination.RegionID].QueryAccess(agentID, agentHomeURI, viaTeleport, position, out reason); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index 0444e49..6ecc327 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 return m_remoteConnector.UpdateAgent(destination, cAgentData); } - public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, out string version, out string reason) + public bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, string sversion, out string version, out string reason) { reason = "Communications failure"; version = "Unknown"; @@ -216,12 +216,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation return false; // Try local first - if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason)) + if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason)) return true; // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionID)) - return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, out version, out reason); + return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, sversion, out version, out reason); return false; } -- cgit v1.1