diff --git a/TODO b/TODO index f3489c2..8fe9e70 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,3 @@ * Look if/where we want to set deadlines on open sockets * Go through all log.Println calls, and make sure they are unique(?) and sensible, and are not too verbose, and/or hidden behind *verbose -* FILTER for forwarded ports -* Change format of authorized_keys to allow for both forwarded and direct filtering -* Put device identifier in comments. -* Add some client identifier to log messages diff --git a/sshd.go b/sshd.go index 38204b1..d87d406 100644 --- a/sshd.go +++ b/sshd.go @@ -148,7 +148,6 @@ func main() { }() go handleRequest(&client, reqs) - // Accept all channels go handleChannels(&client, chans) }() @@ -207,8 +206,6 @@ func handleDirect(client *sshClient, newChannel ssh.NewChannel) { return } - // At this point, we have the opportunity to reject the client's - // request for another logical connection connection, requests, err := newChannel.Accept() if err != nil { log.Printf("Could not accept channel (%s)", err) @@ -343,6 +340,8 @@ func handleTcpIPForwardCancel(client *sshClient, req *ssh.Request) { } func serve(cssh ssh.Channel, conn net.Conn) { + // TODO: Maybe just do this with defer instead? (And only one copy in a + // goroutine) close := func() { cssh.Close() conn.Close() @@ -390,9 +389,7 @@ func loadAuthorisedKeys(authorisedkeys string) { log.Fatal(err) } - devinfo := deviceInfo{ - Comment: comment, - } + devinfo := deviceInfo{Comment: comment} for _, option := range options { ports, err := parseOption(option, "local") @@ -457,12 +454,9 @@ func parseOption(option string, prefix string) (string, error) { if !strings.HasPrefix(option, str) { return "", fmt.Errorf("Option does not start with %s", str) } - ports := option[len(str):] - _, err := parsePorts(ports) - - if err != nil { + if _, err := parsePorts(ports); err != nil { log.Fatal(err) }