Skip to content

Commit

Permalink
wslua: init.lua - superuser logic; typeof() call on non-table
Browse files Browse the repository at this point in the history
obj.__typeof exists only for "table" objects (see c4f1777)
  • Loading branch information
bubbasnmp committed Nov 10, 2022
1 parent b032a40 commit 1e6f26a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions epan/wslua/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1e6f26a

Please sign in to comment.