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.
0.6.0-stable
Melanie Thielker 2008-11-06 14:37:41 +00:00
parent 09f86d7e99
commit 4cd7907314
1 changed files with 46 additions and 43 deletions

View File

@ -962,55 +962,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
public void osMakeNotecard(string notecardName, LSL_Types.list contents) // This needs ThreatLevel high. It is an excellent griefer tool,
{ // In a loop, it can cause asset bloat and DOS levels of asset
CheckThreatLevel(ThreatLevel.None, "osMakeNotecard"); // writes.
m_host.AddScriptLPS(1); //
public void osMakeNotecard(string notecardName, LSL_Types.list contents)
{
CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
m_host.AddScriptLPS(1);
// Create new asset // Create new asset
AssetBase asset = new AssetBase(); AssetBase asset = new AssetBase();
asset.Name = notecardName; asset.Name = notecardName;
asset.Description = "Script Generated Notecard"; asset.Description = "Script Generated Notecard";
asset.Type = 7; asset.Type = 7;
asset.FullID = UUID.Random(); asset.FullID = UUID.Random();
string notecardData = ""; string notecardData = "";
for (int i = 0; i < contents.Length; i++) { for (int i = 0; i < contents.Length; i++) {
notecardData += contents.GetLSLStringItem(i) + "\n"; notecardData += contents.GetLSLStringItem(i) + "\n";
} }
int textLength = notecardData.Length; int textLength = notecardData.Length;
notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " notecardData = "Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length "
+ textLength.ToString() + "\n" + notecardData + "}\n"; + textLength.ToString() + "\n" + notecardData + "}\n";
asset.Data = Encoding.ASCII.GetBytes(notecardData); asset.Data = Encoding.ASCII.GetBytes(notecardData);
World.AssetCache.AddAsset(asset); World.AssetCache.AddAsset(asset);
// Create Task Entry // Create Task Entry
TaskInventoryItem taskItem=new TaskInventoryItem(); TaskInventoryItem taskItem=new TaskInventoryItem();
taskItem.ResetIDs(m_host.UUID); taskItem.ResetIDs(m_host.UUID);
taskItem.ParentID = m_host.UUID; taskItem.ParentID = m_host.UUID;
taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch(); taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
taskItem.Name = asset.Name; taskItem.Name = asset.Name;
taskItem.Description = asset.Description; taskItem.Description = asset.Description;
taskItem.Type = 7; taskItem.Type = 7;
taskItem.InvType = 7; taskItem.InvType = 7;
taskItem.OwnerID = m_host.OwnerID; taskItem.OwnerID = m_host.OwnerID;
taskItem.CreatorID = m_host.OwnerID; taskItem.CreatorID = m_host.OwnerID;
taskItem.BasePermissions = (uint)PermissionMask.All; taskItem.BasePermissions = (uint)PermissionMask.All;
taskItem.CurrentPermissions = (uint)PermissionMask.All; taskItem.CurrentPermissions = (uint)PermissionMask.All;
taskItem.EveryonePermissions = (uint)PermissionMask.All; taskItem.EveryonePermissions = 0;
taskItem.NextPermissions = (uint)PermissionMask.All; taskItem.NextPermissions = (uint)PermissionMask.All;
taskItem.GroupID = m_host.GroupID; taskItem.GroupID = m_host.GroupID;
taskItem.GroupPermissions = 0; taskItem.GroupPermissions = 0;
taskItem.Flags = 0; taskItem.Flags = 0;
taskItem.PermsGranter = UUID.Zero; taskItem.PermsGranter = UUID.Zero;
taskItem.PermsMask = 0; taskItem.PermsMask = 0;
taskItem.AssetID = asset.FullID; taskItem.AssetID = asset.FullID;
m_host.AddInventoryItem(taskItem); m_host.AddInventoryItem(taskItem);
}
}
} }
} }