Compare commits

...

27 Commits

Author SHA1 Message Date
UbitUmarov
effb5784c1 a few changes on assets store and exists return 2026-06-19 22:47:12 +01:00
UbitUmarov
7130e30483 increase asset store web timeout to 30s again 2026-06-19 21:39:58 +01:00
UbitUmarov
ecdcaca032 cosmetics 2026-06-19 01:41:02 +01:00
UbitUmarov
2720a1db36 change the rebakes throotle code 2026-06-16 21:56:11 +01:00
UbitUmarov
60a32d28e4 add AddOrUpdate to ExpiringKey 2026-06-16 21:41:15 +01:00
Ubit Umarov
8a95a4dfe0 Merge pull request #41 from holoneon/patch-3
Update AvatarFactoryModule.cs
2026-06-16 20:54:32 +01:00
UbitUmarov
282db7dd1e update libomv 2026-06-16 19:09:47 +01:00
Fiona Sweet
dae81f7bf5 Update AvatarFactoryModule.cs
in logs i have noticed thousands of 'rebake' requests happening extremely rapidly from a few hg visitors, (for example yesterday 2400 from one hg visitor in 3 minutes) a potential denial of service vector. this adds throttling limit 1 per 30 seconds.  please review
2026-06-15 12:53:52 -07:00
UbitUmarov
29889f481a cosmetics 2026-06-12 12:12:24 +01:00
Vincent Sylvester
2494f23538 Postgres fixes for uuid type handling
Signed-off-by: UbitUmarov <ajlduarte@sapo.pt>
2026-06-12 11:35:40 +01:00
Ubit Umarov
cf8778f50f Merge pull request #36 from Tampa/webrtc-fix
Fix response for vivox server type under webrtc
2026-06-06 15:17:17 +01:00
Vincent Sylvester
a61b946563 Do not respond to vivox under webrtc 2026-06-04 23:48:20 +02:00
UbitUmarov
93ebb36904 cosmetics 2026-06-04 11:36:33 +01:00
Ubit Umarov
6a679f7cfa Merge pull request #35 from AdilElFarissi/master
Bug fixes and cosmetics
2026-06-04 11:03:34 +01:00
Adil El Farissi
9c2cc2d1af Bug fix and cosmetics
Fix: UserAgentServiceConnector return null if the destination is under TLS/SSL.
Refractor: DataSnapshot to use http> UnSecureInstance as @UbitUmarov recommaded. Personally, i prefer it to be under HTTPS as well.
2026-06-04 00:41:25 +00:00
Adil El Farissi
ad1d137c2e Merge branch 'master' of https://github.com/AdilElFarissi/opensim 2026-06-03 23:07:23 +00:00
UbitUmarov
9afd9e9e74 increase default SensorMaxResults to 32 2026-06-01 09:34:38 +01:00
UbitUmarov
c2569335b6 update libomv 2026-05-17 05:37:17 +01:00
UbitUmarov
94e887b9f7 update libomv fixing a silly typo 2026-05-14 03:12:09 +01:00
Adil El Farissi
d88947e07a Merge branch 'opensim:master' into master 2025-06-25 21:40:57 +00:00
Adil El Farissi
dfb3aed36a Merge branch 'opensim:master' into master 2025-06-10 22:28:02 +00:00
Adil El Farissi
fc75ae0011 Merge branch 'opensim:master' into master 2025-01-15 14:07:44 +00:00
Adil El Farissi
82842f26cc Merge branch 'opensim:master' into master 2025-01-02 16:56:39 +00:00
Adil El Farissi
e306a1c1de Merge branch 'opensim:master' into master 2024-10-23 01:31:28 +00:00
Adil El Farissi
a4b5986271 Merge branch 'opensim:master' into master 2024-10-10 01:02:56 +00:00
Adil El Farissi
dfd03c01ff Merge branch 'opensim:master' into master 2024-10-08 22:54:06 +00:00
Adil El Farissi
3c1ecad319 Fix to make datanapshot follows the configuration of the base server for the SSL Support
may be needed by web interfaces...
2024-10-08 22:45:19 +00:00
38 changed files with 214 additions and 198 deletions

View File

@@ -417,7 +417,7 @@ namespace osWebRtcVoice
m_log.Warn($"{LogHeader}[ProvisionVoice]: Request detail: {map}");
response.RawBuffer = llsdUndefAnswerBytes;
response.StatusCode = (int)HttpStatusCode.OK;
response.StatusCode = 0;
return;
}
}

View File

@@ -253,7 +253,7 @@ namespace OpenSim.Data.MySQL
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -401,7 +401,7 @@ namespace OpenSim.Data.MySQL
public bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exists = new HashSet<UUID>();

View File

@@ -239,7 +239,7 @@ namespace OpenSim.Data.PGSQL
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -352,12 +352,12 @@ namespace OpenSim.Data.PGSQL
//Insert after
cmd.CommandText = "insert into estateban (\"EstateID\", \"bannedUUID\",\"bannedIp\", \"bannedIpHostMask\", \"bannedNameMask\", \"banningUUID\",\"banTime\" ) values ( :EstateID, :bannedUUID, '','','', :banningUUID, :banTime )";
cmd.Parameters.AddWithValue("bannedUUID", Guid.Empty);
foreach (EstateBan b in es.EstateBans)
{
cmd.Parameters.Clear();
cmd.Parameters["EstateID"].Value = b.EstateID;
cmd.Parameters["bannedUUID"].Value = b.BannedUserID.Guid;
cmd.Parameters["banningUUID"].Value = b.BanningUserID.Guid;
cmd.Parameters["bannedUUID"].Value = _Database.CreateParameter("bannedUUID", b.BannedUserID).Value;
cmd.Parameters["banningUUID"].Value = _Database.CreateParameter("banningUUID", b.BanningUserID).Value;
cmd.Parameters["banTime"].Value = b.BanTime;
cmd.ExecuteNonQuery();
@@ -378,10 +378,10 @@ namespace OpenSim.Data.PGSQL
cmd.ExecuteNonQuery();
cmd.CommandText = string.Format("insert into {0} (\"EstateID\", uuid) values ( :EstateID, :uuid )", table);
cmd.Parameters.AddWithValue("uuid", Guid.Empty);
foreach (UUID uuid in data)
{
cmd.Parameters["uuid"].Value = uuid.Guid; //.ToString(); //TODO check if this works
cmd.Parameters.Clear();
cmd.Parameters.Add(_Database.CreateParameter("uuid", uuid));
cmd.ExecuteNonQuery();
}
}

View File

@@ -134,10 +134,13 @@ namespace OpenSim.Data.PGSQL
foreach (DataRow row in schemaTable.Rows)
{
if (row["ColumnName"] != null &&
(!m_Fields.ContainsKey(row["ColumnName"].ToString())))
m_ColumnNames.Add(row["ColumnName"].ToString());
if (row["ColumnName"] == null)
continue;
string col = row["ColumnName"].ToString();
if (!m_Fields.ContainsKey(col))
m_ColumnNames.Add(col);
}
}

View File

@@ -171,7 +171,7 @@ namespace OpenSim.Data.PGSQL
{
// cmd.CommandText = String.Format(@"select * from inventoryitems where ""avatarID"" = :uuid and ""assetType"" = :type and ""flags"" = 1", m_Realm);
cmd.CommandText = "select * from inventoryitems where avatarID = :uuid and assetType = :type and flags = 1";
cmd.CommandText = "select * from inventoryitems where \"avatarID\" = :uuid and \"assetType\" = :type and \"flags\" = 1";
cmd.Parameters.Add(m_database.CreateParameter("uuid", principalID));
cmd.Parameters.Add(m_database.CreateParameter("type", (int)AssetType.Gesture));

View File

@@ -147,7 +147,8 @@ namespace OpenSim.Data.SQLite
}
//m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString());
if (AssetsExist(new[] { asset.FullID })[0])
bool[] assetsExist = AssetsExist([ asset.FullID ]);
if (assetsExist.Length > 0 && assetsExist[0])
{
//LogAssetLoad(asset);
@@ -218,7 +219,7 @@ namespace OpenSim.Data.SQLite
public override bool[] AssetsExist(UUID[] uuids)
{
if (uuids.Length == 0)
return new bool[0];
return [];
HashSet<UUID> exist = new HashSet<UUID>();

View File

@@ -916,18 +916,17 @@ namespace OpenSim.Framework
{
// Wearables
OSD tmpOSD8;
OSDArray wears8 = null;
int wears8Count = 0;
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray))
if (data.TryGetValue("wrbls8", out tmpOSD8) && (tmpOSD8 is OSDArray wears8))
{
wears8 = (OSDArray)tmpOSD8;
wears8Count = wears8.Count;
}
else
wears8 = null;
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray))
if (data.TryGetValue("wearables", out tmpOSD) && (tmpOSD is OSDArray wears))
{
OSDArray wears = (OSDArray)tmpOSD;
if(wears.Count + wears8Count > 0)
{
m_wearables = new AvatarWearable[wears.Count + wears8Count];
@@ -948,9 +947,8 @@ namespace OpenSim.Framework
Primitive.TextureEntry te = new Primitive.TextureEntry(teb, 0, teb.Length);
m_texture = te;
}
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray))
else if (data.TryGetValue("textures", out tmpOSD) && (tmpOSD is OSDArray textures))
{
OSDArray textures = (OSDArray)tmpOSD;
for (int i = 0; i < textures.Count && i < TEXTURE_COUNT_PV7; ++i)
{
tmpOSD = textures[i];
@@ -959,26 +957,12 @@ namespace OpenSim.Framework
}
}
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray))
if (data.TryGetValue("bakedcache", out tmpOSD) && (tmpOSD is OSDArray bakedOSDArray))
{
OSDArray bakedOSDArray = (OSDArray)tmpOSD;
m_cacheitems = WearableCacheItem.GetDefaultCacheItem();
bakedOSDArray = (OSDArray)tmpOSD;
foreach (OSDMap item in bakedOSDArray)
foreach (OSD oitem in bakedOSDArray)
{
int idx = item["textureindex"].AsInteger();
if (idx < 0 || idx >= m_cacheitems.Length)
continue;
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
m_cacheitems[idx].TextureAsset = null;
}
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
{
bakedOSDArray = (OSDArray)tmpOSD;
foreach (OSDMap item in bakedOSDArray)
if(oitem is OSDMap item)
{
int idx = item["textureindex"].AsInteger();
if (idx < 0 || idx >= m_cacheitems.Length)
@@ -988,6 +972,22 @@ namespace OpenSim.Framework
m_cacheitems[idx].TextureAsset = null;
}
}
if (data.TryGetValue("bc8", out tmpOSD) && (tmpOSD is OSDArray))
{
foreach (OSD oitem in bakedOSDArray)
{
if(oitem is OSDMap item)
{
int idx = item["textureindex"].AsInteger();
if (idx < 0 || idx >= m_cacheitems.Length)
continue;
m_cacheitems[idx].CacheId = item["cacheid"].AsUUID();
m_cacheitems[idx].TextureID = item["textureid"].AsUUID();
m_cacheitems[idx].TextureAsset = null;
}
}
}
}
// Visual Parameters
@@ -1002,9 +1002,8 @@ namespace OpenSim.Framework
}
// Attachments
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray)
if (data.TryGetValue("attachments", out tmpOSD) && tmpOSD is OSDArray attachs)
{
OSDArray attachs = (OSDArray)tmpOSD;
for (int i = 0; i < attachs.Count; i++)
{
AvatarAttachment att = new AvatarAttachment((OSDMap)attachs[i]);

View File

@@ -28,6 +28,7 @@ using System;
using System.Threading;
using System.Collections.Generic;
using Timer = System.Threading.Timer ;
using System.Runtime.InteropServices;
namespace OpenSim.Framework
{
@@ -168,6 +169,28 @@ namespace OpenSim.Framework
finally { m_rwLock.ExitWriteLock(); }
}
public bool AddOrUpdate(Tkey1 key, int expireMS)
{
int now;
if (expireMS > 0)
{
expireMS = (expireMS > m_expire) ? expireMS : m_expire;
now = (int)(Util.GetTimeStampMS() - m_startTS) + expireMS;
}
else
now = int.MinValue;
m_rwLock.EnterWriteLock();
try
{
ref int entry = ref CollectionsMarshal.GetValueRefOrAddDefault(m_dictionary, key, out bool exists);
entry = now;
CheckTimer();
return exists;
}
finally { m_rwLock.ExitWriteLock(); }
}
public bool Remove(Tkey1 key)
{
m_rwLock.EnterWriteLock();

View File

@@ -81,8 +81,7 @@ namespace OpenSim.Framework
public Lazy(Func<T> valueFactory, LazyThreadSafetyMode mode)
{
if (valueFactory == null)
throw new ArgumentNullException("valueFactory");
ArgumentNullException.ThrowIfNull(valueFactory);
this.factory = valueFactory;
if (mode != LazyThreadSafetyMode.None)
monitor = new object();

View File

@@ -212,6 +212,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
set { m_certificateValidationCallback = value; }
}
private static readonly char[] LineSeparators = ['\n','\r'];
private void load_cert(string CPath, string CPass)
{
@@ -223,13 +224,13 @@ namespace OpenSim.Framework.Servers.HttpServer
{
AsnEncodedData asndata = new AsnEncodedData(ext.Oid, ext.RawData);
string datastr = asndata.Format(true);
string[] lines = datastr.Split(new char[] {'\n','\r'});
string[] lines = datastr.Split(LineSeparators);
foreach(string s in lines)
{
if(String.IsNullOrEmpty(s))
if(string.IsNullOrEmpty(s))
continue;
string[] parts = s.Split(new char[] {'='});
if(String.IsNullOrEmpty(parts[0]))
string[] parts = s.Split('=');
if(string.IsNullOrEmpty(parts[0]))
continue;
string entryName = parts[0].Replace(" ","");
if(entryName == "DNSName")
@@ -1015,8 +1016,7 @@ namespace OpenSim.Framework.Servers.HttpServer
}
finally
{
if (innerStream != null)
innerStream.Dispose();
innerStream?.Dispose();
inputStream.Dispose();
}
}

View File

@@ -22,7 +22,7 @@ namespace OSHttpServer
public RequestCookie(string id, string content)
{
if (string.IsNullOrEmpty(id)) throw new ArgumentNullException("id");
if (content == null) throw new ArgumentNullException("content");
ArgumentNullException.ThrowIfNull(content);
_name = id;
_value = content;

View File

@@ -79,8 +79,10 @@ namespace OpenSim.Framework.Servers.HttpServer
using (MemoryStream buffer = new MemoryStream())
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;
XmlWriterSettings settings = new()
{
Encoding = Encoding.UTF8
};
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
{
@@ -134,8 +136,7 @@ namespace OpenSim.Framework.Servers.HttpServer
using (MemoryStream buffer = new MemoryStream())
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;
XmlWriterSettings settings = new() { Encoding = Encoding.UTF8 };
using (XmlWriter writer = XmlWriter.Create(buffer, settings))
{
@@ -169,8 +170,7 @@ namespace OpenSim.Framework.Servers.HttpServer
// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
deserial = (TResponse)deserializer.Deserialize(stream);
if (stream != null)
stream.Close();
stream?.Close();
if (deserial != null && ResponseCallback != null)
{

View File

@@ -1009,8 +1009,7 @@ namespace OpenSim.Framework
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);
if (auth != null)
auth.AddAuthorization(request.Headers);
auth?.AddAuthorization(request.Headers);
request.AllowWriteStreamBuffering = false;

View File

@@ -1535,10 +1535,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
catch (Exception ex)
{
m_log.Error($"Packet statistics gathering failed: {ex.Message}");
if (PacketLog.Log != null)
{
PacketLog.Log.Close();
}
PacketLog?.Log?.Close();
PacketLog = null;
}
}

View File

@@ -226,8 +226,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// Pass the new values up to the parent
if (m_parent != null)
m_parent.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
m_parent?.RegisterRequest(this, Math.Min(RequestedDripRate, TotalDripRequest));
}
/// <summary>
@@ -246,8 +245,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// Pass the new values up to the parent
if (Parent != null)
Parent.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
Parent?.RegisterRequest(this,Math.Min(RequestedDripRate, TotalDripRequest));
}
/// <summary>
@@ -351,8 +349,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
m_dripRate = Math.Clamp(value, m_minimumFlow, MaxDripRate);
if (m_parent != null)
m_parent.RegisterRequest(this, m_dripRate);
m_parent?.RegisterRequest(this, m_dripRate);
}
}
@@ -371,8 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_dripRate = m_maxDripRate * .5f;
else
m_dripRate = m_maxDripRate;
if (m_parent != null)
m_parent.RegisterRequest(this, m_dripRate);
m_parent?.RegisterRequest(this, m_dripRate);
}
/// <summary>
@@ -392,7 +388,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void AcknowledgePackets(Int32 count)
{
if (m_enabled)
AdjustedDripRate = AdjustedDripRate + count;
AdjustedDripRate += count;
}
}
}

View File

@@ -67,6 +67,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
private object m_setAppearanceLock = new object();
// add throttle
private const int REBAKE_THROTTLE_SECONDS = 30;
readonly ExpiringKey<string> m_rebakeThrottle = new(500 * REBAKE_THROTTLE_SECONDS);
#region Region Module interface
public void Initialise(IConfigSource config)
@@ -451,10 +455,21 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
sp.Appearance.WearableCacheItems = wearableCache;
// throttle rebake requests
if (missing.Count > 0)
{
string spuuidstr = sp.UUID.ToString();
foreach (UUID id in missing)
{
string key = spuuidstr + id.ToString();
if(m_rebakeThrottle.AddOrUpdate(key, 1000 * REBAKE_THROTTLE_SECONDS))
continue;
m_log.Debug($"[AVFACTORY]: Missing baked texture {id} for {sp.Name}, requesting rebake");
sp.ControllingClient.SendRebakeAvatarTextures(id);
}
}
bool changed = false;

View File

@@ -115,28 +115,39 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
// This is it! Let's ask the other world
if (words[0].Contains("."))
if (words[0].Contains('.'))
{
string[] names = words[0].Split(Util.SplitDotArray);
if (names.Length >= 2)
{
string uriStr = "http://" + words[1];
ReadOnlySpan<char> words1lower = words[1].ToLower();
string uriStr = string.Concat("http://", words1lower);
// Let's check that the last name is a valid address
try
if(!Uri.TryCreate(uriStr, UriKind.Absolute, out _))
{
new Uri(uriStr);
}
catch (UriFormatException)
{
m_log.DebugFormat("[USER MANAGEMENT MODULE]: Malformed address {0}", uriStr);
m_log.Debug($"[USER MANAGEMENT MODULE]: Malformed address {words1lower}");
return;
}
UUID userID = UUID.Zero;
uriStr = uriStr.ToLower();
if(!WebUtil.GlobalExpiringBadURLs.ContainsKey(uriStr))
{
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
UserAgentServiceConnector uasConn = new(uriStr);
// If fail to connect with http... try with https...
if (uasConn is null)
{
string SSLuriStr = string.Concat("https://", words1lower); // words[1] already validated
uasConn = new UserAgentServiceConnector(SSLuriStr);
if (uasConn is null)
{
m_log.Debug($"[USER MANAGEMENT MODULE]: UserAgentServiceConnector failed to connect to {words1lower}");
return;
}
uriStr = SSLuriStr;
}
try
{
userID = uasConn.GetUUID(names[0], names[1]);
@@ -147,18 +158,20 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
}
}
if (!userID.Equals(UUID.Zero))
if (userID.IsNotZero())
{
UserData ud = new UserData();
ud.Id = userID;
ud.FirstName = words[0];
ud.LastName = "@" + words[1];
UserData ud = new()
{
Id = userID,
FirstName = words[0],
LastName = "@" + words[1]
};
users.Add(ud);
AddUser(userID, names[0], names[1], uriStr);
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} found", words[0], words[1]);
m_log.Debug($"[USER MANAGEMENT MODULE]: User {words[0]}@{words[1]} found");
}
else
m_log.DebugFormat("[USER MANAGEMENT MODULE]: User {0}@{1} not found", words[0], words[1]);
m_log.Debug($"[USER MANAGEMENT MODULE]: User {words[0]}@{words[1]} not found");
}
}
}

View File

@@ -314,8 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
public string Store(AssetBase asset)
{
if (m_Cache != null)
m_Cache.Cache(asset);
m_Cache?.Cache(asset);
if (asset.Local)
{

View File

@@ -512,7 +512,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return m_localConnector.AssetsExist(ids);
else if (m_HGConnector != null)
return m_HGConnector.AssetsExist(ids);
return null;
return [];
}
public string Store(AssetBase asset)
@@ -524,12 +524,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
return null;
id = StoreForeign(asset);
if (m_Cache != null)
{
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
m_Cache.Cache(asset);
if (!string.IsNullOrEmpty(id) && !id.Equals(UUID.ZeroString))
{
m_Cache?.Cache(asset);
return id;
}
return id;
else
return string.Empty;
}
if (m_Cache != null)
@@ -541,10 +542,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
id = StoreLocal(asset);
if (string.IsNullOrEmpty(id))
return string.Empty;
return id;
return string.IsNullOrEmpty(id) || id.Equals(UUID.ZeroString) ? string.Empty : id;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.AggressiveInlining)]

View File

@@ -2117,7 +2117,7 @@ namespace OpenSim.Region.CoreModules.World.Land
{
// if you do a "About Landmark" on a landmark a second time, the viewer sends the
// region_handle it got earlier via RegionHandleRequest
ulong regionHandle = Util.BytesToUInt64Big((byte[])tmp);
ulong regionHandle = tmp.AsULong();
if(regionHandle == myHandle)
{
ILandObject l = GetLandObjectClippedXY(x, y);

View File

@@ -105,11 +105,9 @@ namespace OpenSim.Region.CoreModules
}
// Check for desired plugin
if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
if (m_availableWindPlugins.TryGetValue(m_dWindPluginName, out m_activeWindPlugin))
{
m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
if (m_windConfig != null)
{

View File

@@ -451,7 +451,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
assetStrings[k], existChecks[k] ? "yes" : "no");
sb.Append(cdt.ToString());
sb.Append("\n");
sb.Append('\n');
}
}
else

View File

@@ -123,8 +123,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (!m_Enabled)
return;
if(m_odeScene != null)
m_odeScene.RegionLoaded();
m_odeScene?.RegionLoaded();
}
#endregion

View File

@@ -75,8 +75,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
private bool doConvexPrims = true;
private bool doConvexSculpts = true;
private readonly Dictionary<AMeshKey, Mesh> m_uniqueMeshes = new();
private readonly Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = new ();
private readonly Dictionary<AMeshKey, Mesh> m_uniqueMeshes = [];
private readonly Dictionary<AMeshKey, Mesh> m_uniqueReleasedMeshes = [];
#region INonSharedRegionModule
public string Name
@@ -173,7 +173,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
/// <param name="size">Size of entire object</param>
/// <param name="coords"></param>
/// <param name="faces"></param>
private unsafe void AddSubMesh(OSDMap subMeshData, List<Vector3> coords, List<Face> faces)
private unsafe void AddSubMesh(OSDMap subMeshData, List<Vector3> coords, List<Face> faces)
{
// Console.WriteLine("subMeshMap for {0} - {1}", primName, Util.GetFormattedXml((OSD)subMeshMap));
@@ -209,7 +209,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
int faceIndexOffset = coords.Count;
fixed (byte* ptrstart = posBytes)
{
{
byte* end = ptrstart + posBytes.Length;
byte* ptr = ptrstart;
while (ptr < end)
@@ -1331,8 +1331,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing
}
finally
{
if(stream != null)
stream.Dispose();
stream?.Dispose();
}
if (!ok && File.Exists(filename))

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
m_CmdManager = CmdManager;
maximumRange = CmdManager.m_ScriptEngine.Config.GetFloat("SensorMaxRange", 96.0f);
maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 16);
maximumToReturn = CmdManager.m_ScriptEngine.Config.GetInt("SensorMaxResults", 32);
m_npcModule = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<INPCModule>();
}
@@ -96,7 +96,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
private const int SCRIPTED = 8;
private readonly float maximumRange = 96.0f;
private readonly int maximumToReturn = 16;
private readonly int maximumToReturn = 32;
//
// Sensed entity

View File

@@ -43,6 +43,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
namespace OpenSim.Server.Handlers.Hypergrid
{
@@ -80,13 +81,13 @@ namespace OpenSim.Server.Handlers.Hypergrid
try
{
Dictionary<string, object> request =
ServerUtils.ParseQueryString(body);
Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
object tmpObj;
if (!request.TryGetValue("METHOD", out tmpObj))
return FailureResult();
string method = request["METHOD"].ToString();
string method = tmpObj.ToString();
switch (method)
{
@@ -140,19 +141,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
if (!VerifyServiceKey(request))
return FailureResult();
UUID principalID = UUID.Zero;
if (request.ContainsKey("PRINCIPALID"))
UUID.TryParse(request["PRINCIPALID"].ToString(), out principalID);
else
object tmpObj;
if (!request.TryGetValue("PRINCIPALID", out tmpObj) || !UUID.TryParse(tmpObj.ToString(), out UUID principalID))
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no principalID in request to get friend perms");
return FailureResult();
}
UUID friendID = UUID.Zero;
if (request.ContainsKey("FRIENDID"))
UUID.TryParse(request["FRIENDID"].ToString(), out friendID);
else
if (!request.TryGetValue("FRIENDID", out tmpObj) || !UUID.TryParse(tmpObj.ToString(), out UUID friendID))
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no friendID in request to get friend perms");
return FailureResult();
@@ -181,14 +177,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
byte[] DeleteFriendship(Dictionary<string, object> request)
{
FriendInfo friend = new FriendInfo(request);
string secret = string.Empty;
if (request.ContainsKey("SECRET"))
secret = request["SECRET"].ToString();
if (request.TryGetValue("SECRET", out object tmpObj) || tmpObj is null)
return BoolResult(false);
string secret = tmpObj.ToString();
if (secret.Length == 0)
return BoolResult(false);
FriendInfo friend = new FriendInfo(request);
bool success = m_TheService.DeleteFriendship(friend, secret);
return BoolResult(success);
@@ -196,27 +192,15 @@ namespace OpenSim.Server.Handlers.Hypergrid
byte[] FriendshipOffered(Dictionary<string, object> request)
{
UUID fromID = UUID.Zero;
UUID toID = UUID.Zero;
string message = string.Empty;
string name = string.Empty;
if (!request.ContainsKey("FromID") || !request.ContainsKey("ToID"))
if (!request.TryGetValue("FromID", out object FromIDobj) || !UUID.TryParse(FromIDobj.ToString(), out UUID fromID))
return BoolResult(false);
if (!request.TryGetValue("ToID", out object ToIDobj) || !UUID.TryParse(ToIDobj.ToString(), out UUID toID))
return BoolResult(false);
if (!UUID.TryParse(request["ToID"].ToString(), out toID))
return BoolResult(false);
message = request["Message"].ToString();
if (!UUID.TryParse(request["FromID"].ToString(), out fromID))
return BoolResult(false);
if (request.ContainsKey("FromName"))
name = request["FromName"].ToString();
string name = request.TryGetValue("FromName", out object FromNameobj) ? FromNameobj.ToString() : string.Empty;
string message = request.TryGetValue("Message", out object Messageobj) ? Messageobj.ToString() : string.Empty;
bool success = m_TheService.FriendshipOffered(fromID, name, toID, message);
return BoolResult(success);
}
@@ -234,9 +218,10 @@ namespace OpenSim.Server.Handlers.Hypergrid
byte[] StatusNotification(Dictionary<string, object> request)
{
object tmpObj;
UUID principalID = UUID.Zero;
if (request.ContainsKey("userID"))
UUID.TryParse(request["userID"].ToString(), out principalID);
if (request.TryGetValue("userID", out tmpObj))
UUID.TryParse(tmpObj.ToString(), out principalID);
else
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no userID in request to notify");
@@ -244,8 +229,8 @@ namespace OpenSim.Server.Handlers.Hypergrid
}
bool online = true;
if (request.ContainsKey("online"))
Boolean.TryParse(request["online"].ToString(), out online);
if (request.TryGetValue("online", out tmpObj))
bool.TryParse(tmpObj.ToString(), out online);
else
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: no online in request to notify");
@@ -266,7 +251,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
List<UUID> onlineFriends = m_TheService.StatusNotification(friends, principalID, online);
Dictionary<string, object> result = new Dictionary<string, object>();
if ((onlineFriends == null) || ((onlineFriends != null) && (onlineFriends.Count == 0)))
if (onlineFriends == null || onlineFriends.Count == 0)
result["RESULT"] = "NULL";
else
{
@@ -290,20 +275,14 @@ namespace OpenSim.Server.Handlers.Hypergrid
private bool VerifyServiceKey(Dictionary<string, object> request)
{
if (!request.ContainsKey("KEY") || !request.ContainsKey("SESSIONID"))
if (!request.TryGetValue("KEY", out object KEYobj) || KEYobj is not string serviceKey || serviceKey.Length == 0 ||
!request.TryGetValue("SESSIONID", out object SESSIONIDobj) || SESSIONIDobj is not string sessionStr)
{
m_log.WarnFormat("[HGFRIENDS HANDLER]: ignoring request without Key or SessionID");
return false;
}
if (request["KEY"] == null || request["SESSIONID"] == null)
return false;
string serviceKey = request["KEY"].ToString();
string sessionStr = request["SESSIONID"].ToString();
UUID sessionID;
if (!UUID.TryParse(sessionStr, out sessionID) || serviceKey.Length == 0)
if (!UUID.TryParse(sessionStr, out UUID sessionID))
return false;
if (!m_UserAgentService.VerifyAgent(sessionID, serviceKey))
@@ -325,8 +304,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
doc.AppendChild(xmlnode);
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
"");
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
doc.AppendChild(rootElement);
@@ -342,8 +320,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
XmlDocument doc = new XmlDocument();
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
"", "");
XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration, "", "");
doc.AppendChild(xmlnode);
@@ -380,8 +357,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
doc.AppendChild(xmlnode);
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
"");
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
doc.AppendChild(rootElement);
@@ -407,8 +383,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
doc.AppendChild(xmlnode);
XmlElement rootElement = doc.CreateElement("", "ServerResponse",
"");
XmlElement rootElement = doc.CreateElement("", "ServerResponse", "");
doc.AppendChild(rootElement);

View File

@@ -61,8 +61,7 @@ namespace OpenSim.Services.AssetService
if (assetConfig == null)
throw new Exception("No " + m_ConfigName + " configuration");
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
String.Empty);
string loaderArgs = assetConfig.GetString("AssetLoaderArgs", string.Empty);
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
@@ -92,11 +91,8 @@ namespace OpenSim.Services.AssetService
public virtual AssetBase Get(string id)
{
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
UUID assetID;
if (!UUID.TryParse(id, out assetID))
// m_log.DebugFormat("[ASSET SERVICE]: Get asset for {0}", id);
if (!UUID.TryParse(id, out UUID assetID))
{
m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested asset id {0}", id);
return null;
@@ -172,15 +168,13 @@ namespace OpenSim.Services.AssetService
public virtual string Store(AssetBase asset)
{
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
if (!exists)
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
if (assetsexist.Length == 0 || !assetsexist[0])
{
// m_log.DebugFormat(
// "[ASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
if (!m_Database.StoreAsset(asset))
{
return UUID.Zero.ToString();
}
return UUID.Zero.ToString();
}
// else
// {

View File

@@ -187,9 +187,8 @@ namespace OpenSim.Services.AssetService
public virtual string Store(AssetBase asset)
{
bool exists = m_Database.AssetsExist(new[] { asset.FullID })[0];
if (!exists)
{
bool[] assetsexist = m_Database.AssetsExist([ asset.FullID ] );
if (assetsexist.Length == 0 || !assetsexist[0]) {
// m_log.DebugFormat(
// "[XASSET SERVICE]: Storing asset {0} {1}, bytes {2}", asset.Name, asset.FullID, asset.Data.Length);
m_Database.StoreAsset(asset);

View File

@@ -359,7 +359,7 @@ namespace OpenSim.Services.Connectors
string newID;
try
{
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 10000, m_Auth);
newID = SynchronousRestObjectRequester.MakeRequest<AssetBase, string>("POST", uri, asset, 30000, m_Auth);
}
catch
{

View File

@@ -78,7 +78,7 @@ namespace OpenSim.Services.HypergridService
if (configName != String.Empty)
m_ConfigName = configName;
Object[] args = new Object[] { config };
Object[] args = [ config ];
IConfig serverConfig = config.Configs[m_ConfigName];
if (serverConfig == null)
@@ -309,29 +309,39 @@ namespace OpenSim.Services.HypergridService
// But now we need to confirm that the requester is who he says he is
// before we act on the friendship request.
if (!fromName.Contains("@"))
if (!fromName.Contains('@'))
return;
string[] parts = fromName.Split(new char[] {'@'});
if (parts.Length != 2)
return;
string uriStr = "http://" + parts[1];
try
{
new Uri(uriStr);
}
catch (UriFormatException)
string uriStr = "http://" + parts[1].ToLower();
string SSLuriStr = "https://" + parts[1].ToLower();
if(!Uri.TryCreate(uriStr, UriKind.Absolute, out _))
{
m_log.DebugFormat("[HGFRIENDS SERVICE]: Malformed address {0}", parts[1].ToLower());
return;
}
UserAgentServiceConnector uasConn = new UserAgentServiceConnector(uriStr);
UserAgentServiceConnector uasConn = new(uriStr);
// If fail to connect with http... try with https...
if (uasConn is null)
{
uasConn = new UserAgentServiceConnector(SSLuriStr);
if (uasConn is null)
{
m_log.DebugFormat("[HGFRIENDS SERVICE]: UserAgentServiceConnector failed to connect to {0}", parts[1].ToLower());
return;
}
uriStr = SSLuriStr;
}
Dictionary<string, object> servers = uasConn.GetServerURLs(fromID);
if (!servers.ContainsKey("FriendsServerURI"))
if (!servers.TryGetValue("FriendsServerURI", out object friendsServerURI))
return;
HGFriendsServicesConnector friendsConn = new HGFriendsServicesConnector(servers["FriendsServerURI"].ToString());
HGFriendsServicesConnector friendsConn = new(friendsServerURI.ToString());
if (!friendsConn.ValidateFriendshipOffered(fromID, toID))
{
m_log.WarnFormat("[HGFRIENDS SERVICE]: Friendship request from {0} to {1} is invalid. Impersonations?", fromID, toID);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.