1
0
mirror of https://github.com/golang/go synced 2024-10-04 10:21:21 -06:00
Commit Graph

464 Commits

Author SHA1 Message Date
Russ Cox
41453d2ed2 exp/types: fix linux build
I don't understand why it was only broken on Linux

TBR=gri
CC=golang-dev
https://golang.org/cl/5479045
2011-12-08 23:20:21 -05:00
Russ Cox
a250f37cbc update tree for new default type rule
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5448091
2011-12-08 22:08:03 -05:00
Alex Brainman
ef65feda2a syscall: return error, not uintptr, when function returns error
R=rsc
CC=golang-dev
https://golang.org/cl/5450119
2011-12-08 12:07:21 +11:00
David Symonds
9d52fe22b4 exp/sql: simplify some string conversions.
R=bradfitz
CC=golang-dev
https://golang.org/cl/5451112
2011-12-08 08:08:00 +11:00
Gustav Paul
50c24bf6ec exp/ssh: Have Wait() return an *ExitError
I added the clientChan's msg channel to the list of channels that are closed in mainloop when the server sends a channelCloseMsg.

I added an ExitError type that wraps a Waitmsg similar to that of os/exec. I fill ExitStatus with the data returned in the 'exit-status' channel message and Msg with the data returned in the 'exit-signal' channel message.

Instead of having Wait() return on the first 'exit-status'/'exit-signal' I have it return an ExitError containing the status and signal when the clientChan's msg channel is closed.

I added two tests cases to session_test.go that test for exit status 0 (in which case Wait() returns nil) and exit status 1 (in which case Wait() returns an ExitError with ExitStatus 1)

R=dave, agl, rsc, golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5452051
2011-12-07 09:58:22 -05:00
Dave Cheney
bf59f081c1 exp/ssh: cleanup client auth tests
This CL cleans up the client auth tests, making the
individual test body more manageable.

Also, adds tests for rsa and dsa key negotiation.

Finally, remove the package level use of the variable
strings, which avoids conflicting with the strings pkg.

R=gustav.paul, agl, n13m3y3r, rsc
CC=golang-dev
https://golang.org/cl/5447049
2011-12-06 18:13:20 -05:00
Dave Cheney
bbbd41f4ff exp/ssh: simplify client channel open logic
This is part one of a small set of CL's that aim to resolve
the outstanding TODOs relating to channel close and blocking
behavior.

Firstly, the hairy handling of assigning the peersId is now
done in one place. The cost of this change is the slightly
paradoxical construction of the partially created clientChan.

Secondly, by creating clientChan.stdin/out/err when the channel
is opened, the creation of consumers like tcpchan and Session
is simplified; they just have to wire themselves up to the
relevant readers/writers.

R=agl, gustav.paul, rsc
CC=golang-dev
https://golang.org/cl/5448073
2011-12-06 09:33:23 -05:00
Rob Pike
0a5508c692 various: we don't cast, we convert
R=golang-dev, dsymonds
CC=golang-dev
https://golang.org/cl/5437142
2011-12-05 19:40:52 -08:00
Russ Cox
2666b815a3 use new strconv API
All but 3 cases (in gcimporter.go and hixie.go)
are automatic conversions using gofix.

No attempt is made to use the new Append functions
even though there are definitely opportunities.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5447069
2011-12-05 15:48:46 -05:00
Luuk van Dijk
40b2fe004f gc: changes in export format in preparation of inlining.
Includes minimal change to gcimporter to keep it working,

R=rsc, gri
CC=golang-dev
https://golang.org/cl/5431046
2011-12-05 14:40:19 -05:00
Russ Cox
dcf1d7bc0e gofmt -s misc src
R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/5451079
2011-12-02 14:14:25 -05:00
Gustav Paul
bd9dc3d55f exp/ssh: allow for msgUserAuthBanner during authentication
The SSH spec allows for the server to send a banner message to the client at any point during the authentication process. Currently the ssh client auth types all assume that the first response from the server after issuing a userAuthRequestMsg will be one of a couple of possible authentication success/failure messages. This means that client authentication breaks if the ssh server being connected to has a banner message configured.

This changeset refactors the noneAuth, passwordAuth and publickeyAuth types' auth() function and allows for msgUserAuthBanner during authentication.

R=golang-dev, rsc, dave, agl
CC=golang-dev
https://golang.org/cl/5432065
2011-12-02 10:34:42 -05:00
Gustav Paul
fad57c0c03 exp/ssh: export type signal. Renamed to Signal
R=dave, agl, rsc, golang-dev, n13m3y3r
CC=golang-dev
https://golang.org/cl/5450059
2011-12-01 14:06:15 -05:00
Adam Langley
bac7bc55a6 Add a []byte argument to hash.Hash to allow an allocation to be saved.
This is the result of running `gofix -r hashsum` over the tree, changing
the hash function implementations by hand and then fixing a couple of
instances where gofix didn't catch something.

The changed implementations are as simple as possible while still
working: I'm not trying to optimise in this CL.

R=rsc, cw, rogpeppe
CC=golang-dev
https://golang.org/cl/5448065
2011-12-01 12:35:37 -05:00
Dave Cheney
c4d0ac0e2f exp/ssh: add Std{in,out,err}Pipe methods to Session
R=gustav.paul, cw, agl, rsc, n13m3y3r
CC=golang-dev
https://golang.org/cl/5433080
2011-12-01 08:30:16 -02:00
Dave Cheney
0e62c75b9d undo CL 5436056 / 03560deae933
Remove the accidentally exported net.Listener

««« original CL description
exp/ssh: remove unused forwarding methods in Server Listener

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5436056

»»»

R=agl, rsc
CC=golang-dev
https://golang.org/cl/5437090
2011-11-30 17:14:03 -05:00
Russ Cox
8dce57e169 os: new FileInfo, FileMode types + update tree
R=golang-dev, r, r, gri, bradfitz, iant, iant, nigeltao, n13m3y3r
CC=golang-dev
https://golang.org/cl/5416060
2011-11-30 12:04:16 -05:00
Russ Cox
03823b881c use new time API
R=bradfitz, gri, r, dsymonds
CC=golang-dev
https://golang.org/cl/5390042
2011-11-30 12:01:46 -05:00
Gustav Paul
c6691d1fb4 exp/ssh: Add Start(cmd string) and Signal(sig string) to Session. Rename Exec to Run.
Exec() has been renamed to Run() in keeping with the os/exec API.

Added func (*Session) Start(cmd string) which starts a remote process but unlike Run() doesn't wait for it to finish before returning.

Run() has been refactored to use Start internally. Its really just a refactoring, no new code but some extra functionality was won.

Also added func (*Session) Signal(sig signal) which sends a UNIX signal to a remote process. This is espcially useful in conjunction with Start() as the two allow you to start a remote process, monitor its stdout/stderr, and send it a TERM/HUP/etc signal when you want it to close.

R=dave, rsc, agl, bradfitz, n13m3y3r, gustavo
CC=golang-dev
https://golang.org/cl/5437058
2011-11-29 12:26:39 -05:00
Dave Cheney
4cc64bd5bf exp/ssh: move openChan to NewSession
openChan was only being called by NewSession, Dial has
its own version.

R=gustav.paul, agl, rsc
CC=golang-dev
https://golang.org/cl/5435071
2011-11-28 15:42:47 -05:00
Dave Cheney
b57bb9282e exp/ssh: add safeString error sanitiser
R=huin, agl, gustav.paul, cw
CC=golang-dev
https://golang.org/cl/5399044
2011-11-28 12:29:19 -05:00
Dave Cheney
ce7e11997b exp/ssh: fix three shift bugs related to packet lengths
Thanks for Ke Lan for the initial report and investigation.

R=agl, gustav.paul, tg8866, rsc
CC=golang-dev
https://golang.org/cl/5443044
2011-11-28 12:10:16 -05:00
Brad Fitzpatrick
e77099daa2 sql: add Tx.Stmt to use an existing prepared stmt in a transaction
R=rsc
CC=golang-dev
https://golang.org/cl/5433059
2011-11-28 11:00:32 -05:00
Gustav Paul
23227f3d63 exp/ssh: fix misleading spelling mistake in comment
R=dave, agl, rsc, golang-dev
CC=golang-dev
https://golang.org/cl/5431089
2011-11-28 10:45:52 -05:00
Gustav Paul
d859d7deee exp/ssh: messages now contain remote channel's id instead of local id
According to http://www.ietf.org/rfc/rfc4254.txt most channel messages contain the channel id of the recipient channel, not the sender id. This allows the recipient connection multiplexer to route the message to the correct channel.

This changeset fixes several messages that incorrectly send the local channel id instead of the remote channel's id.

While sessions were being created and closed in sequence channels in the channel pool were freed and reused on the server side of the connection at the same rate as was done on the client, so the channel local and remote channel ids always corresponded. As soon as I had concurrent sessions on the same clientConn the server started to complain of 'uknown channel id N' where N is the local channel id, which is actually paired with server channel id K.

R=golang-dev, dave, rsc, agl
CC=golang-dev
https://golang.org/cl/5433063
2011-11-27 09:59:20 -05:00
Benny Siegert
5519b5d716 exp/sql/driver: Correct package name in comment.
IIRC, package sql used to be called db. There was one occurrence
of the old name in a comment.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5431075
2011-11-25 10:57:10 -05:00
Dave Cheney
f2c858749a exp/ssh: add simple tcpip.go functional tests
R=rsc, agl, n13m3y3r, bradfitz
CC=golang-dev
https://golang.org/cl/5385041
2011-11-23 09:38:11 -05:00
Dave Cheney
d5514120b1 exp/ssh: remove unused forwarding methods in Server Listener
R=agl, rsc
CC=golang-dev
https://golang.org/cl/5436056
2011-11-23 09:35:01 -05:00
Brad Fitzpatrick
750d0e33fb sql: more driver docs & tests; no functional changes
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5415055
2011-11-20 14:56:49 -05:00
Dave Cheney
fb57134d47 exp/ssh: alter Session to match the exec.Cmd API
This CL inverts the direction of the Stdin/out/err members of the
Session struct so they reflect the API of the exec.Cmd. In doing so
it borrows heavily from the exec package.

Additionally Shell now returns immediately, wait for completion using
Wait. Exec calls Wait internally and so blocks until the remote
command is complete.

Credit to Gustavo Niemeyer for the impetus for this CL.

R=rsc, agl, n13m3y3r, huin, bradfitz
CC=cw, golang-dev
https://golang.org/cl/5322055
2011-11-20 11:46:35 -05:00
Nigel Tao
dbb591d8da exp/gui: delete exp/gui and exp/gui/x11. They are moving to
x-go-binding.googlecode.com.

R=rsc, rogpeppe
CC=golang-dev
https://golang.org/cl/5406041
2011-11-20 21:56:17 +11:00
John Beisley
0e60804b4a exp/ssh: Add support for (most) of the ciphers from RFC4253, RFC4344 and RFC4345.
R=dave, agl, taruti, rsc, r
CC=golang-dev
https://golang.org/cl/5342057
2011-11-18 12:56:57 -05:00
Dmitriy Vyukov
151bcb11a8 exp/terminal: fix Makefile formatting for deps.bash
deps.bash does not understand current format,
so make.bash fails (with MAKEFLAGS=-j20).

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5410046
2011-11-18 15:30:36 +03:00
Gustavo Niemeyer
558d055352 exp/terminal: fix build after os.Errno changes
Also include exp/terminal in linux build so such failures
are noticed.

R=rsc
CC=golang-dev
https://golang.org/cl/5416044
2011-11-18 01:12:57 -02:00
Alex Brainman
3ec82f6e09 exp/ssh: change test listen address, also exit test if fails
R=golang-dev, rsc
CC=dave, golang-dev
https://golang.org/cl/5364061
2011-11-17 11:20:42 +11:00
Russ Cox
8c6461bcb1 exp/ssh: fix test?
Fixes use of c after Dial failure (causes crash).
May fix Dial failure by listening to 127.0.0.1:0
instead of 0.0.0.0:0 (tests should only listen on
localhost).

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5395052
2011-11-16 18:13:50 -05:00
Dave Cheney
00f9b7680a exp/ssh: fix unmarshal test
Ensure that empty NameLists always return
a zero length []string, not nil.

In practice NameLists are only used in a few
message types and always consumed by a for
range function so the difference between nil
and []string{} is not significant.

Also, add exp/ssh to pkg/Makefile as suggested
by rsc.

R=rsc, agl
CC=golang-dev
https://golang.org/cl/5400042
2011-11-16 10:19:56 -05:00
Yasuhiro Matsumoto
5e5c5c2789 exp/sql: NumInput() allow -1 to ignore checking.
Some database driver can't get number of parameters.
For example:
        http://support.microsoft.com/kb/240205/en-us
So, added way to ignore checking number of parameters with return -1.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5376091
2011-11-15 16:29:43 -08:00
Brad Fitzpatrick
5b7827ec07 sql: document that for drivers, io.EOF means no more rows
This was used in the sql package + tests, but never
documented.

R=golang-dev, gri
CC=golang-dev
https://golang.org/cl/5372107
2011-11-15 14:29:45 -08:00
Brad Fitzpatrick
0a8005c772 sql: add DB.Close, fix bugs, remove Execer on Driver (only Conn)
R=rsc
CC=golang-dev
https://golang.org/cl/5372099
2011-11-14 10:48:26 -08:00
Russ Cox
c017a8299f syscall: use error
- syscall (not os) now defines the Errno type.
- the low-level assembly functions Syscall, Syscall6, and so on
  return Errno, not uintptr
- syscall wrappers all return error, not uintptr.

R=golang-dev, mikioh.mikioh, r, alex.brainman
CC=golang-dev
https://golang.org/cl/5372080
2011-11-13 22:44:52 -05:00
Dave Cheney
7af553ab52 exp/ssh: add direct-tcpip client support
This CL adds experimental support for making proxied
net.Conn connections via the remote server.

nb. Functional tests exist for this feature but CL
5320053 or similar needs to be committed to support them.

R=rsc, agl, n13m3y3r
CC=cw, golang-dev, huin
https://golang.org/cl/5371081
2011-11-13 21:05:35 -05:00
Dave Cheney
34466a1491 exp/ssh: add client functional tests
Requires CL 5373055

R=rsc, agl, n13m3y3r
CC=golang-dev
https://golang.org/cl/5320053
2011-11-13 20:58:51 -05:00
Dave Cheney
59a92cde3d exp/ssh: use ClientConfig.rand() for publickey authentication
Closes TODO from 5373055

R=agl
CC=golang-dev
https://golang.org/cl/5375081
2011-11-13 20:57:15 -05:00
Dave Cheney
3ee171d174 exp/ssh: add client side support for publickey auth
client.go/client_auth.go:
* add support for publickey key auth using the interface
  outlined by rsc in the previous auth CL

client_auth_test.go:
* password and publickey tests against server.go

common.go/server.go:
* move some helper methods from server.go into common.go
* generalise serializeRSASignature

R=rsc, agl, huin
CC=cw, golang-dev, n13m3y3r
https://golang.org/cl/5373055
2011-11-13 14:48:22 -05:00
Dave Cheney
90ec203318 exp/ssh: ensure initial window advertisement is not lost
Some remote servers send a 0 window size in the channel
open confirm msg, others send a non zero window size. Make
sure this initial advertisement is not lost.

R=agl, rsc, cw
CC=golang-dev
https://golang.org/cl/5372083
2011-11-13 12:13:46 -05:00
Adam Langley
252ef18d04 exp/terminal: rename shell to terminal and add SetSize
It was never really a shell, but the name carried
over from SSH's ServerShell.

Two small functional changes:

Add SetSize, which allows the size of the terminal
to be changed in response, say, to an SSH message.

Don't write the prompt if there's already something
on the current line.

R=rsc
CC=golang-dev
https://golang.org/cl/5376066
2011-11-11 14:04:33 -05:00
Adam Langley
d08f57e68c exp/terminal: rename terminal.go to util.go
(This is part of removing the duplicate code between exp/terminal and
exp/ssh, but hg is having a very hard time keeping up so I'm doing it
in small steps.)

R=bradfitz, rsc
CC=golang-dev
https://golang.org/cl/5373061
2011-11-11 11:18:45 -05:00
Rob Pike
30aa701fec renaming_2: gofix -r go1pkgrename src/pkg/[a-l]*
R=rsc
CC=golang-dev
https://golang.org/cl/5358041
2011-11-08 15:40:58 -08:00
Dave Cheney
1170a6460f exp/ssh: improved client authentication support
This CL adds an API for handling the various SSH
authenticaton methods. None and password continue
to be the only supported methods.

R=bradfitz, agl, n13m3y3r, rsc, cw
CC=golang-dev
https://golang.org/cl/5328045
2011-11-07 12:37:05 -05:00