Prevent giving copies of no copy scripts or transferring no trans scripts

through LSL
avinationmerge
Melanie 2011-02-21 04:02:47 +01:00
parent 04dc43f591
commit efd8d03c59
1 changed files with 14 additions and 2 deletions

View File

@ -6867,6 +6867,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
// copy the first script found with this inventory name // copy the first script found with this inventory name
TaskInventoryItem scriptItem = null;
m_host.TaskInventory.LockItemsForRead(true); m_host.TaskInventory.LockItemsForRead(true);
foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory) foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
{ {
@ -6877,6 +6878,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
found = true; found = true;
srcId = inv.Key; srcId = inv.Key;
scriptItem = inv.Value;
break; break;
} }
} }
@ -6889,8 +6891,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
// the rest of the permission checks are done in RezScript, so check the pin there as well SceneObjectPart dest = World.GetSceneObjectPart(destId);
World.RezScript(srcId, m_host, destId, pin, running, start_param); if (dest != null)
{
if ((scriptItem.BasePermissions & (uint)PermissionMask.Transfer) != 0 || dest.ParentGroup.RootPart.OwnerID == m_host.ParentGroup.RootPart.OwnerID)
{
// the rest of the permission checks are done in RezScript, so check the pin there as well
World.RezScript(srcId, m_host, destId, pin, running, start_param);
if ((scriptItem.BasePermissions & (uint)PermissionMask.Copy) == 0)
m_host.Inventory.RemoveInventoryItem(srcId);
}
}
// this will cause the delay even if the script pin or permissions were wrong - seems ok // this will cause the delay even if the script pin or permissions were wrong - seems ok
ScriptSleep(3000); ScriptSleep(3000);
} }