Fix potential security vulnability in diplomacy form
This commit is contained in:
parent
904015f72c
commit
fc1edfa22c
@ -286,11 +286,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local tname = tplayer.team
|
local tname = tplayer.team
|
||||||
local team = ctf.team(tname)
|
local team = ctf.team(tname)
|
||||||
|
|
||||||
if not team then
|
if not team or formname ~= "ctf:diplo" then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if formname == "ctf:diplo" then
|
|
||||||
for key, field in pairs(fields) do
|
for key, field in pairs(fields) do
|
||||||
local tname2 = string.match(key, "team_(.+)")
|
local tname2 = string.match(key, "team_(.+)")
|
||||||
if tname2 and ctf.team(tname2) then
|
if tname2 and ctf.team(tname2) then
|
||||||
@ -298,6 +297,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ctf.can_mod(name, tname) then
|
||||||
tname2 = string.match(key, "peace_(.+)")
|
tname2 = string.match(key, "peace_(.+)")
|
||||||
if tname2 then
|
if tname2 then
|
||||||
if ctf.diplo.get(tname, tname2) == "war" then
|
if ctf.diplo.get(tname, tname2) == "war" then
|
||||||
@ -348,6 +348,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
ctf.gui.show(name, "diplo")
|
ctf.gui.show(name, "diplo")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end -- end if can mod
|
||||||
end
|
end -- end for each field
|
||||||
end)
|
end)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user