Граф коммитов

31 Коммитов

Автор SHA1 Сообщение Дата
Kevin Burke e8f229864d all: fix errors reported by vet, golint
None are "wrong" per se, but there are a lot of good suggestions and
in one case a docstring that was not present in godoc due to the
presence of an extra newline.

Changed "Id" in struct properties to "ID" in some non-exported
structs. Removed a trailing period from some error messages; I believe
the exact contents of error strings are not covered by the Go
compatibility promise.

Change-Id: I7c620582dc247396f72c52d38c909ccc0ec87b83
Reviewed-on: https://go-review.googlesource.com/80145
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-28 17:48:09 +00:00
Han-Wen Nienhuys 41d678d1df ssh: soft code internal channel size for testing purposes
Change-Id: I2ee0ed4ba82d2d156a7896551dea04b28cdeceb0
Reviewed-on: https://go-review.googlesource.com/35184
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-23 10:44:52 +00:00
Han-Wen Nienhuys bc89c49641 ssh: clarify error type if a SendRequest goes unanswered
This came up in the discussion of issue #16194.

Change-Id: Ibb4cadf3be975377819eca2e41e0992794ada77b
Reviewed-on: https://go-review.googlesource.com/24820
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-07-25 12:15:03 +00:00
Han-Wen Nienhuys f98fd1f5ec x/crypto/ssh: if debugMux is set, also log global messages.
Change-Id: I685ba7f30f1d2e2bc3c078c7bddb6d383a179113
Reviewed-on: https://go-review.googlesource.com/22416
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
2016-04-25 15:26:28 +00:00
Han-Wen Nienhuys fc84ae5437 go.crypto/ssh: reuse packet buffer for channel writes.
Test that different extended data streams within a channel are
thread-safe.

benchmark             old MB/s     new MB/s     speedup
BenchmarkEndToEnd     79.26        87.98        1.11x

benchmark                          old allocs     new allocs     delta
BenchmarkEndToEnd                  110            73             -33.64%

benchmark                          old bytes     new bytes     delta
BenchmarkEndToEnd                  2605720       1299768       -50.12%

LGTM=dave, jpsugar
R=agl, dave, jpsugar
CC=golang-codereviews
https://golang.org/cl/136420043
2014-09-16 12:30:05 -07:00
Adam Langley fa50e7408b go.crypto/ssh: import gosshnew.
See https://groups.google.com/d/msg/Golang-nuts/AoVxQ4bB5XQ/i8kpMxdbVlEJ

R=hanwen
CC=golang-codereviews
https://golang.org/cl/86190043
2014-04-09 13:57:52 -07:00
Jakob Borg 4758fe8ce4 go.crypto/ssh: Increase window size.
Increase window size for channels (session and tcpip) to 64 *
max packet size (32 KB), which is the same value that OpenSSH
uses. Also breaks out the relevant harcoded constants into named
constants in channel.go.

Fixes golang/go#6675.

R=golang-dev, dave, hanwen, agl
CC=golang-dev
https://golang.org/cl/18120043
2013-11-01 04:24:39 +11:00
Han-Wen Nienhuys 4a7557f2bd go.crypto/ssh: add String method to RejectionReason.
R=agl, dave
CC=golang-dev
https://golang.org/cl/14494055
2013-10-14 16:13:09 -04:00
Jonathan Pittman 44256fa2df go.crypto/ssh: cosmetic only spelling fixes
R=agl, hanwen
CC=dave, golang-dev, jpsugar
https://golang.org/cl/14430055
2013-10-10 11:35:15 -04:00
Han-Wen Nienhuys 73e99326fb go.crypto/ssh: separate kex algorithms into kexAlgorithm class.
Adds readPacket() to conn, and renames conn to packetConn.
Key exchanges operate on packetConn, so they can be
unittested.

R=agl, jpsugar, dave
CC=golang-dev
https://golang.org/cl/13352055
2013-09-24 12:26:29 -04:00
Adam Langley aa0f5b4081 go.crypto: revert 7f5a59ff6b43.
This change reverts https://golang.org/cl/10113043/ because
some folks are stuck on 1.0 till 1.1.1 comes out.

R=golang-dev
CC=golang-dev
https://golang.org/cl/10151043
2013-06-10 10:57:00 -04:00
Adam Langley eca6c1626e go.crypto: remove unreachable code.
I ran go vet over all of go.crypto and removed lots of panic("unreachable") that are no longer needed.

R=golang-dev, r, dgryski
CC=golang-dev
https://golang.org/cl/10113043
2013-06-07 16:05:15 -04:00
Gustav Paul 1aa39d6262 go.crypto/ssh: Read returns all unread bytes before returning io.EOF.
Fixes golang/go#4158.

R=dave, agl
CC=golang-dev
https://golang.org/cl/6586060
2012-10-03 09:25:25 +10:00
Dave Cheney 552202b8e3 go.crypto/ssh: assorted close related fixes
Fixes golang/go#3810.

Fixes chanWriter Write after close behaviour bug.

Fixes serverChan writePacket after close bug.

Addresses final comments by agl on 6405064, plus various cleanups.

R=agl, kardianos, gustav.paul, fullung
CC=golang-dev
https://golang.org/cl/6479056
2012-09-05 09:47:02 +10:00
Daniel Theophanes fc6f6ba087 go.crypto/ssh: prevent server from sending more than maxPacket
Fixes golang/go#4003.

R=agl, dave, agl
CC=golang-dev
https://golang.org/cl/6483052
2012-08-25 14:52:54 +10:00
Dave Cheney c1c0bfbd3a go.crypto/ssh: prevent channel writes after Close
Fixes golang/go#3810.

This change introduces an atomic boolean to guard the close
of the clientChan. Previously the client code was quite
lax with the ordering of the close messages and could allow
window adjustment or EOF messages to leak after Close had
been signaled.

Consolidating the changes to the serverChan will be handled
in a following CL.

R=agl, kardianos, gustav.paul
CC=golang-dev
https://golang.org/cl/6405064
2012-08-24 09:46:44 +10:00
Dave Cheney 7343d5f584 go.crypto/ssh: improve channel max packet handling
This proposal moves the check for max packet into
channel.writePacket. Callers should be aware they cannot
pass a buffer larger than max packet. This is only a
concern to chanWriter.Write and appropriate guards are
already in place.

There was some max packet handling in transport.go but it was
incorrect. This has been removed.

This proposal also cleans up session_test.go.

R=gustav.paul, agl, fullung, huin
CC=golang-dev
https://golang.org/cl/6460075
2012-08-13 08:22:53 +10:00
Dave Cheney 00f60517a3 go.crypto/ssh: cosmetic: move remaining channel code into channel.go
This CL scratches an itch by moving the remaining channel related code
into channel.go.

R=agl
CC=golang-dev
https://golang.org/cl/6454126
2012-08-11 12:18:54 +10:00
Dave Cheney f4749cba32 go.crypto/ssh: never send more data than maxpacket
RFC 4254 s5.2 is clear that a client must never send a data
packet larger than the value of maximum packet supplied by the
remote side during channel setup. The client was not honoring
this value, in fact it wasn't even recording it.

Thanks to Albert Strasheim for the bug report.

R=agl, fullung
CC=golang-dev
https://golang.org/cl/6448128
2012-08-09 10:22:00 +10:00
Dave Cheney 36d74d6fed go.crypto/ssh: fix panic unmarshalling channelOpenFailureMsg
I introduced this problem in change set 33 when I redefined
RejectionReason from a uint32 to an int. I have added a test
to verify the message can be marshaled correctly.

This was a bit hard to track down as the recover in clientConn
mainLoop would catch the panic and shutdown the connection. We
probably shouldn't be using panic inside marshal/unmarshal, at
least not without a way to let the user know why the recover
logic tripped.

R=agl, kardianos, gustav.paul
CC=golang-dev
https://golang.org/cl/6210063
2012-05-18 09:11:31 +10:00
Dave Cheney 8a2e7c966a go.crypto/ssh: make {client,server}Chan use common window management
R=agl, gustav.paul, kardianos
CC=golang-dev
https://golang.org/cl/6208043
2012-05-11 05:56:44 +10:00
Dave Cheney 523290a72d go.crypto/ssh: move common channel methods into an embedded struct
This CL introduces a new struct, channel to hold common shared
functions.

* add a new channel struct, which is embeded in {client,server}Chan.
* move common methods from {client,server}Chan into channel.
* remove unneeded used of serverConn.lock in serverChan
 (transport.writePacket has its own mutex).
* remove filteredConn, introduce conn.

R=agl, gustav.paul
CC=golang-dev
https://golang.org/cl/6128059
2012-05-09 08:20:05 +10:00
Dave Cheney 68e64b8f78 go.crypto/ssh: struct renaming
This CL is in preparation for 6128059.

* rename channel -> serverChan
* rename chanlist -> chanList
* normalise theirId/MyId/id/peersId -> localId/remoteId

R=agl
CC=golang-dev
https://golang.org/cl/6174046
2012-05-05 07:59:48 +10:00
Adam Langley 0d3cfff99f ssh: fix deadlock
The code was taking locks in the wrong order.

Fixes golang/go#3570.

R=fullung
CC=golang-dev
https://golang.org/cl/6123058
2012-04-26 12:05:35 -04:00
Dave Cheney b333fd1d05 go.crypto/ssh: add support for remote tcpip forwarding
Add support for server (remote) forwarded tcpip channels.
See RFC4254 Section 7.1

R=gustav.paul, jeff, agl, lieqiewang
CC=golang-dev
https://golang.org/cl/6038047
2012-04-26 20:37:06 +10:00
Adam Langley 63f855d724 ssh: cosmetic cleanups
These are the cosmetic cleanups from the bits of code that I
rereviewed.

1) stringLength now takes a int; the length of the string. Too many
   callers were allocating with stringLength([]byte(s)) and
   stringLength only needs to call len().

2) agent.go now has sendAndReceive to remove logic that was
   duplicated.

3) We now reject negative DH values

4) We now reject empty packets rather than crashing.

R=dave, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/6061052
2012-04-20 15:17:42 -04:00
Adam Langley cfd75bc309 crypto/ssh: fix several logic errors.
These are the obvious mistakes from my read through. I'll save the
more cosmetic changes for a later CL.

R=dave, kardianos
CC=golang-dev
https://golang.org/cl/6049050
2012-04-19 11:16:57 -04:00
Daniel Theophanes 452b645a37 go.crypto/ssh: respect adjust window msg on server.
R=golang-dev
CC=agl, golang-dev
https://golang.org/cl/5908048
2012-03-26 12:44:23 -04:00
Daniel Theophanes 6c548e9506 go.crypto/ssh: add Stderr() in Channel interface.
Adds support for piping Stderr to the client.

R=golang-dev, dave, agl
CC=golang-dev
https://golang.org/cl/5674081
2012-02-20 10:42:43 -05:00
Adam Langley 7f524f2468 ssh: fix locking in channel.Write
Since a lock is retaken before sync.Cond.Wait returns, this could
deadlock when the for loop attempts to take the lock again. (Reported
by sanjay.m.)

theirWindow was used outside of the lock, therefore concurrent writers
could overrun the window.

theirWindow was never updated to reflect the data written.

R=dave, balasanjay
CC=golang-dev
https://golang.org/cl/5671084
2012-02-18 13:49:50 -05:00
Russ Cox 470549d502 go.crypto: initial code
Manual edits to README.
Moved from main Go repository, deleted Makefiles, ran gofix -r go1rename.

Tested with: go test code.google.com/p/go.crypto/...

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5564059
2012-01-25 15:31:12 -05:00