Pavel Borzenkov
9aa225fc15
Don't copy Server struct in sendPacket/sendError
...
Server struct contains Mutex which might be copied in inconsistent
state. Avoid this by declaring methods on pointer receiver.
This calms down go race detector.
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2017-04-05 14:15:57 -07:00
John Eikenberry
5152c21cf9
integrate packageManager into servers
2017-03-23 16:15:04 -07:00
John Eikenberry
51cb116815
better name: packet -> requestPacket
2017-03-23 16:15:04 -07:00
John Eikenberry
89c474ca1d
new name for id (now ider) interface
...
more in line with go naming scheme for interfaces
better greppability
2017-03-23 16:15:04 -07:00
John Eikenberry
0b42971846
packet unmarshalling code into main server loop
...
This means we are now passing full packets to the workers. This makes
the request id's available which is required for fixing packet ordering.
Benchmark tests weren't affected at all.
2017-03-23 16:15:03 -07:00
John Eikenberry
4f1fe4fe3b
Use common packet typing code
...
Remove duplication due to request code being separate.
2017-03-23 16:15:03 -07:00
John Eikenberry
890b9f1a4a
change readonly checks to interface type checks
2017-03-23 16:15:03 -07:00
George Xie
725c6ac61d
make path more Unix like on windows servers
2017-03-01 20:04:44 -08:00
Dave Cheney
d4c18e7ffd
Integrate readPacket and writePacket into handlePacket ( #120 )
2016-06-15 21:17:20 +10:00
Dave Cheney
3a7eae5fbb
Introduce serverConn ( #119 )
2016-06-15 21:08:29 +10:00
Dave Cheney
7f77924bb0
Centralise packet handling for common packets … ( #111 )
...
* Centralise packet handling for common packets
Updates #84 , #95 , #96
* use sendError
2016-06-15 20:47:20 +10:00
Dave Cheney
ea1a7bcdfc
conn: seperate io.Reader and io.WriteCloser ( #118 )
...
Reading and Writing are less coupled in the sftp client and server than
they may be over a traditional ReadWriter. This mirrors the full duplex
/ half close nature of a TCP connection.
In essence conn.Reader cannot be closed locally, it can only close in
response to the remote side using conn.WriteCloser.Close(), or a network
error, which is effectively the same thing.
Make this behaviour super clear by no longer smooshing the type into a
ReadWriteCloser.
2016-06-15 20:19:51 +10:00
Dave Cheney
9d52a809ce
Always close client conn when clientConn.recv exits ( #117 )
...
If recv has exited then nobody will retrive the response, so
make sure we cannot send anything by shutting down the Write side of the
connection.
2016-06-15 20:04:26 +10:00
Dave Cheney
7d4fc94878
Introduce sftp.conn type to handle common send/recv behaviour ( #113 )
...
Introduce sftp.conn type to bind packet send/recv to a
io.ReadWriteCloser.
2016-06-15 11:50:02 +10:00
Dave Cheney
c5050bbe83
removed unused code
2016-06-15 11:33:39 +10:00
Dave Cheney
4c7551ad7e
Refactor all the calls to sendPacket(statusFromError(...)) to a sendError helper ( #114 )
...
* statusFromError now takes a type with an id() uint32 method
* Introduce sendError
Refactor all the calls to sendPacket(statusFromError(...)) to a
sendError helper.
2016-06-14 21:11:15 +10:00
Mark Sheahan
9ff4de5c31
add serverside StatVFS function, implemented for darwin and linux ( #89 )
2016-06-13 14:45:13 +10:00
Dave Cheney
8bf4044e7f
remove svr.in svr.out, replace with svr.rwc ( #107 )
2016-05-29 18:22:40 +10:00
Dave Cheney
4f0e386862
Cleanup server code ( #106 )
...
Cleanup server code, especially around the shutdown logic, now there are
no more errors about leaking files during the tests.
2016-05-29 17:59:23 +10:00
Dave Cheney
f3fc26f1c3
General server cleanups ( #103 )
...
- no need to initalise mutexes, their zero value is valid
- make NewServer simpler, 90% of use cases already had an
io.ReadWriteCloser, in the single case that it it is easy to provide a
simple wrapper.
2016-05-29 16:32:05 +10:00
Dave Cheney
dfb5f84e82
Use pkg/errors for error handling ( #101 ) ( #102 )
2016-05-23 20:54:08 +10:00
Dave Cheney
5e9ad277fc
Use pkg/errors for error handling ( #101 )
2016-05-19 15:16:48 +10:00
Dave Cheney
ca0111c37f
server: fix ignored error handling in server ( #100 )
2016-05-19 15:04:32 +10:00
Dave Cheney
bd4f7a70da
server: refactor packet decoding and read only handling
2016-05-19 14:49:23 +10:00
Matt Layher
8e47c759f5
server: remote rootDir parameter, as it does nothing
2016-01-16 12:41:01 -05:00
Matt Layher
7d53b6d4ab
server: return ServerOption for godoc documentation
2016-01-11 12:21:15 -05:00
Matt Layher
d396b1b4cb
Merge pull request #80 from pkg/functional-options
...
server: use functional options for NewServer
2016-01-11 11:56:30 -05:00
Matt Layher
403657b31e
server: use functional options for NewServer
2016-01-11 11:52:51 -05:00
Matt Layher
167a495725
packet, server: use a single read-only check
2016-01-11 11:50:10 -05:00
Matt Layher
9374ae613d
*: golint: add and fix up comments on exported types
2016-01-07 15:16:34 -05:00
Matt Layher
b348482b1a
*: golint (part 1)
2016-01-07 12:10:24 -05:00
Dave Cheney
94fb4ddd0c
Add -testserver permutation
...
Fixes #69
io.Pipe is unbuffered and provides a poor replacement for a net.Conn, use an os.Pipe instead.
Also skip some tests which don't work under the Go server as it runs in process.
2016-01-02 10:28:56 +01:00
Matt Layher
7b7864c7f4
server: simplify code and improve readability
2015-12-30 12:56:52 -05:00
Mark Sheahan
d7309968cd
add more tests; bug setting S_IFREG caused openssh sftp to refuse to get the file
2015-09-08 17:03:18 -07:00
Mark Sheahan
bce43f23ac
Address review comments; alter server test to allow the user / group words to be different
2015-09-07 22:50:46 -07:00
Mark Sheahan
c69ab311ab
all tests invoking external binaries considered integration tests to satisfy wercker
2015-09-07 02:28:33 -07:00
Mark Sheahan
cbd08aeb80
implement setstat & fsetstat
2015-09-07 02:13:07 -07:00
Mark Sheahan
d80ae36051
rmdir and symlink packet handling
2015-09-07 01:05:16 -07:00
Mark Sheahan
7bb2083ca9
Address review comments; about to change decodePacket()
2015-09-06 23:55:15 -07:00
Mark Sheahan
c36e806e57
runLs output matching openssh for some stuff
2015-09-06 21:37:33 -07:00
Mark Sheahan
0d8e136458
removing sftp server to client layer; using straight os.* calls
2015-09-06 19:36:47 -07:00
Mark Sheahan
f9e831be30
proper ssh closing sequence
2015-08-05 23:24:33 -07:00
Mark Sheahan
4325c3654b
fix format of 'name' packets (shortname, longname, attrs), add Stat
2015-08-05 12:57:28 -07:00
Mark Sheahan
2f3ef8b897
Merge branch 'master' into server
2015-08-04 21:11:01 -07:00
Mark Sheahan
0f2bc1aa17
server is passing the client integration tests now. I don't understand the ATTRs field, it has a name in it.
2015-07-31 23:09:51 -07:00
Mark Sheahan
435f753792
readdir, rename, remove
2015-07-31 15:46:13 -07:00
Mark Sheahan
7ab0966023
readonly (only for open right now)
2015-07-30 23:43:00 -07:00
Mark Sheahan
bf6b5bce28
fstat
2015-07-30 09:21:59 -07:00
Mark Sheahan
c9cee8ac6f
implement write
2015-07-29 17:37:58 -07:00
Mark Sheahan
2888b4a6b1
implement read
2015-07-29 17:24:24 -07:00