From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id BD572257B8 for ; Fri, 12 Jul 2019 17:51:43 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OJJXCJjbZltU for ; Fri, 12 Jul 2019 17:51:43 -0400 (EDT) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 77C2721B07 for ; Fri, 12 Jul 2019 17:51:43 -0400 (EDT) Received: by mail-lf1-f66.google.com with SMTP id z15so3100190lfh.13 for ; Fri, 12 Jul 2019 14:51:43 -0700 (PDT) Date: Sat, 13 Jul 2019 00:51:40 +0300 From: Cyrill Gorcunov Subject: [tarantool-patches] Re: [PATCH 3/3] box/lua/console: Verify remote protocol for compatibility Message-ID: <20190712215140.GH4602@uranus.lan> References: <20190712190438.32349-1-gorcunov@gmail.com> <20190712190438.32349-4-gorcunov@gmail.com> <20190712204719.GC31930@atlas> <20190712204904.GA32340@atlas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712204904.GA32340@atlas> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Konstantin Osipov Cc: tml , Alexander Turenko , Kirill Yukhin On Fri, Jul 12, 2019 at 11:49:04PM +0300, Konstantin Osipov wrote: > * Konstantin Osipov [19/07/12 23:47]: > > > +local function output_verify_remote(greeting) > > > + -- > > > + -- In case if remote peer is operating over > > > + -- old yaml protocol we are unable to decode > > > + -- it to non-yaml serializers. > > > + if greeting.protocol == 'Lua console' then > > > + local d = box.session.storage.console_output > > > + if d ~= nil and d["fmt"] == "lua" then > > > + local msg1 = "Peer uses deprecated '%s' protocol. " > > > + local msg2 = "Switch output to 'yaml' format to proceed." > > > + return false, msg1:format(greeting.protocol) .. msg2 > > > + end > > > + end > > > + return true, nil > > > +end > > > > what is the problem with doing yaml.load and serpent.encode for > > such peers? 'Lua console' proto is depecated, binary proto is preferred and I think we may simply get rid it, otherwise a way more code is needed here which I would try to escape. > > > > What if it's a new peer but using yaml output? Every new connection does this check so that if peer is reporting old text protocol we refuse to connect until local output set back to yaml. > > Moreover, shouldn't the output setting affect only the local > server output, but not subsequent console.connect() calls? Not sure I follow here. This code checks for reply from remote peer, every output bound to a session, and every connection is a new session (no?) thus we do test each time. Or you meant something different?