From 1e6f26adb61217d45dca9b3312fa6c03bbfa5898 Mon Sep 17 00:00:00 2001 From: Chuck Craft Date: Tue, 22 Mar 2022 13:41:05 -0500 Subject: [PATCH] wslua: init.lua - superuser logic; typeof() call on non-table obj.__typeof exists only for "table" objects (see c4f1777a) --- epan/wslua/init.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/epan/wslua/init.lua b/epan/wslua/init.lua index 6fbf0b7565..704f15de37 100644 --- a/epan/wslua/init.lua +++ b/epan/wslua/init.lua @@ -18,16 +18,22 @@ if not enable_lua then return end --- If set and Wireshark was started as (setuid) root, then the user +-- If false and Wireshark was started as (setuid) root, then the user -- will not be able to execute custom Lua scripts from the personal -- configuration directory, the -Xlua_script command line option or -- the Lua Evaluate menu option in the GUI. +-- Note: Not checked on Windows. running_superuser is always false. run_user_scripts_when_superuser = true function typeof(obj) local mt = getmetatable(obj) - return mt and mt.__typeof or obj.__typeof or type(obj) + + if type(obj) == "table" then + return mt and mt.__typeof or obj.__typeof or type(obj) + else + return mt and mt.__typeof or type(obj) + end end -- the following function checks if a file exists