Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llAllowInventoryDrop filtering

Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
07-29-2007 22:01
There's been a fair amount of stir lately over problems of people using a float text script they didn't create to put float text above their freebie boxes, only to find out later the float text script also included an "llAllowInventoryDrop(TRUE)" command, and that people had been putting illicit items into their freebie boxes because of that.

The problem is that llAllowInventoryDrop is an all-or-nothing command; you either allow other users to drop in ANYTHING, or NOTHING. What brought this to mind for me was recently a friend wanted to set up a drop-box for employment application notecards... but of course the current state of affairs meant that anything, including scripts, could be dropped into that box. That's not good.

That led me to thinking about a JIRA entry for adding a filtering command that works in tandem with AllowInventoryDrop to specify what TYPES of items can be dropped into an object's inventory when AllowInventoryDrop is set to TRUE.

(The JIRA is at http://jira.secondlife.com/browse/SVC-484 if you'd care to vote on it.)

In the mean time, other than having a script that scrubs the object inventory of anything but notecards and itself whenever CHANGED_INVENTORY happens, is there any other solution or work-around? And I don't think that sort of scrubbing would happen fast enough to prevent a potential problem if it were a script that were dropped into the object's inventory, in any case...
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
07-29-2007 23:12
Useful idea, but my understanding is that scripts are specifically disallowed from being dropped into a llAllowInventoryDrop-enabled prim (the result being that annoying SHOUT of ""Not permitted to edit this!" from the prim in question), so even though an "inventory scrub script" is kind of an unwieldy hack, it should work fine for eliminating unwanted inventory items.

Still going to vote, it's a good idea :)


edit: reference http://www.lslwiki.net/lslwiki/wakka.php?wakka=llAllowInventoryDrop
ed44 Gupte
Explorer (Retired)
Join date: 7 Oct 2005
Posts: 638
07-29-2007 23:19
Not in world right now, but I would have thought you would need to call llRemoveInventory( string item ) on a change event to remove the script that was dropped into the object.

Maybe the following might go some way to doing the job of removing extraneous scripts?

CODE

default
{
changed(integer change)
{
if (change & CHANGED_ALLOWED_DROP) //note that it's & and not &&... it's bitwise!
{
llOwnerSay("The inventory has changed as a result of a user without mod permissions dropping an item on the prim and it being allowed by the script.");
integer x = llGetInventoryNumber(INVENTORY_ALL);
while (--x >=0) {
string item = llGetInventoryName ( INVENTORY_SCRIPT , x);
if (llGetScriptName( ) != item)
llRemoveInventory(item );
}
}
}
}
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
07-30-2007 02:28
From: Solomon Devoix
In the mean time, other than having a script that scrubs the object inventory of anything but notecards and itself whenever CHANGED_INVENTORY happens, is there any other solution or work-around? And I don't think that sort of scrubbing would happen fast enough to prevent a potential problem if it were a script that were dropped into the object's inventory, in any case...
As Anti points out, scripts aren't eligible for llAllowInventoryDrop()--but objects containing scripts are, which is why it was such a problem in the freebie boxes. So upon CHANGED_ALLOWED_DROP, a script can safely sort through the containing object's inventory, looking for anything not permitted, which is a kind of work-around. And it can maintain a list of inventory item keys to determine what's new when the event occurs, but it's an annoying bit of processing to have to do, given that the asset update that triggers the event surely knew what item it just added. So I'd be more interested in some more efficient way to get at what item triggered the event.
Solomon Devoix
Used Register
Join date: 22 Aug 2006
Posts: 496
07-30-2007 09:54
Hm. I'll admit that I didn't know that scripts were prohibited from being dropped in... though that does make sense. Whaddaya know... occasionally they do set up something with a bit of forethought. ;)

However, I agree that some way of knowing what item in inventory triggered the CHANGED event would be useful indeed... care to make a JIRA entry for it? ;)