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