From 90ae7206f3ac989c6bc435c03badadcd25976eef Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 29 May 2019 17:04:14 +0200 Subject: Fix the varlink upgraded calls Although an upgraded call is requested, the server has to send at least one reply (can be an error) and the client has to check the reply, before assuming an upgraded connection. Signed-off-by: Harald Hoyer --- pkg/adapter/containers_remote.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'pkg/adapter') diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go index c34495b3d..0c0bce813 100644 --- a/pkg/adapter/containers_remote.go +++ b/pkg/adapter/containers_remote.go @@ -583,7 +583,15 @@ func (r *LocalRuntime) attach(ctx context.Context, stdin, stdout *os.File, cid s } // TODO add detach keys support - _, err = iopodman.Attach().Send(r.Conn, varlink.Upgrade, cid, detachKeys, start) + reply, err := iopodman.Attach().Send(r.Conn, varlink.Upgrade, cid, detachKeys, start) + if err != nil { + restoreTerminal(oldTermState) + return nil, err + } + + // See if the server accepts the upgraded connection or returns an error + _, err = reply() + if err != nil { restoreTerminal(oldTermState) return nil, err -- cgit v1.2.3-54-g00ecf