Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(97)

Issue 5555044: code review 5555044: exp/ssh: handle versions with just '\n' (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 6 months ago by agl1
Modified:
13 years, 6 months ago
Reviewers:
CC:
dave_cheney.net, jmp, golang-dev
Visibility:
Public.

Description

exp/ssh: handle versions with just '\n' djm recommend that we do this because OpenSSL was only fixed in 2008: http://anoncvs.mindrot.org/index.cgi/openssh/sshd.c?revision=1.380&view=markup

Patch Set 1 #

Patch Set 2 : diff -r 23f61c80a2ac https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 23f61c80a2ac https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 23f61c80a2ac https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 23f61c80a2ac https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 6 : diff -r 41777f1070e9 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+29 lines, -20 lines) Patch
M src/pkg/exp/ssh/transport.go View 1 2 3 4 5 2 chunks +13 lines, -18 lines 0 comments Download
M src/pkg/exp/ssh/transport_test.go View 1 2 3 4 5 3 chunks +16 lines, -2 lines 0 comments Download

Messages

Total messages: 4
agl1
Hello dave@cheney.net (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 6 months ago (2012-01-18 00:31:15 UTC) #1
dave_cheney.net
Looks pretty good, please see the comment about bytes.Trim http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go File src/pkg/exp/ssh/transport.go (right): http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go#newcode366 src/pkg/exp/ssh/transport.go:366: ...
13 years, 6 months ago (2012-01-18 09:07:57 UTC) #2
jmp
http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go File src/pkg/exp/ssh/transport.go (right): http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go#newcode361 src/pkg/exp/ssh/transport.go:361: // We need to remove the [CR]LR from versionString ...
13 years, 6 months ago (2012-01-18 18:59:34 UTC) #3
agl1
13 years, 6 months ago (2012-01-18 20:04:27 UTC) #4
*** Submitted as http://code.google.com/p/go/source/detail?r=f1e930b56e11 ***

exp/ssh: handle versions with just '\n'

djm recommend that we do this because OpenSSL was only fixed in 2008:
http://anoncvs.mindrot.org/index.cgi/openssh/sshd.c?revision=1.380&view=markup

R=dave, jonathan.mark.pittman
CC=golang-dev
http://codereview.appspot.com/5555044

http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go
File src/pkg/exp/ssh/transport.go (right):

http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go#...
src/pkg/exp/ssh/transport.go:361: // We need to remove the [CR]LR from
versionString
On 2012/01/18 18:59:34, jmp wrote:
> s/[CR]LR/[CR]LF/

Done.

http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport.go#...
src/pkg/exp/ssh/transport.go:366: return versionString, nil
On 2012/01/18 09:07:57, dfc wrote:
> Could this be simplified?
>    return bytes.Trim(versionString, "\r\n"), nil

As it turned out, I had a bug in here hidden by the bad test: the '\n' is never
appended, so we only need to (possibly) remove the last byte. I think that this
is simple enough that's it's not worth invoking bytes.TrimRight, in all it's
closure and Unicode glory.

http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport_tes...
File src/pkg/exp/ssh/transport_test.go (right):

http://codereview.appspot.com/5555044/diff/4003/src/pkg/exp/ssh/transport_tes...
src/pkg/exp/ssh/transport_test.go:33: if !bytes.Equal(buf[:len(buf)-2], result)
{
On 2012/01/18 09:07:57, dfc wrote:
> I think this should be buf[:len(buf)-1] as you already stripped off the last
> char on line 27

Yes, thanks!
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b