From e536abc1e1f59d1ac012e1be576bf55175e95443 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Mon, 20 Jun 2016 14:40:57 +0200 Subject: api: Allow blacklist functions that shouldn't be accesible from eval Blacklist deprecated functions and functions depending on channel_id --- scripts/gendispatch.lua | 1 + scripts/geneval.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/gendispatch.lua b/scripts/gendispatch.lua index 9178996a56..68d4d44e2d 100644 --- a/scripts/gendispatch.lua +++ b/scripts/gendispatch.lua @@ -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) diff --git a/scripts/geneval.lua b/scripts/geneval.lua index 75a8bdfab3..a6171f0993 100644 --- a/scripts/geneval.lua +++ b/scripts/geneval.lua @@ -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') -- cgit