summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2019-09-15replace use of try! with ? operatorWez Furlong
This fixes the CI build with nightly, as we have deny(warnings) enabled.
2019-08-02tighten up `Session::rc`Wez Furlong
Previously, this function could return None even if passed an error result. This could happen in situations where no error had been recorded against the session object, but where libssh2 had returned an error condition anyway. It was also possible for the prior implementation to return the wrong information in a similar situation: if an error had been recorded against the session, that error would be returned rather than the current error code. This commit tidies up the implementation of this function by always returning an `Error` object that corresponds to the provided `rc` parameter. If the last error message recorded against the `Session` has a matching error value then that error message will be used, otherwise we'll synthesize one just from the error code.
2019-08-02handle_extended_dataWez Furlong
Add a function to configure how extended data streams are to be handled. This allows for merging stderr to stdout, or discarding it.
2019-08-01ignore the panic result from the keyboard promptWez Furlong
There's not a lot we can do about it.
2019-08-01don't allow panics to escape the prompt callbackWez Furlong
This avoids the potential for UB if the callback panics; Rust doesn't specify what happens if a panic unwinds back into C code.
2019-08-01fixup rustdocsWez Furlong
2019-08-01move tcpstream assignment to its own functionWez Furlong
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
2019-07-31limit the number of responses from keyboard interactive promptWez Furlong
This makes it safer to accidentally return more than the requested number of responses from the prompt callback. Refs: https://github.com/alexcrichton/ssh2-rs/issues/65
2019-07-31Support keyboard-interactive authenticationWez Furlong
Refs: https://github.com/alexcrichton/ssh2-rs/issues/65
2019-07-31Fix scp_recv ABI issue on WindowsWez Furlong
* Adopt scp_recv2 instead, which uses compatible 64-bit stat types * Mark scp_recv as deprecated * small version bump Fixes https://github.com/alexcrichton/ssh2-rs/issues/109 Refs https://github.com/alexcrichton/ssh2-rs/pull/117 Co-authored-by: Joyce Babu <joyce@ennexa.com>
2019-07-30improve handshake error reporting on windowsWez Furlong
I'm hitting a kex protocol error when talking from windows->ubuntu 19 and that wasn't getting reported as an error on the client side because the `rc` function only emits an error if one has been recorded against the session object, despite being reported via the parameter. I think it's worth revisiting this more broadly, but for now, let's report this error in the handshake case.
2019-07-29Make channel tests more robust to stderr outputWez Furlong
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.
2019-07-29adjust std usage for rust 1.26 compatWez Furlong
2019-07-29Map EAGAIN errors appropriatelyWez Furlong
When the channel is set to non-blocking mode, take care to map the underlying ssh2 error code to the WouldBlock error kind so that embedding applications can correctly handle that situation.
2019-07-29fixup doc testsWez Furlong
`cargo test --all` (which only appears safe to run in the CI environment) doesn't get as far as `cargo test --doc` so I overlooked these.
2019-07-29Avoid panic when SSH_USERAUTH_NONE succeedsWez Furlong
This is an alternative take on addressing this issue: Refs: https://github.com/alexcrichton/ssh2-rs/pull/104
2019-07-29remove SessionBinding traitWez Furlong
I'd gradually removed the usage of it while I was hacking through with my lifetime changes. I suppose it could be added back but I confess that I removed it because I found it confusing and it didn't look like it would fit on my first pass through the code.
2019-07-29KnownHosts no longer borrows Session eitherWez Furlong
2019-07-29Agent no longer borrows session eitherWez Furlong
2019-07-29Channel, Sftp no longer borrow SessionWez Furlong
Instead the internal session is kept alive via Rc Refs: https://github.com/alexcrichton/ssh2-rs/issues/53
2019-07-29Session::handshake now takes ownership of TcpStreamWez Furlong
Refs: https://github.com/alexcrichton/ssh2-rs/issues/17
2019-07-29Session::new() now returns Result rather than OptionWez Furlong
Refs: https://github.com/alexcrichton/ssh2-rs/issues/96 This is a breaking change, so bump the package version
2019-07-29cargo fmtWez Furlong
No functional changes, just formatting
2019-07-29Expose more known_hosts related constantsWez Furlong
This brings us up to date with the current set of host key and known host key enum variants so that we can parse and edit current known_hosts files. This also adds a convenience `From` impl that allows converting from the host key type to a known hosts entry type.
2019-01-03Normalize to Unix-style path separators (#102)cygnus9
2018-12-14Use bitflags 1.X (#97)Jonas Schievink
Also removes the reexported flags from the crate root, since they're now assoc. consts and it would be a bit weird to reexport those. (breaking change)
2018-04-23Update doc urlAlex Crichton
2018-04-14Add libssh2 SFTP error codesBen Reedy
2018-02-16Support in-memory keypair.Eldad Zack
2017-05-23Fix exit_status exampleBrian Olsen
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.
2017-04-21Reexport FileType from sftp moduleAlex Crichton
Closes #63
2017-04-13Return unknown error when none is returned by last_errorAlexandre Bury
Fixes #60
2016-11-26Push init synchronization to sys layerAlex Crichton
2016-11-08Bump dep on bitflagsAlex Crichton
2016-09-27Merge pull request #47 from aidanhs/aphs-fix-libssh2_channel_wait_eof-docAlex Crichton
Fix libssh2 channel wait eof doc
2016-09-16Hide limit_read since it's a hack (see #34)Aidan Hobson Sayers
2016-09-16Fix libssh2_channel_wait_eof doc (see libssh2/libssh2#93)Aidan Hobson Sayers
Closes #34
2016-08-17Add checks for file typesVeselkov Sergey
2016-08-06Bump to 0.2.13Alex Crichton
2016-05-26ssh2::FileStat should derive Eq/PartialEq and Clonesp3d
Copy might constrain the implementation, but these are useful and shouldn't cause any difficulty in the future.
2016-04-28The libssh2 exit_status code effectively never errorsAidan Hobson Sayers
2016-04-04Fix spelling errorRichard Dodd
2016-04-04Allow debug print of FileStatderekdreery
2016-03-23Allow all non-negative return codes as Ok()Charlie Ozinga
All libssh2 functions that return a failure do so using a negative value. However, some functions (for example: https://www.libssh2.org/libssh2_channel_read_ex.html) might return a positive value for success. We should recognize these positive values as Ok() instead of Err(). This is consistent with what Stream<'channel, 'sess>::read and ::write seem to expect in src/channel.rc.
2016-02-15Also ignore return value in `Channel::drop`Alex Crichton
The memory will be leaked if the channel isn't ready to be deallocated, but there's not much we can do about it unfortunately.
2016-02-06Don't assert free returns 0 in a dtorAlex Crichton
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.
2015-11-01Add +1 reservation for trailing zero in write_stringAlex Crichton
2015-10-07Add automated testing of FFI bindingsAlex Crichton
2015-04-29Fix build on windowsAlex Crichton
2015-04-02Update for rust betaAlex Crichton