From 29f451bf89c31c5431bf1352d35198bd87be23c7 Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:37:08 -0600 Subject: [PATCH 1/6] Invalid comparison (map to bool/int) Check for null and count properly --- .../ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs index 3fdcdf085af..53b3a19edc1 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs @@ -31,7 +31,8 @@ public void DispatchRegionInfo(IOSHttpRequest request, IOSHttpResponse response, return; } - if(map == map.Count < 3) + // Ensure we have a valid map with the expected minimum number of entries + if (map == null || map.Count < 3) { response.StatusCode = (int)HttpStatusCode.BadRequest; return; From b60c745cc06439c8b0b1fe552a39d71d51b8d153 Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:39:54 -0600 Subject: [PATCH 2/6] Fix a bad comparison. Good thing OpenSim doesn't support oblong regions. --- OpenSim/Data/Null/NullRegionData.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Data/Null/NullRegionData.cs b/OpenSim/Data/Null/NullRegionData.cs index 77ae12ff626..4df9a030549 100644 --- a/OpenSim/Data/Null/NullRegionData.cs +++ b/OpenSim/Data/Null/NullRegionData.cs @@ -192,7 +192,7 @@ public List Get(int startX, int startY, int endX, int endY, UUID sco foreach (RegionData r in m_regionData.Values) { if (r.posX + r.sizeX > startX && r.posX <= endX - && r.posY + r.sizeX > startY && r.posY <= endY) + && r.posY + r.sizeY > startY && r.posY <= endY) ret.Add(r); } } From a5d84e3b5160a87091b9d042bb650acda1e21664 Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:41:40 -0600 Subject: [PATCH 3/6] Assuming this should throw being that an exception is being created and all... --- .../Services/Connectors/MapImage/MapImageServicesConnector.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index 1079e101ddd..c8c5d1a79a7 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs @@ -231,9 +231,7 @@ public bool AddMapTile(int x, int y, byte[] jpgData, UUID scopeID, out string re public byte[] GetMapTile(string fileName, UUID scopeID, out string format) { - format = string.Empty; - new Exception("GetMapTile method not Implemented"); - return null; + throw new Exception("GetMapTile method not Implemented"); } } } From de43164b80220197ca6b2027a4d83ffab725702f Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:45:27 -0600 Subject: [PATCH 4/6] ServerReleaseNotesModule.Initialize() returns unless capURL equals "localhost", which is almost certainly unintended. --- .../Linden/Caps/ServerReleaseNotesModule.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/ServerReleaseNotesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/ServerReleaseNotesModule.cs index 56e840b0e00..dfe5cf310bb 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/ServerReleaseNotesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/ServerReleaseNotesModule.cs @@ -67,8 +67,14 @@ public void Initialise(IConfigSource source) return; string capURL = config.GetString("Cap_ServerReleaseNotes", string.Empty); - if (string.IsNullOrEmpty(capURL) || capURL != "localhost") + // If capability not configured or explicitly turned off, leave disabled + if (string.IsNullOrEmpty(capURL) || + capURL.Equals("false", StringComparison.OrdinalIgnoreCase) || + capURL == "0") + { + m_log.DebugFormat("[ServerReleaseNotesModule]: Cap_ServerReleaseNotes not enabled in config"); return; + } config = source.Configs["ServerReleaseNotes"]; if (config == null) @@ -76,16 +82,19 @@ public void Initialise(IConfigSource source) m_ServerReleaseNotesURL = config.GetString("ServerReleaseNotesURL", m_ServerReleaseNotesURL); if (string.IsNullOrEmpty(m_ServerReleaseNotesURL)) + { + m_log.Error("[ServerReleaseNotesModule]: ServerReleaseNotesURL not configured. Cap disabled."); return; + } - Uri dummy; - if(!Uri.TryCreate(m_ServerReleaseNotesURL,UriKind.Absolute, out dummy)) + if (!Uri.IsWellFormedUriString(m_ServerReleaseNotesURL, UriKind.Absolute)) { - m_log.Error("[Cap_ServerReleaseNotes]: Invalid ServerReleaseNotesURL. Cap Disabled"); + m_log.ErrorFormat("[ServerReleaseNotesModule]: Invalid ServerReleaseNotesURL '{0}'. Cap Disabled", m_ServerReleaseNotesURL); return; } m_enabled = true; + m_log.InfoFormat("[ServerReleaseNotesModule]: Enabled. Redirecting ServerReleaseNotes cap to {0}", m_ServerReleaseNotesURL); } public void AddRegion(Scene scene) From e25e783dee04bcd169964170dd980aeee33b02a2 Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:51:16 -0600 Subject: [PATCH 5/6] Same for EstateAccess --- OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs index a77e3fec1d7..8deab623389 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs @@ -65,8 +65,13 @@ public void Initialise(IConfigSource pSource) return; m_capUrl = config.GetString("Cap_EstateAccess", string.Empty); - if (!String.IsNullOrEmpty(m_capUrl) && m_capUrl.Equals("localhost")) + // enable when configured (non-empty and not explicitly false/0) + if (!String.IsNullOrEmpty(m_capUrl) && + !m_capUrl.Equals("false", StringComparison.OrdinalIgnoreCase) && + m_capUrl != "0") + { m_Enabled = true; + } } public void AddRegion(Scene scene) From 52f7f1e432d839d496d85ee75a5e8e373f7dad66 Mon Sep 17 00:00:00 2001 From: cinder Date: Wed, 17 Dec 2025 15:51:42 -0600 Subject: [PATCH 6/6] Harden MapImageServicesConnector a lil bit. --- .../MapImage/MapImageServicesConnector.cs | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index c8c5d1a79a7..6f94f1f63e1 100644 --- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs +++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs @@ -26,21 +26,14 @@ */ using log4net; -using System; -using System.Collections.Generic; -using System.IO; using System.Net; using System.Reflection; using Nini.Config; using OpenSim.Framework; -using OpenSim.Framework.Console; - -using OpenSim.Framework.ServiceAuth; using OpenSim.Server.Base; using OpenSim.Services.Interfaces; using OpenMetaverse; -using OpenMetaverse.StructuredData; namespace OpenSim.Services.Connectors { @@ -105,12 +98,12 @@ public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) } else { + // Do not include SCOPE when it's zero reqString = ServerUtils.BuildQueryString( new Dictionary() { {"X" , x.ToString() }, - {"Y" , y.ToString() }, - { "SCOPE" , scopeID.ToString() }, + {"Y" , y.ToString() } } ); } @@ -118,7 +111,7 @@ public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/map", reqString, 10, null, false); - if (reply.Length > 0) + if (!string.IsNullOrEmpty(reply)) { Dictionary replyData = ServerUtils.ParseXmlResponse(reply); if(replyData.TryGetValue("Result", out object resultobj)) @@ -133,17 +126,17 @@ public bool RemoveMapTile(int x, int y, UUID scopeID, out string reason) return true; else if (res.Equals("failure", StringComparison.InvariantCultureIgnoreCase)) { - reason = replyData["Message"].ToString(); + reason = replyData.TryGetValue("Message", out var value) ? value.ToString() : ""; m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RemoveMapTile failed: {0}", reason); return false; } m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RemoveMapTile unknown result field contents"); return false; } - } - else - { - m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RemoveMapTile reply data does not contain result field"); + else + { + m_log.DebugFormat("[MAP IMAGE CONNECTOR]: RemoveMapTile reply data does not contain result field"); + } } } catch (Exception e) @@ -188,7 +181,7 @@ public bool AddMapTile(int x, int y, byte[] jpgData, UUID scopeID, out string re try { string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/map", reqString, 10, m_Auth, false); - if (reply.Length > 0) + if (!string.IsNullOrEmpty(reply)) { Dictionary replyData = ServerUtils.ParseXmlResponse(reply); if (replyData.TryGetValue("Result", out object resultobj)) @@ -203,7 +196,7 @@ public bool AddMapTile(int x, int y, byte[] jpgData, UUID scopeID, out string re return true; else if (res.Equals("failure", StringComparison.InvariantCultureIgnoreCase)) { - reason = replyData["Message"].ToString(); + reason = replyData.TryGetValue("Message", out var value) ? value.ToString() : ""; m_log.DebugFormat("[MAP IMAGE CONNECTOR]: AddMapTile failed: {0}", reason); return false; }