Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion OpenSim/Data/Null/NullRegionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public List<RegionData> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion OpenSim/Region/ClientStack/Linden/Caps/EstateAccess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 13 additions & 4 deletions OpenSim/Region/ClientStack/Linden/Caps/ServerReleaseNotesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,25 +67,34 @@ 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)
return;

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)
Expand Down
31 changes: 11 additions & 20 deletions OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -105,20 +98,20 @@ 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<string, object>()
{
{"X" , x.ToString() },
{"Y" , y.ToString() },
{ "SCOPE" , scopeID.ToString() },
{"Y" , y.ToString() }
}
);
}

try
{
string reply = SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/map", reqString, 10, null, false);
if (reply.Length > 0)
if (!string.IsNullOrEmpty(reply))
{
Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if(replyData.TryGetValue("Result", out object resultobj))
Expand All @@ -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)
Expand Down Expand Up @@ -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<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
if (replyData.TryGetValue("Result", out object resultobj))
Expand All @@ -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;
}
Expand Down Expand Up @@ -231,9 +224,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");
}
}
}
Loading