[PATCH 1/5] session: forbid creation from Lua binary and applier sessions

Vladimir Davydov vdavydov.dev at gmail.com
Tue Mar 20 16:20:08 MSK 2018


On Mon, Mar 19, 2018 at 04:34:48PM +0300, Vladislav Shpilevoy wrote:
> Lua has no access to applier or binary sockets, and these session
> types must be forbidden.
> 
> And after #2667 applier, binary, console and background session
> owners will be incapsulated inside corresponding modules.

I don't understand why we should explicitly check session type in this
funciton. After all, it's an internal function, never intended to be
called directly by the user, so why should we care?

> diff --git a/test/box-tap/session.test.lua b/test/box-tap/session.test.lua
> index 6fddced3c..ff952fd45 100755
> --- a/test/box-tap/session.test.lua
> +++ b/test/box-tap/session.test.lua
> @@ -15,14 +15,22 @@ session = box.session
>  space = box.schema.space.create('tweedledum')
>  index = space:create_index('primary', { type = 'hash' })
>  
> -test:plan(53)
> +test:plan(55)
> +
> +--
> +-- Check that can start from Lua only either console or REPL.
> +--
> +local ok, err = pcall(box.internal.session.create, 100, "binary")
> +test:is(err, "Can not start non-console or non-REPL session from Lua", "bad session type")
> +ok, err = pcall(box.internal.session.create, 100, "applier")
> +test:is(err, "Can not start non-console or non-REPL session from Lua", "bad session type")



More information about the Tarantool-patches mailing list