api: Allow blacklist functions that shouldn't be accesible from eval

Blacklist deprecated functions and functions depending on channel_id
This commit is contained in:
Björn Linse
2016-06-20 14:40:57 +02:00
parent 7e2348f2b1
commit e536abc1e1
6 changed files with 35 additions and 18 deletions

View File

@@ -37,6 +37,7 @@ c_proto = Ct(
Cg(Cc(false), 'async') *
(fill * Cg((P('FUNC_API_ASYNC') * Cc(true)), 'async') ^ -1) *
(fill * Cg((P('FUNC_API_NOEXPORT') * Cc(true)), 'noexport') ^ -1) *
(fill * Cg((P('FUNC_API_NOEVAL') * Cc(true)), 'noeval') ^ -1) *
fill * P(';')
)
grammar = Ct((c_proto + c_comment + c_preproc + ws) ^ 1)

View File

@@ -25,11 +25,13 @@ local gperfpipe = io.open(funcsfname .. '.gperf', 'wb')
local funcs = require('eval').funcs
local metadata = mpack.unpack(io.open(arg[3], 'rb'):read("*all"))
for i,fun in ipairs(metadata) do
funcs['api_'..fun.name] = {
args=#fun.parameters,
func='api_wrapper',
data='&handle_'..fun.name,
}
if not fun.noeval then
funcs['api_'..fun.name] = {
args=#fun.parameters,
func='api_wrapper',
data='&handle_'..fun.name,
}
end
end
local funcsdata = io.open(funcs_file, 'w')