diff --git a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs index 648c9b6025..66d00516a6 100644 --- a/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs +++ b/OpenSim/Framework/Serialization/External/RegionSettingsSerializer.cs @@ -150,7 +150,7 @@ namespace OpenSim.Framework.Serialization.External settings.TerrainPBR3 = UUID.Parse(xtr.ReadElementContentAsString()); break; case "PBR4": - settings.TerrainPBR3 = UUID.Parse(xtr.ReadElementContentAsString()); + settings.TerrainPBR4 = UUID.Parse(xtr.ReadElementContentAsString()); break; case "ElevationLowSW": settings.Elevation1SW = double.Parse(xtr.ReadElementContentAsString(), Culture.NumberFormatInfo); diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 6927b9e734..2971f61326 100755 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -355,7 +355,7 @@ namespace OpenSim // Sure is not the right place for this but do the job... // Must always be called before (all) / the HTTP servers starting for the Certs creation or renewals. - if(startupConfig.GetBoolean("EnableSelfsignedCertSupport")) + if(startupConfig.GetBoolean("EnableSelfsignedCertSupport", false)) { if(!File.Exists("SSL\\ssl\\"+ startupConfig.GetString("CertFileName") +".p12") || startupConfig.GetBoolean("CertRenewOnStartup")) { diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 55c5bf2781..2cd458ea31 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -541,7 +541,7 @@ namespace OpenSim.Region.CoreModules.World.Estate if (texture.IsZero()) return; - if((remoteClient.ViewerFlags & ViewerFlags.TPBR) != 0) + if(remoteClient is not null && (remoteClient.ViewerFlags & ViewerFlags.TPBR) != 0) { switch (level) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 6a85c90507..93ac79bd12 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -5150,31 +5150,41 @@ namespace OpenSim.Region.Framework.Scenes if (engines.Length == 0) // No engine at all return 0.0f; - float time = 0.0f; - - // get all the scripts in all parts - SceneObjectPart[] parts = m_parts.GetArray(); - List scripts = new(); - for (int i = 0; i < parts.Length; i++) + try { - scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); - } - // extract the UUIDs - HashSet unique = new(); - foreach (TaskInventoryItem script in scripts) - unique.Add(script.ItemID); + float time = 0.0f; - List ids = unique.ToList(); - - // Offer the list of script UUIDs to each engine found and accumulate the time - foreach (IScriptModule e in engines) - { - if (e is not null) + // get all the scripts in all parts + SceneObjectPart[] parts = m_parts.GetArray(); + List scripts = new(); + for (int i = 0; i < parts.Length; i++) { - time += e.GetScriptExecutionTime(ids); + IEntityInventory inv = parts[i].Inventory; + if (inv is not null) + scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); } + + // extract the UUIDs + HashSet unique = new(); + foreach (TaskInventoryItem script in scripts) + unique.Add(script.ItemID); + + List ids = unique.ToList(); + + // Offer the list of script UUIDs to each engine found and accumulate the time + foreach (IScriptModule e in engines) + { + if (e is not null) + { + time += e.GetScriptExecutionTime(ids); + } + } + return time; + } + catch + { + return 0.0f; } - return time; } public bool ScriptsMemory(out int memory) @@ -5184,32 +5194,42 @@ namespace OpenSim.Region.Framework.Scenes if (engines.Length == 0) // No engine at all return false; - // get all the scripts in all parts - SceneObjectPart[] parts = m_parts.GetArray(); - List scripts = new(); - for (int i = 0; i < parts.Length; i++) + try { - scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); - } - - if (scripts.Count == 0) - return false; - - // extract the UUIDs - HashSet unique = new(); - foreach (TaskInventoryItem script in scripts) - unique.Add(script.ItemID); - - List ids = unique.ToList(); - // Offer the list of script UUIDs to each engine found and accumulate the memory - foreach (IScriptModule e in engines) - { - if (e is not null) + // get all the scripts in all parts + SceneObjectPart[] parts = m_parts.GetArray(); + List scripts = new(); + for (int i = 0; i < parts.Length; i++) { - memory += e.GetScriptsMemory(ids); + IEntityInventory inv = parts[i].Inventory; + if(inv is not null) + scripts.AddRange(inv.GetInventoryItems(InventoryType.LSL)); } + + if (scripts.Count == 0) + return false; + + // extract the UUIDs + HashSet unique = new(); + foreach (TaskInventoryItem script in scripts) + unique.Add(script.ItemID); + + List ids = unique.ToList(); + // Offer the list of script UUIDs to each engine found and accumulate the memory + foreach (IScriptModule e in engines) + { + if (e is not null) + { + memory += e.GetScriptsMemory(ids); + } + } + return true; } - return true; + catch + { + return false; + } + } /// diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 4b1142820f..ba442275b0 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice //private static readonly string m_chatSessionRequestPath = "0209/"; // Control info - private static bool m_Enabled = false; + private static bool m_Enabled = false; // FreeSwitch server is going to contact us and ask us all // sorts of things. @@ -111,8 +111,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice try { - string serviceDll = m_Config.GetString("LocalServiceModule", - String.Empty); + string serviceDll = m_Config.GetString("LocalServiceModule", String.Empty); if (serviceDll.Length == 0) { @@ -325,6 +324,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_log.DebugFormat( "[FreeSwitchVoice][PROVISIONVOICE]: ProvisionVoiceAccountRequest() request for {0}", agentID.ToString()); + Stream inputStream = request.InputStream; + if (inputStream.Length > 0) + { + OSD tmp = OSDParser.DeserializeLLSDXml(inputStream); + request.InputStream.Dispose(); + + if (tmp is OSDMap map) + { + if (map.TryGetValue("voice_server_type", out OSD vstosd)) + { + if (vstosd is OSDString vst && !((string)vst).Equals("vivox", StringComparison.OrdinalIgnoreCase)) + { + response.RawBuffer = Util.UTF8.GetBytes(""); + return; + } + } + } + } + response.StatusCode = (int)HttpStatusCode.OK; ScenePresence avatar = scene.GetScenePresence(agentID); diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index e9ccaa50d8..258db57118 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -459,6 +459,25 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice response.StatusCode = (int)HttpStatusCode.OK; try { + Stream inputStream = request.InputStream; + if (inputStream.Length > 0) + { + OSD tmp = OSDParser.DeserializeLLSDXml(inputStream); + request.InputStream.Dispose(); + + if (tmp is OSDMap map) + { + if (map.TryGetValue("voice_server_type", out OSD vstosd)) + { + if (vstosd is OSDString vst && !((string)vst).Equals("vivox", StringComparison.OrdinalIgnoreCase)) + { + response.RawBuffer = Util.UTF8.GetBytes(""); + return; + } + } + } + } + ScenePresence avatar = null; string avatarName = null; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e24a26d7c..1d914d3770 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -13660,7 +13660,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScenePresence presence = World.GetScenePresence(agentID); // we are not interested in child-agents - if (presence.IsChildAgent) + if (presence is null || presence.IsChildAgent) return; presence.ControllingClient.SendClearFollowCamProperties(objectID); diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMain.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMain.cs index 36d62e315a..fcff9ef1bf 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstMain.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstMain.cs @@ -138,7 +138,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine // guards m_DetachQuantum, m_EventQueue, m_EventCounts, m_Running, m_Suspended public Object m_QueueLock = new Object(); - // true iff allowed to accept new events + // true if allowed to accept new events public bool m_Running = true; // queue of events that haven't been acted upon yet diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs index 88969e8fec..105bb44f20 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstRun.cs @@ -396,10 +396,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine e = StartEventHandler(evc, evt.Params); } //m_RunOnePhase = "done running"; - m_CPUTime += DateTime.UtcNow.Subtract(now).TotalMilliseconds; + m_CPUTime += Util.GetTimeStampMS() - m_SliceStart; - // Maybe it puqued. - if(e is not null) + // Maybe it puqued. + if (e is not null) { //m_RunOnePhase = "handling exception " + e.Message; HandleScriptException(e); diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs index 402f853a34..368dc36660 100755 --- a/OpenSim/Server/Base/ServicesServerBase.cs +++ b/OpenSim/Server/Base/ServicesServerBase.cs @@ -134,7 +134,7 @@ namespace OpenSim.Server.Base prompt = startupConfig.GetString("Prompt", prompt); - if(startupConfig.GetBoolean("EnableRobustSelfsignedCertSupport")) + if(startupConfig.GetBoolean("EnableRobustSelfsignedCertSupport", false)) { if(!File.Exists("SSL\\ssl\\"+ startupConfig.GetString("RobustCertFileName") +".p12") || startupConfig.GetBoolean("RobustCertRenewOnStartup")) { diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 9f226fd993..4f49f1f46d 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -311,30 +311,32 @@ ;; SSL selfsigned certificate settings. - ;; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. - ;# {EnbleSelfsignedCertSupport} {} {Enable selfsigned certificate creation and renew} {true false} false - EnableSelfsignedCertSupport = false - - ;; Is free... so why not :). Renew the selfsigned certificate on every server startup ? - ;# {CertRenewOnStartup} {} {renew the selfsigned certificate on the server startup} {true false} true - CertRenewOnStartup = true - - ;; Certificate options: - ;; Set the certificate file name. the output files extensions are CertFileName.p12 and CertFileName.pfx. - ;# {CertFileName} {} {set the certificate file name} {} "OpenSim" - CertFileName = "OpenSim" - - ;; Set the certificate password. - ;# {CertPassword} {} {set the certificate password} {} "" - CertPassword = "mycertpass" - - ;; The certificate host name (domain or IP of this machine CN). Must be the same as "ExternalHostName" in Regions.ini - ;# {CertHostName} {} {set the certificate host name} {} "myRegionsExternalHostName" - CertHostName = "myRegionsExternalHostName" - - ;; The certificate host IP (IP of this machine). - ;# {CertHostIp} {} {set the certificate host IP} {} - CertHostIp = "127.0.0.1" + ;; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. + ;; Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. + ;;Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. + ;# {EnbleSelfsignedCertSupport} {} {Enable selfsigned certificate creation and renew} {true false} false + EnableSelfsignedCertSupport = false + + ;; Renew the selfsigned certificate on every server startup ? + ;# {CertRenewOnStartup} {} {renew the selfsigned certificate on the server startup} {true false} true + CertRenewOnStartup = false + + ;; Certificate options: + ;; Set the certificate file name. the output files extensions are CertFileName.p12 and CertFileName.pfx. + ;# {CertFileName} {} {set the certificate file name} {} "OpenSim" + CertFileName = "OpenSim" + + ;; Set the certificate password. + ;# {CertPassword} {} {set the certificate password} {} "" + CertPassword = "mycertpass" + + ;; The certificate host name (domain or IP of this machine CN). Must be the same as "ExternalHostName" in Regions.ini + ;# {CertHostName} {} {set the certificate host name} {} "myRegionsExternalHostName" + CertHostName = "myRegionsExternalHostName" + + ;; The certificate host IP (IP of this machine). + ;# {CertHostIp} {} {set the certificate host IP} {} + CertHostIp = "127.0.0.1" ;; SSL certificate validation options diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 559f0dc678..57c20cd414 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -404,24 +404,26 @@ ; # SSL selfsigned certificate settings. ; # - ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. - EnableSelfsignedCertSupport = false - - ; Is free... so why not :). Renew the selfsigned certificate on every server startup ? - CertRenewOnStartup = true - - ; # Certificate options: - ; Set the certificate file name. the output files extensions are CertFileName.p12 and CertFileName.pfx. - CertFileName = "OpenSim" - - ; Set the certificate password. - CertPassword = "mycertpass" - - ; The certificate host name (domain or IP of this machine CN). Must be the same as "ExternalHostName" in Regions.ini - CertHostName = "myRegionsExternalHostName" - - ; The certificate host IP (IP of this machine). - CertHostIp = "127.0.0.1" + ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. + ; Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. + ; Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. + EnableSelfsignedCertSupport = false + + ;Renew the selfsigned certificate on every server startup ? + CertRenewOnStartup = false + + ; # Certificate options: + ; Set the certificate file name. the output files extensions are CertFileName.p12 and CertFileName.pfx. + CertFileName = "OpenSim" + + ; Set the certificate password. + CertPassword = "mycertpass" + + ; The certificate host name (domain or IP of this machine CN). Must be the same as "ExternalHostName" in Regions.ini + CertHostName = "myRegionsExternalHostName" + + ; The certificate host IP (IP of this machine). + CertHostIp = "127.0.0.1" ; # ; # SSL certificates validation options diff --git a/bin/Robust.HG.ini.example b/bin/Robust.HG.ini.example index 2b7fa6aefe..bd78316da6 100644 --- a/bin/Robust.HG.ini.example +++ b/bin/Robust.HG.ini.example @@ -80,30 +80,32 @@ ; ConsoleHistoryTimeStamp = false ;; SSL selfsigned certificate settings. - ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. - EnableRobustSelfsignedCertSupport = false - - ; Is free... so why not :). Renew the selfsigned certificate on every server startup ? - RobustCertRenewOnStartup = true - - ;; Certificate options: - ; Set the certificate file name. the output files extensions are CertFileName.p12 and RobustCertFileName.pfx. This must be different than CertFileName in OpenSim.ini - RobustCertFileName = "Robust" - - ; Set the certificate password. - RobustCertPassword = "mycertpass" - - ; The certificate host name (CN). - RobustCertHostName = ${Const|BaseHostname} - - ; The certificate host IP. - RobustCertHostIp = "127.0.0.1" - + ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. + ; Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. + ; Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. + EnableRobustSelfsignedCertSupport = false + + ;Renew the selfsigned certificate on every server startup ? + RobustCertRenewOnStartup = false + + ;; Certificate options: + ; Set the certificate file name. the output files extensions are CertFileName.p12 and RobustCertFileName.pfx. This must be different than CertFileName in OpenSim.ini + RobustCertFileName = "Robust" + + ; Set the certificate password. + RobustCertPassword = "mycertpass" + + ; The certificate host name (CN). + RobustCertHostName = ${Const|BaseHostname} + + ; The certificate host IP. + RobustCertHostIp = "127.0.0.1" + ; peers SSL certificate validation options ; you can allow selfsigned certificates or no official CA with next option set to true NoVerifyCertChain = true ; you can also bypass the hostname or domain verification - NoVerifyCertHostname = false + NoVerifyCertHostname = true ; having both options true does provide encryption but with low security ; set both true if you don't care to use SSL, they are needed to contact regions or grids that do use it. diff --git a/bin/Robust.ini.example b/bin/Robust.ini.example index 6ddfb7bb22..2e37861c94 100644 --- a/bin/Robust.ini.example +++ b/bin/Robust.ini.example @@ -73,30 +73,32 @@ ; ConsoleHistoryTimeStamp = false ;; SSL selfsigned certificate settings. - ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. - EnableRobustSelfsignedCertSupport = false - - ; Is free... so why not :). Renew the selfsigned certificate on every server startup ? - RobustCertRenewOnStartup = true - - ;; Certificate options: - ; Set the certificate file name. the output files extensions are RobustCertFileName.p12 and RobustCertFileName.pfx. - RobustCertFileName = "Robust" - - ; Set the certificate password. - RobustCertPassword = "mycertpass" - - ; The certificate host name (CN). - RobustCertHostName = ${Const|BaseHostname} - - ; The certificate host IP. - RobustCertHostIp = "127.0.0.1" - + ; Enable selfsigned certificate creation for local and external use. When set to true, will create a folder SSL\ and 2 sub folders SSL\ssl\ and SSL\src\. + ; Next creates and store an RSA private key in SSL\src\ and the derived selfsigned certificate in SSL\ssl\ folder. + ; Is also possible to renew the certificate on every server restart if CertRenewOnStartup is set to true. + EnableRobustSelfsignedCertSupport = false + + ; Renew the selfsigned certificate on every server startup ? + RobustCertRenewOnStartup = false + + ;; Certificate options: + ; Set the certificate file name. the output files extensions are RobustCertFileName.p12 and RobustCertFileName.pfx. + RobustCertFileName = "Robust" + + ; Set the certificate password. + RobustCertPassword = "mycertpass" + + ; The certificate host name (CN). + RobustCertHostName = ${Const|BaseHostname} + + ; The certificate host IP. + RobustCertHostIp = "127.0.0.1" + ; peers SSL certificate validation options ; you can allow selfsigned certificates or no official CA with next option set to true NoVerifyCertChain = true ; you can also bypass the hostname or domain verification - NoVerifyCertHostname = false + NoVerifyCertHostname = true ; having both options true does provide encryption but with low security ; set both true if you don't care to use SSL, they are needed to contact regions or grids that do use it.