From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 20 Mar 2018 16:20:08 +0300 From: Vladimir Davydov Subject: Re: [PATCH 1/5] session: forbid creation from Lua binary and applier sessions Message-ID: <20180320132008.sql5vzqx2tc6ovu3@esperanza> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: To: Vladislav Shpilevoy Cc: tarantool-patches@freelists.org List-ID: 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")