From 98a6f4ec64c029c835437a38b2901cdf49a7a1b8 Mon Sep 17 00:00:00 2001 From: "Merlijn B. W. Wajer" Date: Thu, 9 Mar 2017 11:37:39 +0100 Subject: [PATCH] Clean up option handling, comment on openssh compat --- sshd.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sshd.go b/sshd.go index fe47110..2e97186 100644 --- a/sshd.go +++ b/sshd.go @@ -391,13 +391,15 @@ func loadAuthorisedKeys(authorisedkeys string) { devinfo := deviceInfo{Comment: comment} + // TODO: Compatibility with permitopen=foo,permitopen=bar, + // permitremoteopen=quux,permitremoteopen=wobble for _, option := range options { - ports, err := parseOption(option, "local") + ports, err := parseOption(option, "localports") if err == nil { devinfo.LocalPorts = ports continue } - ports, err := parseOption(option, "remote") + ports, err = parseOption(option, "remoteports") if err == nil { devinfo.RemotePorts = ports continue @@ -452,7 +454,7 @@ func portPermitted(port uint32, ports []uint32) bool { } func parseOption(option string, prefix string) (string, error) { - str := fmt.Sprintf("%sports=", prefix) + str := fmt.Sprintf("%s=", prefix) if !strings.HasPrefix(option, str) { return "", fmt.Errorf("Option does not start with %s", str) }