code review 5908048: go.crypto/ssh: respect adjust window msg on server. (issue 5908048)

15 views
Skip to first unread message

kard...@gmail.com

unread,
Mar 24, 2012, 6:32:06 PM3/24/12
to golan...@googlegroups.com, a...@golang.org, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golan...@googlegroups.com (cc: a...@golang.org,
golan...@googlegroups.com),

I'd like you to review this change to
http://code.google.com/p/go.crypto


Description:
go.crypto/ssh: respect adjust window msg on server.

Please review this at http://codereview.appspot.com/5908048/

Affected files:
M ssh/channel.go
M ssh/server.go


Index: ssh/channel.go
===================================================================
--- a/ssh/channel.go
+++ b/ssh/channel.go
@@ -149,6 +149,9 @@
case *channelEOFMsg:
c.theySentEOF = true
c.cond.Signal()
+ case *windowAdjustMsg:
+ c.theirWindow += packet.AdditionalBytes
+ c.cond.Signal()
default:
panic("unknown packet type")
}
Index: ssh/server.go
===================================================================
--- a/ssh/server.go
+++ b/ssh/server.go
@@ -570,6 +570,16 @@
c.handlePacket(msg)
s.lock.Unlock()

+ case *windowAdjustMsg:
+ s.lock.Lock()
+ c, ok := s.channels[msg.PeersId]
+ if !ok {
+ s.lock.Unlock()
+ continue
+ }
+ c.handlePacket(msg)
+ s.lock.Unlock()
+
case *channelEOFMsg:
s.lock.Lock()
c, ok := s.channels[msg.PeersId]


Daniel

unread,
Mar 24, 2012, 6:38:39 PM3/24/12
to kard...@gmail.com, golan...@googlegroups.com, a...@golang.org, re...@codereview-hr.appspotmail.com
I understand this may not be looked at soon with Go1, but I have time
this weekend...

This appears to me to partially solve a problem I've been having with
the ssh server package. Reference unit test code here:
https://gist.github.com/2188648

Although this appears to expand how large of a continuous read the
server can sustain, it will still dead-lock on a larger message (again
see test code).

This is related to, but doesn't appear to fully fix issue 3204.

-Daniel

a...@golang.org

unread,
Mar 26, 2012, 12:44:41 PM3/26/12
to kard...@gmail.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
*** Submitted as
http://code.google.com/p/go/source/detail?r=72ff0e1315af&repo=crypto ***

go.crypto/ssh: respect adjust window msg on server.

R=golang-dev
CC=agl, golang-dev
http://codereview.appspot.com/5908048

Committer: Adam Langley <a...@golang.org>


http://codereview.appspot.com/5908048/

kard...@gmail.com

unread,
Mar 31, 2012, 5:43:57 PM3/31/12
to kard...@gmail.com, golan...@googlegroups.com, a...@golang.org, re...@codereview-hr.appspotmail.com
Reply all
Reply to author
Forward
0 new messages