From f3bbd0836728c03a03b1c26b86c040f277282ac7 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 12 Apr 2022 18:30:27 +0200 Subject: [PATCH] fix tests after anonssh refactoring --- internal/rsynctest/rsynctest.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/rsynctest/rsynctest.go b/internal/rsynctest/rsynctest.go index a09a857..001b123 100644 --- a/internal/rsynctest/rsynctest.go +++ b/internal/rsynctest/rsynctest.go @@ -92,11 +92,15 @@ func New(t *testing.T, modules []rsyncd.Module, opts ...Option) *TestServer { ts.Port = port if ts.listeners[0].AuthorizedSSH.Address != "" { + sshListener, err := anonssh.ListenerFromConfig(ts.listeners[0]) + if err != nil { + t.Fatal(err) + } cfg := &rsyncdconfig.Config{ Modules: modules, } go func() { - err := anonssh.Serve(ts.listener, ts.listeners[0].AuthorizedSSH.AuthorizedKeys, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { + err := anonssh.Serve(ts.listener, sshListener, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { return maincmd.Main(context.Background(), args, stdin, stdout, stderr, cfg) }) @@ -109,11 +113,15 @@ func New(t *testing.T, modules []rsyncd.Module, opts ...Option) *TestServer { } }() } else if ts.listeners[0].AnonSSH != "" { + sshListener, err := anonssh.ListenerFromConfig(ts.listeners[0]) + if err != nil { + t.Fatal(err) + } cfg := &rsyncdconfig.Config{ Modules: modules, } go func() { - err := anonssh.Serve(ts.listener, "", cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { + err := anonssh.Serve(ts.listener, sshListener, cfg, func(args []string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error { return maincmd.Main(context.Background(), args, stdin, stdout, stderr, cfg) })