aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-02-23 12:04:32 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2021-02-23 12:04:32 +0100
commit4345e2b5ff62229dc63df65d1c2c9ed95f07b460 (patch)
tree95182c1b22933ebdff64342f7af27ffd3e581a59
parenta77c1e4c508741d3aebfa3b7519e44b575f76a74 (diff)
downloadmailbox-4345e2b5ff62229dc63df65d1c2c9ed95f07b460.tar.gz
mailbox-4345e2b5ff62229dc63df65d1c2c9ed95f07b460.tar.bz2
mailbox-4345e2b5ff62229dc63df65d1c2c9ed95f07b460.zip
Security: really fix protection.HEADmaster
-rw-r--r--init.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/init.lua b/init.lua
index 71ac177..ecd53b9 100644
--- a/init.lua
+++ b/init.lua
@@ -172,10 +172,10 @@ end
mailbox.allow_metadata_inventory_take = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
local name = player:get_player_name()
- if not meta:get_string("owner") == name and not minetest.check_player_privs(name, {protection_bypass=true,}) then
- return 0
+ if meta:get_string("owner") == name or minetest.check_player_privs(name, {protection_bypass=true,}) then
+ return stack:get_count()
end
- return stack:get_count()
+ return 0
end
mailbox.allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
@@ -205,8 +205,8 @@ minetest.register_node("mailbox:mailbox", {
can_dig = mailbox.can_dig,
on_metadata_inventory_put = mailbox.on_metadata_inventory_put,
allow_metadata_inventory_put = mailbox.allow_metadata_inventory_put,
- allow_metadata_invenory_take = mailbox.allow_metadata_inventory_take,
- allow_metadata_invenory_move = mailbox.allow_metadata_inventory_move,
+ allow_metadata_inventory_take = mailbox.allow_metadata_inventory_take,
+ allow_metadata_inventory_move = mailbox.allow_metadata_inventory_move,
})
minetest.register_node("mailbox:mailbox_free", {
@@ -247,8 +247,8 @@ minetest.register_node("mailbox:letterbox", {
can_dig = mailbox.can_dig,
on_metadata_inventory_put = mailbox.on_metadata_inventory_put,
allow_metadata_inventory_put = mailbox.allow_metadata_inventory_put,
- allow_metadata_invenory_take = mailbox.allow_metadata_inventory_take,
- allow_metadata_invenory_move = mailbox.allow_metadata_inventory_move,
+ allow_metadata_inventory_take = mailbox.allow_metadata_inventory_take,
+ allow_metadata_inventory_move = mailbox.allow_metadata_inventory_move,
})
minetest.register_tool("mailbox:unrenter", {