Age | Commit message (Collapse) | Author |
|
This allows Channel and Stream to be Send
|
|
In earlier iterations I accidentally removed Send from Session and then
later restored it in an unsafe way. This commit restructures the
bindings so that each of the objects holds a reference to the
appropriate thing to keep everything alive safely, without awkward
lifetimes to deal with.
The key to this is that the underlying Session is tracked by an
Arc<Mutex<>>, with the related objects ensuring that they lock this
before they call into the underlying API.
In order to make this work, I've had to adjust the API around iterating
both known hosts and agent identities: previously these would iterate
over internal references but with this shift there isn't a reasonable
way to make that safe. The strategy is instead to return a copy of the
host/identity data and then later look up the associated raw pointer
when needed. The purist in me feels that the copy feels slightly
wasteful, but the realist justifies this with the observation that the
cardinality of both known hosts and identities is typically small enough
that the cost of this is in the noise compared to actually doing the
crypto+network ops.
I've removed a couple of error code related helpers from some of
the objects: those were really internal APIs and were redundant
with methods exported by the Error type anyway.
Fixes: https://github.com/alexcrichton/ssh2-rs/issues/154
Refs: https://github.com/alexcrichton/ssh2-rs/issues/137
|
|
|
|
|
|
|
|
Closes: https://github.com/alexcrichton/ssh2-rs/issues/145
|
|
|
|
|
|
|
|
Refs: https://github.com/alexcrichton/ssh2-rs/issues/137
|
|
|
|
|
|
Debugging a test failure/hang on travis for macos
|
|
Add a function to configure how extended data streams are
to be handled. This allows for merging stderr to stdout, or
discarding it.
|
|
The recent move to take ownership of TcpStream exposed an issue with
the `handshake` method: if the stream is non-blocking then it may
take several attempts to handshake, but only the first one is able
to transfer ownership.
My initial thought was just to make the TcpStream a required parameter
to `new`, but we have some tests that work with known hosts and the
ssh agent that don't require a tcpstream.
I'm going to review those and see if there is a cleaner overall
solution, but that will likely require more substantial API changes.
For now, the simplest change is to add a separate `set_tcp_stream`
function to make the stream ownership transfer explicit and distinct
from the handshake.
Refs: https://github.com/alexcrichton/ssh2-rs/issues/17
|
|
Increase the level of diagnostics in the hope that we learn
more about what's happening with the failure on travis:
https://travis-ci.com/alexcrichton/ssh2-rs/jobs/221391881
|
|
Refs: https://github.com/alexcrichton/ssh2-rs/issues/65
|
|
This makes it possible to run the integration tests without
requiring that the user change their local ssh configuration.
This is desirable because some sites have strict controls over
the local ssh configuration files.
This commit adds a script that spawns a local copy of the ssh
daemon running on an alternate port with a specific configuration
that is known to successfully pass the test suite.
This has only been tested on my local macos machine so far.
|
|
At the start of feb 2019 the tests started to fail on macos on Travis. No
changes were made to the repo, so the problem must be environmental.
It turns out that the server was emitting stderr output, and since the
tests were not consuming stderr, this made `channel.eof()` always
return false.
The resolution is to drain both stdout and stderr in the tests before
making assertions with `channel.eof()`.
I've also updated the doc comment on `channel.eof()` to reflect this,
as it is a bit of a sharp edge.
|
|
Refs: https://github.com/alexcrichton/ssh2-rs/issues/17
|
|
No functional changes, just formatting
|
|
|
|
|
|
In the example in the documentation that calls exit_status and in the
smoke integration test exit_status is called before the channel is
closed and it will therefore always return Ok(0).
I have fixed this by calling wait_close() first and by adding a
bad_smoke test that calls false and checks that the exit_status is 1.
|
|
|
|
|
|
|
|
|
|
|
|
This may return EAGAIN, but we'll just make things worse by aborting. Instead
just unfortunately leak the memory as there's not much more that can be done.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Lots of changes, but largely cosmetic, reorganization, or internal refactorings.
|