aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-06 14:37:41 +0000
committerMelanie Thielker2008-11-06 14:37:41 +0000
commit4cd790731418c9fbe412871c0cf48d8fd4d5cbc8 (patch)
tree1c1b3f9442e5b13ec3bbdf441c4f554d8408ab84 /OpenSim/Region/ScriptEngine/Shared
parent- fixes comparison of struct against null (no no no) (diff)
downloadopensim-SC-4cd790731418c9fbe412871c0cf48d8fd4d5cbc8.zip
opensim-SC-4cd790731418c9fbe412871c0cf48d8fd4d5cbc8.tar.gz
opensim-SC-4cd790731418c9fbe412871c0cf48d8fd4d5cbc8.tar.bz2
opensim-SC-4cd790731418c9fbe412871c0cf48d8fd4d5cbc8.tar.xz
Change threat level of osMakeNotecard to High because of it's griefing
potential (asset bloat, asset server DOS due to no enforced delay) Formatting cleanup. Change default permissions on the notecard to not include "anyone can copy" and "anyone can move", as they are meaningless on non-prim items.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs103
1 files changed, 53 insertions, 50 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index bd14a13..d5225f7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -962,55 +962,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
962 } 962 }
963 963
964 964
965 public void osMakeNotecard(string notecardName, LSL_Types.list contents) 965 // This needs ThreatLevel high. It is an excellent griefer tool,
966 { 966 // In a loop, it can cause asset bloat and DOS levels of asset
967 CheckThreatLevel(ThreatLevel.None, "osMakeNotecard"); 967 // writes.
968 m_host.AddScriptLPS(1); 968 //
969 969 public void osMakeNotecard(string notecardName, LSL_Types.list contents)
970 // Create new asset 970 {
971 AssetBase asset = new AssetBase(); 971 CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
972 asset.Name = notecardName; 972 m_host.AddScriptLPS(1);
973 asset.Description = "Script Generated Notecard"; 973
974 asset.Type = 7; 974 // Create new asset
975 asset.FullID = UUID.Random(); 975 AssetBase asset = new AssetBase();
976 string notecardData = ""; 976 asset.Name = notecardName;
977 977 asset.Description = "Script Generated Notecard";
978 for (int i = 0; i < contents.Length; i++) { 978 asset.Type = 7;
979 notecardData += contents.GetLSLStringItem(i) + "\n"; 979 asset.FullID = UUID.Random();
980 } 980 string notecardData = "";
981 981
982 int textLength = notecardData.Length; 982 for (int i = 0; i < contents.Length; i++) {
983 notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " 983 notecardData += contents.GetLSLStringItem(i) + "\n";
984 + textLength.ToString() + "\n" + notecardData + "}\n"; 984 }
985 985
986 asset.Data = Encoding.ASCII.GetBytes(notecardData); 986 int textLength = notecardData.Length;
987 World.AssetCache.AddAsset(asset); 987 notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
988 988 + textLength.ToString() + "\n" + notecardData + "}\n";
989 // Create Task Entry 989
990 TaskInventoryItem taskItem=new TaskInventoryItem(); 990 asset.Data = Encoding.ASCII.GetBytes(notecardData);
991 991 World.AssetCache.AddAsset(asset);
992 taskItem.ResetIDs(m_host.UUID); 992
993 taskItem.ParentID = m_host.UUID; 993 // Create Task Entry
994 taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); 994 TaskInventoryItem taskItem=new TaskInventoryItem();
995 taskItem.Name = asset.Name; 995
996 taskItem.Description = asset.Description; 996 taskItem.ResetIDs(m_host.UUID);
997 taskItem.Type = 7; 997 taskItem.ParentID = m_host.UUID;
998 taskItem.InvType = 7; 998 taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
999 taskItem.OwnerID = m_host.OwnerID; 999 taskItem.Name = asset.Name;
1000 taskItem.CreatorID = m_host.OwnerID; 1000 taskItem.Description = asset.Description;
1001 taskItem.BasePermissions = (uint)PermissionMask.All; 1001 taskItem.Type = 7;
1002 taskItem.CurrentPermissions = (uint)PermissionMask.All; 1002 taskItem.InvType = 7;
1003 taskItem.EveryonePermissions = (uint)PermissionMask.All; 1003 taskItem.OwnerID = m_host.OwnerID;
1004 taskItem.NextPermissions = (uint)PermissionMask.All; 1004 taskItem.CreatorID = m_host.OwnerID;
1005 taskItem.GroupID = m_host.GroupID; 1005 taskItem.BasePermissions = (uint)PermissionMask.All;
1006 taskItem.GroupPermissions = 0; 1006 taskItem.CurrentPermissions = (uint)PermissionMask.All;
1007 taskItem.Flags = 0; 1007 taskItem.EveryonePermissions = 0;
1008 taskItem.PermsGranter = UUID.Zero; 1008 taskItem.NextPermissions = (uint)PermissionMask.All;
1009 taskItem.PermsMask = 0; 1009 taskItem.GroupID = m_host.GroupID;
1010 taskItem.AssetID = asset.FullID; 1010 taskItem.GroupPermissions = 0;
1011 1011 taskItem.Flags = 0;
1012 m_host.AddInventoryItem(taskItem); 1012 taskItem.PermsGranter = UUID.Zero;
1013 1013 taskItem.PermsMask = 0;
1014 } 1014 taskItem.AssetID = asset.FullID;
1015
1016 m_host.AddInventoryItem(taskItem);
1017 }
1015 } 1018 }
1016} 1019}