From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 21 Dec 2018 14:17:41 +0300 From: Vladimir Davydov Subject: Re: [PATCH v2 1/4] console: forbid arbitrary session type setting Message-ID: <20181221111741.5oi2scu5jlkunymh@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 Tue, Dec 11, 2018 at 07:10:20PM +0300, Vladislav Shpilevoy wrote: > @@ -47,22 +47,33 @@ static const char *sessionlib_name = "box.session"; > > /* Create session and pin it to fiber */ > static int > -lbox_session_create(struct lua_State *L) > +lbox_session_create(struct lua_State *L, enum session_type type) > { > struct session *session = fiber_get_session(fiber()); > if (session == NULL) { > session = session_create_on_demand(); > if (session == NULL) > return luaT_error(L); > - session->meta.fd = luaL_optinteger(L, 1, -1); > + session->meta.fd = lua_tointeger(L, 1); > } > - /* If a session already exists, simply reset its type */ > - session->type = STR2ENUM(session_type, luaL_optstring(L, 2, "console")); > + session->type = type; > > lua_pushnumber(L, session->id); > return 1; > } If you didn't remove session_vtab registry, you wouldn't be needing this patch. I don't think that narrowing functionality of an internal function makes much sense on its own so please drop it if you agree to leave the registry.