aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/template-init.lua
diff options
context:
space:
mode:
authorLuis Ontanon <luis.ontanon@gmail.com>2006-10-04 14:37:46 +0000
committerLuis Ontanon <luis.ontanon@gmail.com>2006-10-04 14:37:46 +0000
commitba90067e6253449a9ca243b75831537c11634d16 (patch)
tree2899e3a53dbad2dfe41cae595c56b8cf4ca6edb6 /epan/wslua/template-init.lua
parent7ecb3721a35e151b8d4d2c3e80feed27bfd9cc16 (diff)
- wslua_util.c: replace Lua's loadfile and dofile for versions that will try to open the file in perscofdir then dataconfdir if there's no such file in cwd
- wslua_field.c: avoid FieldInfo:__tostring() crashing when the ftype has no val_to_string_repr - init.lua: inform the user that a packet has been disabled, intead of a cryptic "attemt to call nil" - Makefile.am: add register_wslua.c and declare_wslua.h to MAINTAINERCLEANFILES - wslua_gui.c: fix a typo svn path=/trunk/; revision=19425
Diffstat (limited to 'epan/wslua/template-init.lua')
-rw-r--r--epan/wslua/template-init.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/epan/wslua/template-init.lua b/epan/wslua/template-init.lua
index 0541f74148..0fe00b54cb 100644
--- a/epan/wslua/template-init.lua
+++ b/epan/wslua/template-init.lua
@@ -26,8 +26,7 @@
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--- If lua is to be disabled even if it was installed uncomment the following
--- line.
+-- If lua is to be completely disabled uncomment the following line.
-- disable_lua = true; do return end;
@@ -35,15 +34,19 @@
-- tells whether scripts other than this one are to be run.
run_user_scripts_when_superuser = false
+
-- disable potentialy harmful lua functions when running superuser
if running_superuser then
+ local disabled_lib = {}
+ setmetatable(disabled_lib,{ __index = function() error("this package has been disabled") end } );
+
dofile = function() error("dofile has been disabled") end
loadfile = function() error("loadfile has been disabled") end
loadlib = function() error("loadlib has been disabled") end
require = function() error("require has been disabled") end
- os = {}
- io = {}
- file = {}
+ os = disabled_lib
+ io = disabled_lib
+ file = disabled_lib
end
-- to avoid output to stdout which can caause problems lua's print ()