From 7ec07954aab3d01f48ac6befe028f84975725d4e Mon Sep 17 00:00:00 2001 From: Christopher Latza Date: Wed, 3 Jun 2020 17:23:31 +0200 Subject: [PATCH] add patches --- Changelog.md | 84 ++++++ ...s-similar-to-experience-data-storage.patch | 273 ++++++++++++++++++ Patch/0001-AuthorizationService.patch | 55 ++++ Patch/0001-add-auto_grant_pay_perms.patch | 28 ++ ...01-add-osGetDataValue-osSetDataValue.patch | 273 ++++++++++++++++++ Patch/0001-change-version-info.patch | 25 ++ ...e-all-script-returns-for-HG-home-uri.patch | 119 ++++++++ Patch/0001-remove-iar-pass-check.patch | 30 ++ Patch/AuthorizationService.cs | 256 ++++++++++++++++ README.md | 2 - 10 files changed, 1143 insertions(+), 2 deletions(-) create mode 100644 Changelog.md create mode 100644 Patch/0001-Add-os-commands-similar-to-experience-data-storage.patch create mode 100644 Patch/0001-AuthorizationService.patch create mode 100644 Patch/0001-add-auto_grant_pay_perms.patch create mode 100644 Patch/0001-add-osGetDataValue-osSetDataValue.patch create mode 100644 Patch/0001-change-version-info.patch create mode 100644 Patch/0001-fake-all-script-returns-for-HG-home-uri.patch create mode 100644 Patch/0001-remove-iar-pass-check.patch create mode 100644 Patch/AuthorizationService.cs delete mode 100644 README.md diff --git a/Changelog.md b/Changelog.md new file mode 100644 index 0000000..96815bc --- /dev/null +++ b/Changelog.md @@ -0,0 +1,84 @@ +# Änderung an der OpenSimulator Version + +Es gibt einige Optionen, die sich von der Vanilla Version unterscheiden. Die meisten Änderungen sind Erleichterungen. Es gibt aber auch einige neue Funktionen. In der Regel sollte keiner dieser Änderungen offensichtlich in den normalen Betrieb eingreifen. Da diese aber doch einige Eigenheiten haben die bekannt sein sollten, hier eine Übersicht in chronologischer Reihenfolge der Einführung. + + +### Version Name +Die Software hat eine Extra Versionsnummer bekommen: OpenSim 0.9.2.0.**05** Yeti Dev +Je höher um so aktueller. Dies hat nichts mit der Vanilla OpenSim Version zu tun. + +### CachedMapImageModule + +- Speichert das Map Image im OpenSim Ortner in einem Unterordner um es während dem Regionstart nicht immer neu Generieren zu müssen. +- Es wird erst nach einem Monat neu generiert. Dies spart einiges an Zeit und RAM während dem Startvorgang. + - Es kann auch die Region Position und Region Namen auf das Bild schreiben. + - Es gibt einige Einstellungen, um dies zu steuern. Diese müssen in den [Map] Bereich. + - **enableDate** == true/false | Zeigt das Datum der Generierung an. + - **enableName** == true/false | Zeigt den Namen der Region an. + - **enablePosition** == true/false | Zeigt die Position im Grid auf dem MapImage an. + - **RefreshEveryMonth** == true/false | Schaltet das Neugenerieren an/aus. + - **enableHostedBy** == true/false | Zeigt einen weiteren Text an. + - **HosterText** == ".." | Der Text der angezeigt werden soll. + +### JPEG Converter Module + + - Dies erlaubt Texturen und Dynamisch generierte Texturen als Bild auf Websiten einzubinden. + - Dynamisch generierte Texturen gehen nur auf der Region wo sie generiert wurden. + - Es muss die Asset UUID benutzt werden. + - Host und Port sind von der Region. + - URL zu den Daten: http://os.inc.li:7000/jpeg/?assetID=1345d1d3-a717-4590-9010-2a2efef84379 + +### Disable AfK Physic + + - Deaktiviert die *physisch* Eigenschaft von allen Objekten, wenn niemand auf der Region ist. + - Verhindert einen Großen CPU verbrauch von Regionen, die nicht in Benutzung sind. + - Physikalische Crasher werden so außer Gefecht gesetzt. + +### FullPerm + + - Setzt alle aufgestellten Objekte auf der Region auf FullPerm. + - Beinflust **nicht** wie sich leute die Objekte nehmen können. Es muss weiterhin einzeln freigegeben werden ob sich leute die Objekte Kaufen oder Kopieren dürfen. + - So ist es nicht mehr nötig sich Änderungsrechte oder ähnliches mit dem GodMode zu verschaffen. (Man hat eine Ausrede warum es fullPerm ist :D) + - Objekte der Gruppe zu übertragen funktioniert so ohne Probleme. + - Jeder mit entsprechenden Rechten in der Gruppe kann die Objekte bearbeiten. + +### Skript Funktionen +#### DataValue +Diese Funktionen ermöglicht es Daten dauerhaft zu speichern. +- Dies funktioniert auf der ganzen Region und unabhängig von Objekt/Eigentümer/Script. +- Um eine gewisse Datensicherheit zu ermöglichen ist es nur möglich Daten zu teilen oder zu schreiben, wenn die Objekte dieselbe Gruppe haben. (Wenn das Objekt eine andere Gruppe bekommt, sind die Daten nicht mehr verfügar!) +- Der Datenbestand wird nicht auf den Speicherverbrauch des Skriptes aufgerechnet. +- Ein Scriptreset hat keine Auswirkungen auf den Datenbestand. +- Die Daten werden auf dem Datenträger gespeichert. (Ordner DataScriptValue) und können dort auch ausgelesen und verändert werden. +- Mehrere Regionen können die Daten nutzen. + - Der Ordner wo die Daten gespeichert werden, kann in der OpenSim.ini unter [XEngine] Verändert werden. + - **DataValueStorageDirectory** = "C:/.." + + +```csharp + //Namespace == Der Speicherbereich der Gruppe. + string osGetDataValue(string key); //Gibt Daten aus dem aktiven Namespace aus. + void osSetDataValue(string key, string value); //Fügt Daten in den aktiven Namespace. + bool osCheckDataValue(string key); //Prüft ob Daten für diesen Key im aktiven Namespace vorhanden sind. + string osGetDataValue(string key, bool personal); //Gibt Daten aus dem Namespace des Besitzers aus. + void osDeleteDataValue(string key); //Löscht die Daten dieses Keys im aktiven Namespace. + void osDeleteDataValue(string key, bool personal); //Löscht die Daten dieses Keys im Namespace des Besitzers. + string osSetDataValue(string key, string value, bool personal); //Fügt Daten in dem Namespace des Besitzers ein. + bool osCheckDataValue(string key, bool personal); //Prüft ob Daten für diesen Key im Namespace des Besitzers vorhanden sind. +``` +```csharp +default +{ + state_entry() + { + osSetDataValue("test", "es funktioniert"); + } + + touch_start(integer i) + { + llOwnerSay(osGetDataValue("test")); + } +} +``` + + diff --git a/Patch/0001-Add-os-commands-similar-to-experience-data-storage.patch b/Patch/0001-Add-os-commands-similar-to-experience-data-storage.patch new file mode 100644 index 0000000..9ca991d --- /dev/null +++ b/Patch/0001-Add-os-commands-similar-to-experience-data-storage.patch @@ -0,0 +1,273 @@ +From 37f47683b3416d05c04d68e9898c19a95f3d4e8f Mon Sep 17 00:00:00 2001 +From: Christopher +Date: Wed, 27 May 2020 15:28:23 +0200 +Subject: [PATCH] Add os commands similar to experience data storage Add + similar os commands to llReadKeyValue llCreateKeyValue llDeleteKeyValue == + osGetDataValue osSetDataValue osDeleteDataValue and osCheckDataValue + +--- + .../Shared/Api/Implementation/OSSL_Api.cs | 149 ++++++++++++++++++ + .../Shared/Api/Interface/IOSSL_Api.cs | 10 ++ + .../Shared/Api/Runtime/OSSL_Stub.cs | 40 +++++ + bin/config-include/osslDefaultEnable.ini | 4 + + 4 files changed, 203 insertions(+) + +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +index 8289dec2e7..197fde3a01 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +@@ -42,8 +42,10 @@ using System; + using System.Collections; + using System.Collections.Concurrent; + using System.Collections.Generic; ++using System.IO; + using System.Reflection; + using System.Runtime.Remoting.Lifetime; ++using System.Security.Cryptography; + using System.Text; + using System.Text.RegularExpressions; + using System.Threading; +@@ -948,6 +950,153 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + return false; + } + ++ public string osGetDataValue(string key) ++ { ++ return osGetDataValue(key, false); ++ } ++ ++ public string osGetDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osGetDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if(personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ return File.ReadAllText(file.FullName); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ ++ return ""; ++ } ++ ++ public void osSetDataValue(string key, string value) ++ { ++ osSetDataValue(key, value, false); ++ } ++ ++ public void osSetDataValue(string key, string value, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osSetDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ File.WriteAllText(file.FullName, value); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ } ++ ++ public void osDeleteDataValue(string key) ++ { ++ osDeleteDataValue(key, false); ++ } ++ ++ public void osDeleteDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osDeleteDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ file.Delete(); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ } ++ ++ public bool osCheckDataValue(string key) ++ { ++ return osCheckDataValue(key, false); ++ } ++ ++ public bool osCheckDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osCheckDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ return true; ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ ++ return false; ++ } ++ + public void osSetPrimFloatOnWater(int floatYN) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +index e9aeda5f28..93dbc64366 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +@@ -142,6 +142,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces + void osRegionNotice(string msg); + void osRegionNotice(LSL_Key agentID, string msg); + bool osConsoleCommand(string Command); ++ ++ string osGetDataValue(string key); ++ string osGetDataValue(string key, bool persoanl); ++ void osSetDataValue(string key, string value); ++ void osSetDataValue(string key, string value, bool personal); ++ void osDeleteDataValue(string key); ++ void osDeleteDataValue(string key, bool personal); ++ bool osCheckDataValue(string key); ++ bool osCheckDataValue(string key, bool personal); ++ + void osSetParcelMediaURL(string url); + void osSetPrimFloatOnWater(int floatYN); + void osSetParcelSIPAddress(string SIPAddress); +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +index 4bae45e392..55e911c6ae 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +@@ -235,6 +235,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase + return m_OSSL_Functions.osConsoleCommand(Command); + } + ++ public string osGetDataValue(string key) ++ { ++ return m_OSSL_Functions.osGetDataValue(key); ++ } ++ ++ public string osGetDataValue(string key, bool personal) ++ { ++ return m_OSSL_Functions.osGetDataValue(key, personal); ++ } ++ ++ public void osSetDataValue(string key, string value) ++ { ++ m_OSSL_Functions.osSetDataValue(key, value); ++ } ++ ++ public void osSetDataValue(string key, string value, bool personal) ++ { ++ m_OSSL_Functions.osSetDataValue(key, value, personal); ++ } ++ ++ public void osDeleteDataValue(string key) ++ { ++ m_OSSL_Functions.osDeleteDataValue(key); ++ } ++ ++ public void osDeleteDataValue(string key, bool personal) ++ { ++ m_OSSL_Functions.osDeleteDataValue(key, personal); ++ } ++ ++ public bool osCheckDataValue(string key) ++ { ++ return m_OSSL_Functions.osCheckDataValue(key); ++ } ++ ++ public bool osCheckDataValue(string key, bool personal) ++ { ++ return m_OSSL_Functions.osCheckDataValue(key, personal); ++ } ++ + public void osSetParcelMediaURL(string url) + { + m_OSSL_Functions.osSetParcelMediaURL(url); +diff --git a/bin/config-include/osslDefaultEnable.ini b/bin/config-include/osslDefaultEnable.ini +index e66577dbcf..72885d9d30 100644 +--- a/bin/config-include/osslDefaultEnable.ini ++++ b/bin/config-include/osslDefaultEnable.ini +@@ -146,6 +146,10 @@ + Allow_osSetOwnerSpeed = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osRequestURL = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osRequestSecureURL = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osGetDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osSetDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osDeleteDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osCheckDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + + ; ThreatLevel High + Allow_osCauseDamage = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER +-- +2.25.1.windows.1 + diff --git a/Patch/0001-AuthorizationService.patch b/Patch/0001-AuthorizationService.patch new file mode 100644 index 0000000..972972f --- /dev/null +++ b/Patch/0001-AuthorizationService.patch @@ -0,0 +1,55 @@ +From e815c63252863c846fafbf2520d3328a66e19235 Mon Sep 17 00:00:00 2001 +From: Christopher +Date: Tue, 27 Feb 2018 18:15:09 +0100 +Subject: [PATCH] add whitelist to AuthService + +--- + OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +index 93dff1f..a76067b 100644 +--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs ++++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Authorization/AuthorizationService.cs +@@ -106,6 +106,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization + + UUID userID = new UUID(user); + ++ if (m_Scene.Permissions.IsGod(userID)) ++ { ++ message = "Authorized"; ++ return true; ++ } ++ ++ EstateSettings estate = m_Scene.RegionInfo.EstateSettings; ++ ++ if (estate != null) ++ { ++ if (estate.IsEstateManagerOrOwner(userID)) ++ { ++ message = "Authorized"; ++ return true; ++ } ++ ++ if(estate.EstateAccess.Contains(userID)) ++ { ++ message = "Authorized"; ++ return true; ++ } ++ } ++ ++ foreach(ILandObject _parcel in m_Scene.LandChannel.AllParcels()) ++ { ++ if(_parcel.IsInLandAccessList(userID)) ++ { ++ message = "Authorized"; ++ return true; ++ } ++ } ++ + if ((m_accessValue & AccessFlags.DisallowForeigners) != 0) + { + if (!m_UserManagement.IsLocalGridUser(userID)) +-- +libgit2 0.26.0 + diff --git a/Patch/0001-add-auto_grant_pay_perms.patch b/Patch/0001-add-auto_grant_pay_perms.patch new file mode 100644 index 0000000..d7551ae --- /dev/null +++ b/Patch/0001-add-auto_grant_pay_perms.patch @@ -0,0 +1,28 @@ +From 722e158ff7065186b65952e5068ed1026bd8aedc Mon Sep 17 00:00:00 2001 +From: Christopher Latza +Date: Mon, 1 Jun 2020 21:22:51 +0200 +Subject: [PATCH] add auto_grant_pay_perms + +--- + .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +index f45a8b1607..05ebc81317 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +@@ -4310,6 +4310,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + } + } + ++ if (World.GetExtraSetting("auto_grant_pay_perms") == "true") ++ { ++ implicitPerms = implicitPerms | ScriptBaseClass.PERMISSION_DEBIT; ++ } ++ + if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms + { + m_host.TaskInventory.LockItemsForWrite(true); +-- +2.25.1.windows.1 + diff --git a/Patch/0001-add-osGetDataValue-osSetDataValue.patch b/Patch/0001-add-osGetDataValue-osSetDataValue.patch new file mode 100644 index 0000000..9ca991d --- /dev/null +++ b/Patch/0001-add-osGetDataValue-osSetDataValue.patch @@ -0,0 +1,273 @@ +From 37f47683b3416d05c04d68e9898c19a95f3d4e8f Mon Sep 17 00:00:00 2001 +From: Christopher +Date: Wed, 27 May 2020 15:28:23 +0200 +Subject: [PATCH] Add os commands similar to experience data storage Add + similar os commands to llReadKeyValue llCreateKeyValue llDeleteKeyValue == + osGetDataValue osSetDataValue osDeleteDataValue and osCheckDataValue + +--- + .../Shared/Api/Implementation/OSSL_Api.cs | 149 ++++++++++++++++++ + .../Shared/Api/Interface/IOSSL_Api.cs | 10 ++ + .../Shared/Api/Runtime/OSSL_Stub.cs | 40 +++++ + bin/config-include/osslDefaultEnable.ini | 4 + + 4 files changed, 203 insertions(+) + +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +index 8289dec2e7..197fde3a01 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +@@ -42,8 +42,10 @@ using System; + using System.Collections; + using System.Collections.Concurrent; + using System.Collections.Generic; ++using System.IO; + using System.Reflection; + using System.Runtime.Remoting.Lifetime; ++using System.Security.Cryptography; + using System.Text; + using System.Text.RegularExpressions; + using System.Threading; +@@ -948,6 +950,153 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + return false; + } + ++ public string osGetDataValue(string key) ++ { ++ return osGetDataValue(key, false); ++ } ++ ++ public string osGetDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osGetDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if(personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ return File.ReadAllText(file.FullName); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ ++ return ""; ++ } ++ ++ public void osSetDataValue(string key, string value) ++ { ++ osSetDataValue(key, value, false); ++ } ++ ++ public void osSetDataValue(string key, string value, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osSetDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ File.WriteAllText(file.FullName, value); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ } ++ ++ public void osDeleteDataValue(string key) ++ { ++ osDeleteDataValue(key, false); ++ } ++ ++ public void osDeleteDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osDeleteDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ file.Delete(); ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ } ++ ++ public bool osCheckDataValue(string key) ++ { ++ return osCheckDataValue(key, false); ++ } ++ ++ public bool osCheckDataValue(string key, bool personal) ++ { ++ CheckThreatLevel(ThreatLevel.Moderate, "osCheckDataValue"); ++ ++ string dataValueDirectory = m_ScriptEngine.ConfigSource.Configs["XEngine"].GetString("DataValueStorageDirectory", "./ScriptDataValue"); ++ ++ String groupFolderName = m_host.GroupID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (personal) ++ groupFolderName = m_host.OwnerID.ToString().Trim().ToUpper().Replace("-", ""); ++ ++ if (!Directory.Exists(dataValueDirectory)) ++ Directory.CreateDirectory(dataValueDirectory); ++ ++ if (!Directory.Exists(dataValueDirectory + "/" + groupFolderName)) ++ Directory.CreateDirectory(dataValueDirectory + "/" + groupFolderName); ++ ++ try ++ { ++ string keyMD = BitConverter.ToString(new MD5CryptoServiceProvider().ComputeHash(ASCIIEncoding.ASCII.GetBytes(key.Trim().ToUpper()))).Replace("-", ""); ++ FileInfo file = new FileInfo(dataValueDirectory + "/" + groupFolderName + "/" + keyMD + ".txt"); ++ ++ if (file.Exists) ++ return true; ++ } ++ catch (Exception _error) ++ { ++ Console.WriteLine(_error.Message); ++ } ++ ++ return false; ++ } ++ + public void osSetPrimFloatOnWater(int floatYN) + { + CheckThreatLevel(ThreatLevel.VeryLow, "osSetPrimFloatOnWater"); +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +index e9aeda5f28..93dbc64366 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +@@ -142,6 +142,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces + void osRegionNotice(string msg); + void osRegionNotice(LSL_Key agentID, string msg); + bool osConsoleCommand(string Command); ++ ++ string osGetDataValue(string key); ++ string osGetDataValue(string key, bool persoanl); ++ void osSetDataValue(string key, string value); ++ void osSetDataValue(string key, string value, bool personal); ++ void osDeleteDataValue(string key); ++ void osDeleteDataValue(string key, bool personal); ++ bool osCheckDataValue(string key); ++ bool osCheckDataValue(string key, bool personal); ++ + void osSetParcelMediaURL(string url); + void osSetPrimFloatOnWater(int floatYN); + void osSetParcelSIPAddress(string SIPAddress); +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +index 4bae45e392..55e911c6ae 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +@@ -235,6 +235,46 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase + return m_OSSL_Functions.osConsoleCommand(Command); + } + ++ public string osGetDataValue(string key) ++ { ++ return m_OSSL_Functions.osGetDataValue(key); ++ } ++ ++ public string osGetDataValue(string key, bool personal) ++ { ++ return m_OSSL_Functions.osGetDataValue(key, personal); ++ } ++ ++ public void osSetDataValue(string key, string value) ++ { ++ m_OSSL_Functions.osSetDataValue(key, value); ++ } ++ ++ public void osSetDataValue(string key, string value, bool personal) ++ { ++ m_OSSL_Functions.osSetDataValue(key, value, personal); ++ } ++ ++ public void osDeleteDataValue(string key) ++ { ++ m_OSSL_Functions.osDeleteDataValue(key); ++ } ++ ++ public void osDeleteDataValue(string key, bool personal) ++ { ++ m_OSSL_Functions.osDeleteDataValue(key, personal); ++ } ++ ++ public bool osCheckDataValue(string key) ++ { ++ return m_OSSL_Functions.osCheckDataValue(key); ++ } ++ ++ public bool osCheckDataValue(string key, bool personal) ++ { ++ return m_OSSL_Functions.osCheckDataValue(key, personal); ++ } ++ + public void osSetParcelMediaURL(string url) + { + m_OSSL_Functions.osSetParcelMediaURL(url); +diff --git a/bin/config-include/osslDefaultEnable.ini b/bin/config-include/osslDefaultEnable.ini +index e66577dbcf..72885d9d30 100644 +--- a/bin/config-include/osslDefaultEnable.ini ++++ b/bin/config-include/osslDefaultEnable.ini +@@ -146,6 +146,10 @@ + Allow_osSetOwnerSpeed = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osRequestURL = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + Allow_osRequestSecureURL = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osGetDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osSetDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osDeleteDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER ++ Allow_osCheckDataValue = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER + + ; ThreatLevel High + Allow_osCauseDamage = ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER +-- +2.25.1.windows.1 + diff --git a/Patch/0001-change-version-info.patch b/Patch/0001-change-version-info.patch new file mode 100644 index 0000000..e091dfb --- /dev/null +++ b/Patch/0001-change-version-info.patch @@ -0,0 +1,25 @@ +From ecb55712bb8e78fcbdfe333d4942189eb1641ffa Mon Sep 17 00:00:00 2001 +From: Christopher Latza +Date: Sat, 9 May 2020 21:32:41 +0200 +Subject: [PATCH] change version info + +--- + OpenSim/Framework/VersionInfo.cs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/OpenSim/Framework/VersionInfo.cs b/OpenSim/Framework/VersionInfo.cs +index dee4fe2caa..2f10a97053 100644 +--- a/OpenSim/Framework/VersionInfo.cs ++++ b/OpenSim/Framework/VersionInfo.cs +@@ -53,7 +53,7 @@ namespace OpenSim + + public static string GetVersionString(string versionNumber, Flavour flavour) + { +- string versionString = "OpenSim " + versionNumber + " Yeti " + flavour; ++ string versionString = "OpenSim " + versionNumber + ".08 Yeti " + flavour; + return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); + } + +-- +2.25.1.windows.1 + diff --git a/Patch/0001-fake-all-script-returns-for-HG-home-uri.patch b/Patch/0001-fake-all-script-returns-for-HG-home-uri.patch new file mode 100644 index 0000000..30fdfe8 --- /dev/null +++ b/Patch/0001-fake-all-script-returns-for-HG-home-uri.patch @@ -0,0 +1,119 @@ +From 94d29975de3ff4473010192dbd71545bd01545da Mon Sep 17 00:00:00 2001 +From: Christopher +Date: Wed, 3 Jun 2020 08:23:40 +0200 +Subject: [PATCH] fake all script returns for HG home uri + +--- + .../Shared/Api/Implementation/OSSL_Api.cs | 56 +++++++++++++------ + 1 file changed, 38 insertions(+), 18 deletions(-) + +diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +index 8289dec2e7..2c48726977 100644 +--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs ++++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +@@ -2563,6 +2563,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + string nick = String.Empty; + IConfigSource config = m_ScriptEngine.ConfigSource; + ++ string FakeGridNick = Util.GetConfigVarFromSections(config, "FakeGridNick", ++ new string[] { "Startup", "Hypergrid" }, String.Empty); ++ ++ if (!string.IsNullOrEmpty(FakeGridNick)) ++ return FakeGridNick; ++ + if (config.Configs[GridInfoServiceConfigSectionName] != null) + nick = config.Configs[GridInfoServiceConfigSectionName].GetString("gridnick", nick); + +@@ -2579,6 +2585,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + string name = String.Empty; + IConfigSource config = m_ScriptEngine.ConfigSource; + ++ string FakeGridName = Util.GetConfigVarFromSections(config, "FakeGridName", ++ new string[] { "Startup", "Hypergrid" }, String.Empty); ++ ++ if (!string.IsNullOrEmpty(FakeGridName)) ++ return FakeGridName; ++ + if (config.Configs[GridInfoServiceConfigSectionName] != null) + name = config.Configs[GridInfoServiceConfigSectionName].GetString("gridname", name); + +@@ -2592,9 +2604,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridLoginURI"); + +- string loginURI = String.Empty; + IConfigSource config = m_ScriptEngine.ConfigSource; + ++ string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", ++ new string[] { "Startup", "Hypergrid" }, String.Empty); ++ ++ if (!string.IsNullOrEmpty(FakeHomeURI)) ++ return FakeHomeURI; ++ ++ string loginURI = String.Empty; ++ + if (config.Configs[GridInfoServiceConfigSectionName] != null) + loginURI = config.Configs[GridInfoServiceConfigSectionName].GetString("login", loginURI); + +@@ -2609,6 +2628,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridHomeURI"); + + IConfigSource config = m_ScriptEngine.ConfigSource; ++ ++ string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", ++ new string[] { "Startup", "Hypergrid" }, String.Empty); ++ ++ if (!string.IsNullOrEmpty(FakeHomeURI)) ++ return FakeHomeURI; ++ + string HomeURI = Util.GetConfigVarFromSections(config, "HomeURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); + +@@ -2630,6 +2656,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + CheckThreatLevel(ThreatLevel.Moderate, "osGetGridGatekeeperURI"); + + IConfigSource config = m_ScriptEngine.ConfigSource; ++ ++ string FakeHomeURI = Util.GetConfigVarFromSections(config, "FakeHomeURI", ++ new string[] { "Startup", "Hypergrid" }, String.Empty); ++ ++ if (!string.IsNullOrEmpty(FakeHomeURI)) ++ return FakeHomeURI; ++ + string gatekeeperURI = Util.GetConfigVarFromSections(config, "GatekeeperURI", + new string[] { "Startup", "Hypergrid" }, String.Empty); + +@@ -2666,26 +2699,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api + IUserManagement userManager = m_ScriptEngine.World.RequestModuleInterface(); + string returnValue = ""; + +- if (userManager != null) ++ if(userManager.IsLocalGridUser(new UUID(uuid))) + { +- returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI"); ++ return osGetGridHomeURI(); + } +- +- if (returnValue == "") ++ else + { +- IConfigSource config = m_ScriptEngine.ConfigSource; +- returnValue = Util.GetConfigVarFromSections(config, "HomeURI", +- new string[] { "Startup", "Hypergrid" }, String.Empty); +- +- if (!string.IsNullOrEmpty(returnValue)) +- return returnValue; +- +- // Legacy. Remove soon! +- if (config.Configs["LoginService"] != null) +- returnValue = config.Configs["LoginService"].GetString("SRV_HomeURI", returnValue); +- +- if (String.IsNullOrEmpty(returnValue)) +- returnValue = GridUserInfo(InfoType.Home); ++ returnValue = userManager.GetUserServerURL(new UUID(uuid), "HomeURI"); + } + + return returnValue; +-- +2.25.1.windows.1 + diff --git a/Patch/0001-remove-iar-pass-check.patch b/Patch/0001-remove-iar-pass-check.patch new file mode 100644 index 0000000..a953dbc --- /dev/null +++ b/Patch/0001-remove-iar-pass-check.patch @@ -0,0 +1,30 @@ +From 13abf57f71396e54ee477dcc22e16e2b80c09770 Mon Sep 17 00:00:00 2001 +From: Chris +Date: Mon, 7 Nov 2016 22:58:55 +0100 +Subject: [PATCH] remove iar passwort + +--- + .../CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +index 8847414..8d11d20 100644 +--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs ++++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +@@ -565,6 +565,8 @@ UserAccount account + return null; + } + ++ return account; ++ /* + try + { + string encpass = Util.Md5Hash(pass); +@@ -585,6 +587,7 @@ UserAccount account + m_log.ErrorFormat("[INVENTORY ARCHIVER]: Could not authenticate password, {0}", e); + return null; + } ++ */ + } + + /// diff --git a/Patch/AuthorizationService.cs b/Patch/AuthorizationService.cs new file mode 100644 index 0000000..210a298 --- /dev/null +++ b/Patch/AuthorizationService.cs @@ -0,0 +1,256 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using Nini.Config; +using log4net; +using OpenSim.Framework; +using OpenSim.Services.Interfaces; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Region.Framework.Scenes; +using OpenMetaverse; + +using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using System.Net; +using System.Net.Security; + +namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Authorization +{ + public class AuthorizationService : IAuthorizationService + { + private enum AccessFlags + { + None = 0, /* No restrictions */ + DisallowResidents = 1, /* Only gods and managers*/ + DisallowForeigners = 2, /* Only local people */ + AllowLocalAndFriendlyHG = 3, /* Only local and friendly people */ + } + + private static readonly ILog m_log = + LogManager.GetLogger( + MethodBase.GetCurrentMethod().DeclaringType); + + private IUserManagement m_UserManagement; +// private IGridService m_GridService; + + private Scene m_Scene; + AccessFlags m_accessValue = AccessFlags.None; + String m_serverURL = ""; + + public static void InitiateSSLTrust() + { + try + { + //Change SSL checks so that all checks pass + ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate{ return true; }); + ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + + int m_lastListRefresh = 0; + string m_cachedList = ""; + + private string getAccessList() + { + Int32 _currentUnixTime = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds; + + if((m_lastListRefresh + 60) < _currentUnixTime) + { + try + { + WebClient _client = new WebClient(); + m_cachedList = _client.DownloadString(m_serverURL + m_Scene.RegionInfo.RegionID.ToString()); + m_lastListRefresh = _currentUnixTime; + return m_cachedList; + } + catch (Exception _error) + { + m_log.Error("[AuthorizationService]: Cant fetch global HG access list!"); + Console.WriteLine(_error.Message); + } + + return ""; + } + else + { + return m_cachedList; + } + } + + private bool checkRemoteAccessList(string entry) + { + InitiateSSLTrust(); + + string _accessList = getAccessList(); + + if(_accessList != null) + { + entry = entry.Replace("http:", ""); + entry = entry.Replace("https:", ""); + entry = entry.Replace("/", ""); + + if (_accessList.Contains(entry)) + return true; + } + + return false; + } + + public AuthorizationService(IConfig config, Scene scene) + { + m_Scene = scene; + m_UserManagement = scene.RequestModuleInterface(); +// m_GridService = scene.GridService; + + if (config != null) + { + string accessStr = config.GetString("Region_ALL", String.Empty); + accessStr = config.GetString("Region_" + scene.RegionInfo.RegionName.Replace(' ', '_'), accessStr); + m_serverURL = config.GetString("GridWideAccessList", "https://mcp.4creative.net/?api=getAccessList®ion="); + + if (accessStr != string.Empty) + { + try + { + m_accessValue = (AccessFlags)Enum.Parse(typeof(AccessFlags), accessStr); + } + catch (ArgumentException) + { + m_log.WarnFormat("[AuthorizationService]: {0} is not a valid access flag", accessStr); + } + } + m_log.DebugFormat("[AuthorizationService]: Region {0} access restrictions: {1}", m_Scene.RegionInfo.RegionName, m_accessValue); + } + + } + + public bool IsAuthorizedForRegion( + string user, string firstName, string lastName, string regionID, out string message) + { + // This should not happen + if (m_Scene.RegionInfo.RegionID.ToString() != regionID) + { + m_log.WarnFormat("[AuthorizationService]: Service for region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID); + message = string.Format("Region {0} received request to authorize for region {1}", m_Scene.RegionInfo.RegionID, regionID); + return false; + } + + if (m_accessValue == AccessFlags.None) + { + message = "Authorized"; + return true; + } + + UUID userID = new UUID(user); + + if (m_accessValue == AccessFlags.DisallowForeigners) + { + if (!m_UserManagement.IsLocalGridUser(userID)) + { + message = "No foreign users allowed in this region"; + return false; + } + } + + if (m_accessValue == AccessFlags.DisallowResidents) + { + if (!(m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID))) + { + message = "Only Admins and Managers allowed in this region"; + return false; + } + } + + if (m_accessValue == AccessFlags.AllowLocalAndFriendlyHG) + { + if (m_UserManagement.IsLocalGridUser(userID)) + { + message = "All local users are allowed."; + return true; + } + + if ((m_Scene.Permissions.IsGod(userID) || m_Scene.Permissions.IsAdministrator(userID))) + { + message = "Estate administrators are allways allowed."; + return true; + } + + foreach (ILandObject _parcel in m_Scene.LandChannel.AllParcels()) + { + if (_parcel.IsInLandAccessList(userID)) + { + message = "Parcel members are allways allowed."; + return true; + } + } + + if (!m_UserManagement.IsLocalGridUser(userID)) + { + String _homeURL = m_UserManagement.GetUserHomeURL(userID); + + + if (checkRemoteAccessList("gridblacklist:" + _homeURL)) + { + message = "You dont have access to this region."; + return false; + } + + if (checkRemoteAccessList("userblacklist:" + user + "@" + _homeURL)) + { + message = "You dont have access to this region."; + return false; + } + + if (checkRemoteAccessList("grid:" + _homeURL)) + { + message = "Grid whitelist."; + return true; + } + + if (checkRemoteAccessList("user:" + user + "@" + _homeURL)) + { + message = "User whitelist"; + return true; + } + } + + message = "You dont have access to this region."; + return false; + } + + message = "Authorized"; + return true; + } + } +} \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 91b12b6..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# 4Creative-Changes -