Coder Social home page Coder Social logo

ssh2-rs's Introduction

ssh2-rs

Build Status Build Status Build Status

Documentation

Rust bindings to libssh2, an ssh client library.

Usage

# Cargo.toml
[dependencies]
ssh2 = "0.9"

Building on OSX 10.10+

This library depends on OpenSSL. To get OpenSSL working follow the openssl crate's instructions.

Starting with version 0.4 of ssh2, you can enable the vendored-openssl feature to have libssh2 built against a statically built version of openssl as described here

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

ssh2-rs's People

Contributors

aheart avatar aidanhs avatar akosthekiss avatar alexcrichton avatar c0gent avatar crisidev avatar demosdemon avatar globin avatar griff avatar harmic avatar jl710 avatar jwueller avatar krdln avatar magicaltux avatar mcgoo avatar mneumann avatar mod7ex avatar nielx avatar petevine avatar sourcefrog avatar st3iny avatar susu avatar ten0 avatar timmmm avatar twitzelbos avatar ubnt-intrepid avatar vessd avatar wez avatar williamabradley avatar yodaldevoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssh2-rs's Issues

Panic when channel belonging to non-blocking session is dropped

libssh2_channel_free might return -37 (EAGAIN) for a non-blocking session, which causes the assertion in Channel#drop to fail

assert_eq!(raw::libssh2_session_free(self.raw), 0);

While -37 is an error code, it does not really represent an error in this case.

Can be worked around by simply setting the session to blocking again, just before it goes out of scope.

Code sample to reproduce the issue:

    let tcp = TcpStream::connect(REMOTE_HOST)
        .expect("Could not connect to server");
    {
        let mut sess = Session::new().expect("Could not open session");
        sess.handshake(&tcp).expect("Could not complete handshake");

        sess.userauth_pubkey_file(REMOTE_USER, None, Path::new(PUBKEY_PATH), None)
            .expect("Could not authenticate");

        let mut channel = sess.channel_direct_tcpip(FORWARD_HOST_ADDR,
                                                    FORWARD_HOST_PORT,
                                                    None)
            .expect("Could not make direct TCP/IP connection");
        sess.set_blocking(false);
    }

A read limit of 0 should not imply eof

Consider

extern crate ssh2;

fn main() {
        use std::io::prelude::*;
        use std::net::TcpStream;
        use ssh2::Session;

        let tcp = TcpStream::connect("127.0.0.1:22").unwrap();
        let mut sess = Session::new().unwrap();
        sess.handshake(&tcp).unwrap();
        sess.userauth_password("aidanhs", "password").unwrap();
        assert!(sess.authenticated());

        let mut channel = sess.channel_session().unwrap();
        channel.limit_read(0);
        channel.exec("sleep 1; ls").unwrap();
        let mut s = String::new();
        channel.read_to_string(&mut s).unwrap();
        println!("{}", s);
        println!("{}", channel.exit_status().unwrap());
        channel.send_eof().unwrap();
        channel.wait_eof().unwrap();
        channel.close().unwrap();
        println!("eof: {}", channel.eof());
        channel.wait_close().unwrap();

}

Output:

 $ cargo run
   Compiling test v0.1.0 (file:///home/aidanhs/Desktop/hadean/test)
     Running `target/debug/test`

0
eof: true
thread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: -34, msg: "libssh2_channel_wait_closed() invoked when channel is not in EOF state" }', ../src/libcore/result.rs:746
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Process didn't exit successfully: `target/debug/test` (exit code: 101)

There are a couple of things worth noting here:

  1. The important one, eof() returns true but wait_close() complains it's not eof. I've looked at the code and I'm not sure what the correct solution here is, but the current behaviour feels subideal. Comment out limit_read() to make it work.
  2. exit_status() returned 0 even though the command hadn't finished - it should probably be documented that a return code of 0 may mean success or an unfinished process.

Cant build it on Linux/Docker

Log:

error: failed to run custom build command for `libssh2-sys v0.1.39`
rust_1  | process didn't exit successfully: `/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/build-script-build` (exit code: 101)
rust_1  | --- stdout
rust_1  | running: "cmake" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.39/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out" "-DCMAKE_C_FLAGS= -O0 -ffunction-sections -fdata-sections -m64 -fPIC" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -O0 -ffunction-sections -fdata-sections -m64 -fPIC" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=Release"
rust_1  | -- 
rust_1  | -- The following features have been enabled:
rust_1  | 
rust_1  |  * Compression , using zlib for compression
rust_1  |  * diffie-hellman-group-exchange-sha1 , "new" diffie-hellman-group-exchange-sha1 method
rust_1  | 
rust_1  | -- The following REQUIRED packages have been found:
rust_1  | 
rust_1  |  * OpenSSL
rust_1  |  * ZLIB
rust_1  | 
rust_1  | -- The following features have been disabled:
rust_1  | 
rust_1  |  * Shared library , creating libssh2 as a shared library (.so/.dll)
rust_1  |  * "none" cipher
rust_1  |  * "none" MAC
rust_1  |  * Logging , Logging of execution with debug trace
rust_1  | 
rust_1  | -- Configuring incomplete, errors occurred!
rust_1  | See also "/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeOutput.log".
rust_1  | See also "/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeError.log".
rust_1  | 
rust_1  | --- stderr
rust_1  | CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:293 (list):
rust_1  |   list GET given empty list
rust_1  | Call Stack (most recent call first):
rust_1  |   src/CMakeLists.txt:63 (find_package)
rust_1  | 
rust_1  | 
rust_1  | CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:294 (list):
rust_1  |   list GET given empty list
rust_1  | Call Stack (most recent call first):
rust_1  |   src/CMakeLists.txt:63 (find_package)
rust_1  | 
rust_1  | 
rust_1  | CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:296 (list):
rust_1  |   list GET given empty list
rust_1  | Call Stack (most recent call first):
rust_1  |   src/CMakeLists.txt:63 (find_package)
rust_1  | 
rust_1  | 
rust_1  | CMake Error at /usr/share/cmake-3.0/Modules/FindOpenSSL.cmake:298 (list):
rust_1  |   list GET given empty list
rust_1  | Call Stack (most recent call first):
rust_1  |   src/CMakeLists.txt:63 (find_package)
rust_1  | 
rust_1  | 
rust_1  | thread 'main' panicked at '
rust_1  | command did not execute successfully, got: exit code: 1
rust_1  | 
rust_1  | build script failed, must exit now', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.17/src/lib.rs:463
rust_1  | note: Run with `RUST_BACKTRACE=1` for a backtrace.

CMakeError.log:

Determining if files windows.h exist failed with the following output:
Change Dir: /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec2248841779/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2248841779.dir/build.make CMakeFiles/cmTryCompileExec2248841779.dir/build
make[1]: Entering directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec2248841779.dir/CheckIncludeFiles.c.o
/usr/bin/cc   -O0 -ffunction-sections -fdata-sections -m64 -fPIC -Wall    -o CMakeFiles/cmTryCompileExec2248841779.dir/CheckIncludeFiles.c.o   -c /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:21: fatal error: windows.h: No such file or directory
 #include <windows.h>
                     ^
compilation terminated.
CMakeFiles/cmTryCompileExec2248841779.dir/build.make:57: recipe for target 'CMakeFiles/cmTryCompileExec2248841779.dir/CheckIncludeFiles.c.o' failed
make[1]: *** [CMakeFiles/cmTryCompileExec2248841779.dir/CheckIncludeFiles.c.o] Error 1
make[1]: Leaving directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
Makefile:118: recipe for target 'cmTryCompileExec2248841779/fast' failed
make: *** [cmTryCompileExec2248841779/fast] Error 2

Source:
/* */
#include <windows.h>


int main(){return 0;}

Determining if files ws2tcpip.h exist failed with the following output:
Change Dir: /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec363432699/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec363432699.dir/build.make CMakeFiles/cmTryCompileExec363432699.dir/build
make[1]: Entering directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec363432699.dir/CheckIncludeFiles.c.o
/usr/bin/cc   -O0 -ffunction-sections -fdata-sections -m64 -fPIC -Wall    -o CMakeFiles/cmTryCompileExec363432699.dir/CheckIncludeFiles.c.o   -c /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:22: fatal error: ws2tcpip.h: No such file or directory
 #include <ws2tcpip.h>
                      ^
compilation terminated.
CMakeFiles/cmTryCompileExec363432699.dir/build.make:57: recipe for target 'CMakeFiles/cmTryCompileExec363432699.dir/CheckIncludeFiles.c.o' failed
make[1]: Leaving directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec363432699.dir/CheckIncludeFiles.c.o] Error 1
Makefile:118: recipe for target 'cmTryCompileExec363432699/fast' failed
make: *** [cmTryCompileExec363432699/fast] Error 2

Source:
/* */
#include <ws2tcpip.h>


int main(){return 0;}

Determining if files winsock2.h exist failed with the following output:
Change Dir: /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTryCompileExec264664935/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec264664935.dir/build.make CMakeFiles/cmTryCompileExec264664935.dir/build
make[1]: Entering directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building C object CMakeFiles/cmTryCompileExec264664935.dir/CheckIncludeFiles.c.o
/usr/bin/cc   -O0 -ffunction-sections -fdata-sections -m64 -fPIC -Wall    -o CMakeFiles/cmTryCompileExec264664935.dir/CheckIncludeFiles.c.o   -c /rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c
/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp/CheckIncludeFiles.c:2:22: fatal error: winsock2.h: No such file or directory
 #include <winsock2.h>
                      ^
compilation terminated.
CMakeFiles/cmTryCompileExec264664935.dir/build.make:57: recipe for target 'CMakeFiles/cmTryCompileExec264664935.dir/CheckIncludeFiles.c.o' failed
make[1]: Leaving directory '/rust/app/native/target/release/build/libssh2-sys-f3e6ccc6379d9b0b/out/build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec264664935.dir/CheckIncludeFiles.c.o] Error 1
Makefile:118: recipe for target 'cmTryCompileExec264664935/fast' failed
make: *** [cmTryCompileExec264664935/fast] Error 2

Source:
/* */
#include <winsock2.h>


int main(){return 0;}

dockerfile:

FROM scorpil/rust:nightly
# Using Debian, as root
RUN apt-get install -y build-essential
RUN apt-get install -y cmake
RUN apt-get install -y libssl-dev  libssh2-1-dev

Raw handles are not Send for multi-threaded listening.

When trying to handle multiple forward_listen requests on different threads, the following fails:

let (mut listener, _) = session.channel_forward_listen(port, None, None).unwrap();
loop {
  let channel = listener.accept().unwrap();
  thread::spawn(move || {
    let mut s = String::new();
    channel.read_to_string(&mut s).unwrap();
    println!("data: {}", s);
    println!("status: {}", channel.exit_status().unwrap());
  });
}

with the errors:

src/main.rs:22:5: 22:18 error: the trait `core::marker::Send` is not implemented for the type `*mut libssh2_sys::LIBSSH2_CHANNEL` [E0277]
src/main.rs:22     thread::spawn(move || {
                   ^~~~~~~~~~~~~
src/main.rs:22:5: 22:18 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:22:5: 22:18 note: `*mut libssh2_sys::LIBSSH2_CHANNEL` cannot be sent between threads safely
src/main.rs:22:5: 22:18 note: required because it appears within the type `ssh2::channel::Channel<'_>`
src/main.rs:22:5: 22:18 note: required because it appears within the type `[closure@src/main.rs:22:19: 27:6 channel:ssh2::channel::Channel<'_>]`
src/main.rs:22:5: 22:18 note: required by `std::thread::spawn`
src/main.rs:22:5: 22:18 error: the trait `core::marker::Sync` is not implemented for the type `*mut libssh2_sys::LIBSSH2_SESSION` [E0277]
src/main.rs:22     thread::spawn(move || {
                   ^~~~~~~~~~~~~
src/main.rs:22:5: 22:18 help: run `rustc --explain E0277` to see a detailed explanation
src/main.rs:22:5: 22:18 note: `*mut libssh2_sys::LIBSSH2_SESSION` cannot be shared between threads safely
src/main.rs:22:5: 22:18 note: required because it appears within the type `ssh2::session::Session`
src/main.rs:22:5: 22:18 note: required because it appears within the type `ssh2::channel::Channel<'_>`
src/main.rs:22:5: 22:18 note: required because it appears within the type `[closure@src/main.rs:22:19: 27:6 channel:ssh2::channel::Channel<'_>]`
src/main.rs:22:5: 22:18 note: required by `std::thread::spawn`

libssh2 claims to be thread-safe so long as its handles are not simultaneously shared. It would be great if the Rust library could reflect this.

build calls `make` instead of `$MAKE` with `$MAKEFLAGS`

Hi,

on openbsd make is bsd make and gmake is GNU make. If gmake is used to build a cargo project, as is generally required, then it sets $MAKEFLAGS specific to gmake which the bsd make does not understand, but when this crate builds it calls make instead of $MAKE (which would be gmake) and my build fails with this:

make: illegal argument to -j option -- --jobserver-fds=3,4 -- not a number
usage: make [-BeiknpqrSst] [-C directory] [-D variable] [-d flags] [-f mk]
            [-I directory] [-j max_processes] [-m directory] [-V variable]
            [NAME=value] [target ...]
thread '<main>' panicked at '
command did not execute successfully, got: exit code: 2

This is with libssh2-sys v0.1.36 while building cargo 0.9.0.

Interrupt a spawned remote application

Hi Alex, Hi All,

Did you implemented something able to interrupt the execution of a spawned remote application. I am interested in launching a server remotely and after a while interrupt it and launch it again. However, I am currently stucked because the process keeps running.

I am able to do it through bash through the -t option:
ssh -t [user]@[host] '[somepath]/bin/memcached -l 127.0.0.1 -p 1245 -vv'

Can you help me with the rust APIs?
Thanks

Segmentation fault - macOS

Hi,
I'm trying to use this crate on macOS and I'm getting Segmentation fault:
Here is simple code:

extern crate ssh2;
use std::net::TcpStream;
use ssh2::Session;
use std::io::Read;
use std::io::Write;

fn main() {
    let tcp = TcpStream::connect("10.1.1.1:22").unwrap();
    let mut sess = Session::new().unwrap();
    sess.handshake(&tcp).unwrap();
}

And result:

   Finished dev [unoptimized + debuginfo] target(s) in 8.0 secs
Segmentation fault: 11
spock@macspock:~/telnet-client>

Line that is source of this is sess.handshake. Removeing this one and there is no segfault.
Wireshark shows TCP Connection is established..

sftp to chrooted accounts requires chroot base path

ran into this today. i'm pretty sure it's bubbling up from libssh2 as i tried the same with py-ssh2, also libssh2 based, with the same results. paramiko, on the hand, works fine.


extern crate ssh2;
use ssh2::Session;
use std::path::Path;
use std::io::prelude::*;
use std::net::TcpStream;

fn main() {

    let tcp = TcpStream::connect("chrooted.example.com:22").unwrap();
    let mut sess = Session::new().unwrap();
    sess.handshake(&tcp).unwrap();
    
    // make it your own, try either
    sess.userauth_password("CHROOTED_UNAME","CHROOTED_PASSWD").unwrap();
    // or
    // sess.userauth_password("ADMIN_UNAME","ADMIN_PASSWD").unwrap();
   
    let sftp = sess.sftp().unwrap();
    
    let sftp_path = Path::new("/CHROOTED_DIR");
    println!("sftp readdir: {:?}", sftp.readdir(&sftp_path).unwrap());

output:
for the admin group user, all is well:

sftp readdir: Ok([("CHROOTED_DIR", FileStat { size: Some(4096), uid: Some(1006), gid: Some(1002), perm: Some(16877), atime: Some(1518559915), mtime: Some(1518427948) }), ])

for the sftponly (chroot) group user, however:

xxxxx2:~/ru-ssh2/sftp-test$ cargo run
   Compiling sftp-test v0.1.0 (file:///xxxxxx/ru-ssh2/sftp-test)
    Finished dev [unoptimized + debuginfo] target(s) in 0.80 secs
     Running `target/debug/sftp-test`
sftp path: "CHROOTED_DIR"
sftp readdir: Err(Error { code: 2, msg: "unknown error" })

standard chroot setup on Ubuntu 16.04 LTS accessed tens of thousands of times/day via paramiko:

Match group sftponly
    ChrootDirectory /home/%u
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp

py-ssh2/libssh2 code with identical connection pattern and non-discript error:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
from ssh2.session import Session

CHROOT_DIR = 'CHROOT_DIR'
CHROOT_UNAME = 'CHROOT_UNAME'
CHROOT_PASSWD = 'CHROOT_PASSWD'
ADMIN_UNAME = 'ADMIN_UNAME'
ADMIN_PASSWD = 'ADMIN_PASSWD'

host = 'CHROOTED_HOST'

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, 22))
sess = Session()
sess.handshake(sock)
sess.userauth_password(ADMIN_UNAME,ADMIN_PASSWD)
# or 
# sess.userauth_password(CHROOT_UNAME,CHROOT_PASSWD)
sftp = sess.sftp_init()
with sftp.opendir(CHROOT_DIR) as fd:
    for size, buf, attrs in fd.readdir():
        print(f'{size},{buf},{attrs}')

output:

admin group user:
1,b'.',
2,b'..',
11,b'CHROOTED_DIR',

chrooted user:
Traceback (most recent call last):
  File "py_ssh2_test.py", line 22, in 
    with sftp.opendir(CHROOT_DIR) as fd:
AttributeError: __enter__

How to use interactive shell?

How can I perform few commands in one shell?

For example, how to run sudo, write password to it, gain privileges, and do something after with privileges?

I have tried:

    channel.exec("sudo -s");
    println!("Writing password");
    channel.write_all(b"q\n").unwrap();
    println!("executing whoami");
    channel.exec("whoami");
    println!("whoami executed, reading");
    channel.read_to_string(&mut stdin).unwrap();
    println!("WHOAMI: {}", stdin);

But that does not work, it hangs on reading. Don't tell me how to avoid calling sudo or anything else please, I need exactly this workflow to implement.

P.S. It seems for me that each exec call does not take into account previous calls so whoami will not be executed as root but as regular user.

error: linking with `cc` failed: exit code: 1 -- when creating a session

I'm trying to create a new Session:

extern crate ssh2;

use std::net::TcpStream;
use ssh2::Session;

fn main() {
    let tcp = TcpStream::connect("HOST:PORT").unwrap();
    let mut sess = Session::new().unwrap();
}

Whenever the compiler gets to:

let mut sess = Session::new().unwrap();

I receive the following output/error:

$ cargo build --verbose
   Compiling pkg-config v0.3.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/pkg-config-0.3.6/src/lib.rs --crate-name pkg_config --crate-type lib -g -C metadata=376a9590956a17f5 -C extra-filename=-376a9590956a17f5 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling bitflags v0.1.1
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/bitflags-0.1.1/src/lib.rs --crate-name bitflags --crate-type lib -g -C metadata=dd68b8369bcd8ff0 -C extra-filename=-dd68b8369bcd8ff0 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
   Compiling libc v0.1.10
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libc-0.1.10/rust/src/liblibc/lib.rs --crate-name libc --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"cargo-build\" -C metadata=144c435538abd757 -C extra-filename=-144c435538abd757 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh winapi-build v0.1.1
       Fresh winapi v0.2.4
   Compiling gcc v0.3.18
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/gcc-0.3.18/src/lib.rs --crate-name gcc --crate-type lib -g -C metadata=b8d5fe529fb07965 -C extra-filename=-b8d5fe529fb07965 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --cap-lints allow`
       Fresh advapi32-sys v0.1.2
   Compiling openssl-sys v0.6.6
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.6/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --cap-lints allow`
   Compiling libz-sys v0.1.8
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
   Compiling cmake v0.1.7
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/cmake-0.1.7/src/lib.rs --crate-name cmake --crate-type lib -g -C metadata=0e45705c7ddf317f -C extra-filename=-0e45705c7ddf317f --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern gcc=/Users/Michael/Desktop/connector/target/debug/deps/libgcc-b8d5fe529fb07965.rlib --cap-lints allow`
     Running `/Users/Michael/Desktop/connector/target/debug/build/libz-sys-e8e1552876cd3abe/build-script-build`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libz-sys-0.1.8/src/lib.rs --crate-name libz_sys --crate-type lib -g -C metadata=e8e1552876cd3abe -C extra-filename=-e8e1552876cd3abe --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow -L native=/usr/lib -l z`
     Running `/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/build-script-build`
   Compiling libssh2-sys v0.1.30
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.30/build.rs --crate-name build_script_build --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140 --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern pkg_config=/Users/Michael/Desktop/connector/target/debug/deps/libpkg_config-376a9590956a17f5.rlib --extern cmake=/Users/Michael/Desktop/connector/target/debug/deps/libcmake-0e45705c7ddf317f.rlib --cap-lints allow`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/openssl-sys-0.6.6/src/lib.rs --crate-name openssl_sys --crate-type lib -g -C metadata=33c3e25c3677ea5c -C extra-filename=-33c3e25c3677ea5c --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --cap-lints allow -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out -l ssl -l crypto -l static=openssl_shim`
     Running `/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/build-script-build`
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.30/lib.rs --crate-name libssh2_sys --crate-type lib -g -C metadata=63d236645b9d2140 -C extra-filename=-63d236645b9d2140 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --extern openssl_sys=/Users/Michael/Desktop/connector/target/debug/deps/libopenssl_sys-33c3e25c3677ea5c.rlib --extern libz_sys=/Users/Michael/Desktop/connector/target/debug/deps/liblibz_sys-e8e1552876cd3abe.rlib --cap-lints allow -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -l static=ssh2 -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
   Compiling ssh2 v0.2.8
     Running `rustc /Users/Michael/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.8/src/lib.rs --crate-name ssh2 --crate-type lib -g -C metadata=8434f8243d8a9d70 -C extra-filename=-8434f8243d8a9d70 --out-dir /Users/Michael/Desktop/connector/target/debug/deps --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug/deps -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern bitflags=/Users/Michael/Desktop/connector/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib --extern libc=/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib --extern libssh2_sys=/Users/Michael/Desktop/connector/target/debug/deps/liblibssh2_sys-63d236645b9d2140.rlib --cap-lints allow -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
   Compiling connector v0.1.0 (file:///Users/Michael/Desktop/connector)
     Running `rustc src/main.rs --crate-name connector --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern ssh2=/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out`
error: linking with `cc` failed: exit code: 1
note: "cc" "-m64" "-L" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib" "/Users/Michael/Desktop/connector/target/debug/connector.0.o" "-o" "/Users/Michael/Desktop/connector/target/debug/connector" "-Wl,-force_load,/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libmorestack.a" "-Wl,-dead_strip" "-nodefaultlibs" "/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibssh2_sys-63d236645b9d2140.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibz_sys-e8e1552876cd3abe.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/libbitflags-dd68b8369bcd8ff0.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/libopenssl_sys-33c3e25c3677ea5c.rlib" "/Users/Michael/Desktop/connector/target/debug/deps/liblibc-144c435538abd757.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libstd-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libcollections-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/librustc_unicode-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/librand-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/liballoc-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/liblibc-198068b3.rlib" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib/libcore-198068b3.rlib" "-L" "/Users/Michael/Desktop/connector/target/debug" "-L" "/Users/Michael/Desktop/connector/target/debug/deps" "-L" "/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib" "-L" "/usr/lib" "-L" "/usr/local/Cellar/openssl/1.0.2d_1/lib" "-L" "/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out" "-L" "/usr/local/Cellar/rust/1.3.0/lib/rustlib/x86_64-apple-darwin/lib" "-L" "/Users/Michael/Desktop/connector/.rust/lib/x86_64-apple-darwin" "-L" "/Users/Michael/Desktop/connector/lib/x86_64-apple-darwin" "-l" "z" "-l" "ssl" "-l" "crypto" "-l" "c" "-l" "m" "-l" "System" "-l" "pthread" "-l" "c" "-l" "m" "-l" "compiler-rt"
note: ld: warning: directory not found for option '-L/Users/Michael/Desktop/connector/.rust/lib/x86_64-apple-darwin'
ld: warning: directory not found for option '-L/Users/Michael/Desktop/connector/lib/x86_64-apple-darwin'
Undefined symbols for architecture x86_64:
  "_EVP_aes_256_ctr", referenced from:
      _libssh2_crypt_method_aes256_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_256_ctr)
  "_EVP_aes_192_ctr", referenced from:
      _libssh2_crypt_method_aes192_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_192_ctr)
  "_EVP_aes_128_ctr", referenced from:
      _libssh2_crypt_method_aes128_ctr in liblibssh2_sys-63d236645b9d2140.rlib(crypt.c.o)
     (maybe you meant: __libssh2_EVP_aes_128_ctr)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

error: aborting due to previous error
Could not compile `connector`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name connector --crate-type bin -g --out-dir /Users/Michael/Desktop/connector/target/debug --emit=dep-info,link -L dependency=/Users/Michael/Desktop/connector/target/debug -L dependency=/Users/Michael/Desktop/connector/target/debug/deps --extern ssh2=/Users/Michael/Desktop/connector/target/debug/deps/libssh2-8434f8243d8a9d70.rlib -L native=/Users/Michael/Desktop/connector/target/debug/build/libssh2-sys-63d236645b9d2140/out/lib -L native=/usr/lib -L native=/usr/local/Cellar/openssl/1.0.2d_1/lib -L native=/Users/Michael/Desktop/connector/target/debug/build/openssl-sys-33c3e25c3677ea5c/out` (exit code: 101)

Any idea what might be causing this? I'm running OSX 10.11.

Thanks!

Lifetime on Channel, Sftp

The explicit lifetime needed on Channel and Sftp creates a lot of problems.

First, I asked about creating a struct that holds the socket, the session, and the channels and was told that there isn't any good way to do self-referencing structs in #rust-beginners.

Second, it becomes viral and infects additional traits and generics, leading to errors such as E0207.
rust-lang/rust#25041

From my reading, it sounds like the recommended solution is Rc or similar.

This one design decision is making it look like the project I'm working on may be infeasible to do in Rust. I'm refactoring code to try and dodge the issue, but it's a real pain.

Failes to build with latest libssh2-sys and ssh2-rs versions

Hi

I am trying to use the latest version of ssh2-rs with latest libssh2-sys but if fails to build. I tried on linux and MacOS and fails on both.

In Cargo.toml:

[dependencies]
ssh2 = "*"
log = "*"

Some of the (many) errors:

$ cargo build
   Compiling ssh2 v0.2.9
/Users/??/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.9/src/channel.rs:225:49: 225:55 error: mismatched types:
 expected `u64`,
    found `usize`
(expected u64,
    found usize) [E0308]
/Users/??/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.9/src/channel.rs:225                 exit_signal: convert(self, sig, siglen),
                                                                                                                                        ^~~~~~
/Users/??/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.9/src/channel.rs:225:49: 225:55 help: run `rustc --explain E0308` to see a detailed explanation
/Users/??/.cargo/registry/src/github.com-0a35038f75765ae4/ssh2-0.2.9/src/channel.rs:226:51: 226:57 error: mismatched types:
 expected `u64`,
    found `usize`
(expected u64,
    found usize) [E0308]

CMake could not find OpenSSL on OS X 10.11

I think this is because OS X is moving away from OpenSSL... not sure though.

λ cargo new libssh2-sys-test
λ cd libssh2-sys-test
λ echo '\n[dependencies]\nlibssh2-sys = "0.1.34"\n' >> Cargo.toml
λ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling gcc v0.3.20
   Compiling pkg-config v0.3.6
   Compiling winapi v0.2.5
   Compiling winapi-build v0.1.1
   Compiling libc v0.2.2
   Compiling ws2_32-sys v0.2.1
   Compiling openssl-sys v0.7.1
   Compiling libz-sys v1.0.0
   Compiling cmake v0.1.11
   Compiling libssh2-sys v0.1.34
failed to run custom build command for `libssh2-sys v0.1.34`
Process didn't exit successfully: `/Users/brendan/Desktop/libssh2-sys-test/target/debug/build/libssh2-sys-d5401c54977098a6/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.34/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/Users/brendan/Desktop/libssh2-sys-test/target/debug/build/libssh2-sys-d5401c54977098a6/out" "-DCMAKE_C_FLAGS= -O0 -ffunction-sections -fdata-sections -m64 -fPIC" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring incomplete, errors occurred!
See also "/Users/brendan/Desktop/libssh2-sys-test/target/debug/build/libssh2-sys-d5401c54977098a6/out/build/CMakeFiles/CMakeOutput.log".

--- stderr
CMake Error at /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.3.2/share/cmake/Modules/FindOpenSSL.cmake:334 (find_package_handle_standard_args)
  src/CMakeLists.txt:62 (find_package)


thread '<main>' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /Users/brendan/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/cmake-0.1.11/src/lib.rs:401

I have openssl installed via brew:

λ brew info openssl
openssl: stable 1.0.2d (bottled)
OpenSSL SSL/TLS cryptography library
https://openssl.org/

This formula is keg-only.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

/usr/local/Cellar/openssl/1.0.2d_1 (464 files, 18M)
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/openssl.rb
==> Dependencies
Build: makedepend ✘
==> Options
--universal
    Build a universal binary
--without-check
    Skip build-time tests (not recommended)
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

Maybe there needs to be some validation in the build script to give a better error message for OS X users? This is an issue for installing things like cargo-extras easily, without doing much configuration.

LIBSSH_CHANNEL being freed more than once?

Getting this while calling scp commands, on the surface it doesn't appear I'm doing something obviously wrong, but I'm not sure.

A very quick read of ssh2 and libssh2 itself show that these LIBSSH2_CHANNELs can potentially be passed to libssh2_channel_free() in more than one place like this:

  1. libssh2 itself calls libssh2_channel_free() on the the LIBSSH2_CHANNEL, which happens quite a few places including inside scp_send's error handler
  2. then Channel is dropped in Rust, which also calls libssh2_channel_free()

I started adding code to call libssh2_trace() before running any commands to see why it was trying to free that channel inside libssh2 itself, assuming that's what's actually happening, but from outside of libssh2-sys the raw field in Session is private, so can't be passed as an argument in user code. It might be smart to add a way to trigger that from inside ssh2.

Thanks to anyone who has any ideas :)

test(54200,0x7fffe87de3c0) malloc: *** error for object 0x100d000f0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Process 54200 stopped
* thread #1: tid = 0x45e2129, 0x00007fffdfc50147 libsystem_malloc.dylib`malloc_error_break, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x00007fffdfc50147 libsystem_malloc.dylib`malloc_error_break
libsystem_malloc.dylib`malloc_error_break:
->  0x7fffdfc50147 <+0>: pushq  %rbp
0x7fffdfc50148 <+1>: movq   %rsp, %rbp
0x7fffdfc5014b <+4>: nop    
0x7fffdfc5014c <+5>: nopl   (%rax)
(lldb) bt
* thread #1: tid = 0x45e2129, 0x00007fffdfc50147 libsystem_malloc.dylib`malloc_error_break, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
* frame #0: 0x00007fffdfc50147 libsystem_malloc.dylib`malloc_error_break
frame #1: 0x00007fffdfc4201e libsystem_malloc.dylib`free + 409
frame #2: 0x0000000100122179 test`libssh2_default_free + 25
frame #3: 0x000000010010f35c test`_libssh2_channel_free + 476
frame #4: 0x0000000100112c9e test`libssh2_channel_free + 62
frame #5: 0x00000001001218d0 test`scp_send + 2832
frame #6: 0x0000000100121978 test`libssh2_scp_send64 + 72
frame #7: 0x0000000100174d16 test`ssh2::session::{{impl}}::scp_send(self=0x00007fff5fbff718, remote_path=0x0000000100b02540, mode=420, size=1081, times=Option<(u64, u64)> @ 0x00007fff5fbf7930) + 1254 at session.rs:456
frame #8: 0x000000010015dc2e test`sdsync::add_block(db=0x00007fff5fbff808, ssh_session=0x00007fff5fbff718, unique_client_id=(data_ptr = "12345", length = 5), hmac=(data_ptr = "л?Zy?\x82\x8cW⢝\x80Tա?q-\x95??6?m?Id??\a63d6ff853569a0aadec5f247bba51786H??_?, length = 32), key=(data_ptr = "??h\x9d\tA?G?J?k\x99??3?\x1f\x85{???1U???\U00000087?E\x8b HZl??\x806\vC?{\x8c\x85?難\x1e`\x82GA#\x84}3Mz\x9b.??????y\x86?7??&\x9e????\thV!??7\x13?m?\x85#???3a??\"?ȴO?\v?\x87?8R\x1e??̝\x8c*\x96&\x97^\x8f))A????/\x8a?\x06a??A8-i)?\x0e???Z??????\x1c?*?@??E??@K?q~\x89???o?bB??A?e\x95m??\v\x11?\x12?k?(", length = 48), chunk_data=(data_ptr = "?5?HA9?0G?J\x1a?}?\f6??x.\x9d??\x90??u݂\x9c?	R\x8d\x82?5?w??~?01?3\n?o?S\x8c\x8c\x8c?7?JHU??*\x04?J/{?!?1?\\?c?0AVh??:?¸\x01#?e?\"x\x02\x0eM\x1c?@???Q?#\fS??t?Q\x14U?(???f\x89I7???\x91?Y\x15?܎\x97?E&c\x9e\x16?B?\tԤET\bK?Z?C???)\x95F?????BPTL7b,\x1a?i9?\x15??8??/?J\x93*m??=\x92\x8cB\x0e\x1c6?Li?G?\x9a?1?y\x93?\x9c\x80?M?3N\x19??,f\x865}??#j&rG1????\x11??\x1a??^?<_????S\x9e?T\x98s#??ݭ\"\x9e???iE\x19\U0000009b\x87s]\x90?65?kqQ?\x19B0?g\x9c?7?\x82ѻ\x8b0\x03?@?{V?3Il?j?`*??s?Q?\x17~\x80?\x11X?\x1ak\x03?P\bأy?\x11_?2\x1b??p&?}i?I@O?,?/Td???=\x9b????\x9b?}b4M\\?\x8d?Z\x91????XJj4lu\x1b??\x9c\x01\x90?DȔ??\x85\x15\ba??\x82G?xԹ\f\x19?t??\x18\x0f!\x12??S?>\x84?B\x91ȸ\x88F1\x89d\x7fd:C\x86)?g??d\x13\x81?zA?Mh\x059\x97?OE\x84>xY?A\x16[\x19A?&ԑ̂V??Y0\x86\x80??H2)V\x81\x87?=???Wb0\x0fz\x16e_OI?_??\x0e\x18A????\x9b?p0\x06s\x13[\x12hh&??2??m+9??\n̽\x129B^j\x80\x1b?(?\x04A\x98&\x1e'\x86)?E1L?<??\v?d??!6\x88?]?L?x??ftN??治?>h??\x99^RZ+?9??SS???\x7fA?p/?\x12?ר?H?\x0eG\t?Z\x7fc^???ۍ??????X\x8eR??:?\???\x7f\"ws\x86?q????|+\x1c\x97}??T\x8d\x02\x83L??\\C??:???\f??\x88w??r&\bc\"Q_?fn Al??~a?9v\x15?g\x86?Gp\x91KPM\x1a0]?c\x98z?I?N\U0000001d\x8a\x83?x.?#A?, length = 1033)) + 1262 at lib.rs:952
frame #9: 0x000000010015a58e test`sdsync::sdsync_create_archive(context=0x0000000100d00000, folder_id=1) + 7086 at lib.rs:559
frame #10: 0x0000000100001149 test`main + 297
frame #11: 0x00007fffdfabe255 libdyld.dylib`start + 1

Snippet of the setup code being used:

let tcp = TcpStream::connect((ip, port)).unwrap();
let mut ssh_session = Session::new().unwrap();

ssh_session.handshake(&tcp).unwrap();
ssh_session.userauth_password(ssh_username, ssh_password).unwrap();
assert!(ssh_session.authenticated());

Then the Session is passed to another function so this is called repeatedly:

let mut to_write = Vec::new();
to_write.extend(data);
let mut chunk_path = Path::new("/storage/").to_owned();
let mut remote_file = ssh_session.scp_send(&chunk_path, 0o644, to_write.len() as u64, None).unwrap();
remote_file.write(&to_write).unwrap();

libssh2 fails to build with gcc 4.4.7/centos 6 - unrecognized command line option -std=gnu90

The error printed is about some git repo, but I think this is the actual error:

cc1: error: unrecognized command line option "-std=gnu90"

rustc version 1.24.0
cargo version 0.25.0
gcc version 4.4.7

I tried downloading the libssh2 1.8.0 sources and building them by hand on this machine - they ./configure and build ok, so it is not an issue with libssh2 not being buildable with this compiler.

[root@centos65 Foo]# cargo build -vv
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling libc v0.2.37
   Compiling cc v1.0.4
   Compiling pkg-config v0.3.9
     Running `rustc --crate-name libc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.37/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="use_std"' -C metadata=59e008817578ee87 -C extra-filename=-59e008817578ee87 --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --cap-lints warn`
     Running `rustc --crate-name cc /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.4/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=01fd3f704fb11f2e -C extra-filename=-01fd3f704fb11f2e --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --cap-lints warn`
     Running `rustc --crate-name pkg_config /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.9/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=896b6b9906494675 -C extra-filename=-896b6b9906494675 --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --cap-lints warn`
warning: unused import: `std::ascii::AsciiExt`
  --> /root/.cargo/registry/src/github.com-1ecc6299db9ec823/pkg-config-0.3.9/src/lib.rs:67:5
   |
67 | use std::ascii::AsciiExt;
   |     ^^^^^^^^^^^^^^^^^^^^
   |
   = note: #[warn(unused_imports)] on by default

   Compiling libz-sys v1.0.18
   Compiling cmake v0.1.29
   Compiling openssl-sys v0.9.26
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libz-sys-1.0.18/build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=e9d102d11f5e3635 -C extra-filename=-e9d102d11f5e3635 --out-dir /tmp/Foo/target/debug/build/libz-sys-e9d102d11f5e3635 -L dependency=/tmp/Foo/target/debug/deps --extern pkg_config=/tmp/Foo/target/debug/deps/libpkg_config-896b6b9906494675.rlib --extern cc=/tmp/Foo/target/debug/deps/libcc-01fd3f704fb11f2e.rlib --cap-lints warn`
     Running `rustc --crate-name cmake /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.29/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=846d77c8f85f537e -C extra-filename=-846d77c8f85f537e --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --extern cc=/tmp/Foo/target/debug/deps/libcc-01fd3f704fb11f2e.rlib --cap-lints warn`
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.26/build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=6bc9b54748dee815 -C extra-filename=-6bc9b54748dee815 --out-dir /tmp/Foo/target/debug/build/openssl-sys-6bc9b54748dee815 -L dependency=/tmp/Foo/target/debug/deps --extern pkg_config=/tmp/Foo/target/debug/deps/libpkg_config-896b6b9906494675.rlib --extern cc=/tmp/Foo/target/debug/deps/libcc-01fd3f704fb11f2e.rlib --cap-lints warn`
   Compiling libssh2-sys v0.2.6
     Running `rustc --crate-name build_script_build /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.6/build.rs --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=8ed7de87dd81e267 -C extra-filename=-8ed7de87dd81e267 --out-dir /tmp/Foo/target/debug/build/libssh2-sys-8ed7de87dd81e267 -L dependency=/tmp/Foo/target/debug/deps --extern pkg_config=/tmp/Foo/target/debug/deps/libpkg_config-896b6b9906494675.rlib --extern cmake=/tmp/Foo/target/debug/deps/libcmake-846d77c8f85f537e.rlib --cap-lints warn`
     Running `/tmp/Foo/target/debug/build/openssl-sys-6bc9b54748dee815/build-script-build`
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_DIR
cargo:rerun-if-env-changed=OPENSSL_DIR
cargo:rustc-link-lib=ssl
cargo:rustc-link-lib=crypto
OPT_LEVEL = Some("0")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-E" "/tmp/Foo/target/debug/build/openssl-sys-edebd9703df55829/out/expando.c"
exit code: 0
cargo:rustc-cfg=osslconf="OPENSSL_NO_EC2M"
cargo:rustc-cfg=osslconf="OPENSSL_NO_SRP"
cargo:conf=OPENSSL_NO_EC2M,OPENSSL_NO_SRP
cargo:rustc-cfg=ossl101
cargo:version=101
     Running `rustc --crate-name openssl_sys /root/.cargo/registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.9.26/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=2ba57442a9da3d97 -C extra-filename=-2ba57442a9da3d97 --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --extern libc=/tmp/Foo/target/debug/deps/liblibc-59e008817578ee87.rlib --cap-lints warn --cfg 'osslconf="OPENSSL_NO_EC2M"' --cfg 'osslconf="OPENSSL_NO_SRP"' --cfg ossl101 -l ssl -l crypto`
     Running `/tmp/Foo/target/debug/build/libz-sys-e9d102d11f5e3635/build-script-build`
cargo:rustc-link-search=native=/usr/lib64
cargo:rustc-link-lib=z
     Running `rustc --crate-name libz_sys /root/.cargo/registry/src/github.com-1ecc6299db9ec823/libz-sys-1.0.18/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=665843ece33ec450 -C extra-filename=-665843ece33ec450 --out-dir /tmp/Foo/target/debug/deps -L dependency=/tmp/Foo/target/debug/deps --extern libc=/tmp/Foo/target/debug/deps/liblibc-59e008817578ee87.rlib --cap-lints warn -L native=/usr/lib64 -l z`
     Running `/tmp/Foo/target/debug/build/libssh2-sys-8ed7de87dd81e267/build-script-build`
fatal: Not a git repository (or any of the parent directories): .git
running: "cmake" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.6/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/tmp/Foo/target/debug/build/libssh2-sys-cc3d6a502d9c7d34/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=c++" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.1e") 
-- Looking for EVP_aes_128_ctr
-- Looking for EVP_aes_128_ctr - not found
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3") 
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - not found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - not found
-- Looking for include file sys/select.h
-- Looking for include file sys/select.h - not found
-- Looking for include file sys/uio.h
-- Looking for include file sys/uio.h - not found
-- Looking for include file sys/socket.h
-- Looking for include file sys/socket.h - not found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - not found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - not found
-- Looking for include file sys/un.h
-- Looking for include file sys/un.h - not found
-- Looking for include file windows.h
-- Looking for include file windows.h - not found
-- Looking for include file ws2tcpip.h
-- Looking for include file ws2tcpip.h - not found
-- Looking for include file winsock2.h
-- Looking for include file winsock2.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of long long
-- Check size of long long - failed
-- Looking for gettimeofday
-- Looking for gettimeofday - not found
-- Looking for strtoll
-- Looking for strtoll - not found
-- Looking for _strtoi64
-- Looking for _strtoi64 - not found
-- Looking for snprintf
-- Looking for snprintf - not found
-- Looking for poll
-- Looking for poll - not found
-- Looking for socket
-- Looking for socket - not found
-- Looking for socket in socket
-- Looking for socket in socket - not found
-- Looking for socket in ws2_32
-- Looking for socket in ws2_32 - not found
-- Looking for select
-- Looking for select - not found
-- Looking for select in ws2_32
-- Looking for select in ws2_32 - not found
-- Looking for inet_addr
-- Looking for inet_addr - not found
-- Looking for inet_addr in nsl
-- Looking for inet_addr in nsl - not found
-- Looking for inet_addr in ws2_32
-- Looking for inet_addr in ws2_32 - not found
-- Performing Test HAVE_O_NONBLOCK
-- Performing Test HAVE_O_NONBLOCK - Failed
-- Performing Test HAVE_FIONBIO
-- Performing Test HAVE_FIONBIO - Failed
-- Performing Test HAVE_IOCTLSOCKET
-- Performing Test HAVE_IOCTLSOCKET - Failed
-- Performing Test HAVE_IOCTLSOCKET_CASE
-- Performing Test HAVE_IOCTLSOCKET_CASE - Failed
-- Performing Test HAVE_SO_NONBLOCK
-- Performing Test HAVE_SO_NONBLOCK - Failed
-- 
-- The following features have been enabled:

 * Compression , using zlib for compression
 * diffie-hellman-group-exchange-sha1 , "new" diffie-hellman-group-exchange-sha1 method
 * Logging , Logging of execution with debug trace

-- The following REQUIRED packages have been found:

 * OpenSSL
 * ZLIB

-- The following features have been disabled:

 * Shared library , creating libssh2 as a shared library (.so/.dll)
 * "none" cipher
 * "none" MAC

-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER


-- Build files have been written to: /tmp/Foo/target/debug/build/libssh2-sys-cc3d6a502d9c7d34/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--"
Scanning dependencies of target libssh2
[  9%] [  9%] [ 14%] [ 19%] Building C object src/CMakeFiles/libssh2.dir/openssl.c.o
Building C object src/CMakeFiles/libssh2.dir/agent.c.o
Building C object src/CMakeFiles/libssh2.dir/channel.c.o
Building C object src/CMakeFiles/libssh2.dir/comp.c.o
cc1: error: unrecognized command line option "-std=gnu90"
cc1: error: unrecognized command line option "-std=gnu90"
cc1: error: unrecognized command line option "-std=gnu90"
gmake[2]: *** [src/CMakeFiles/libssh2.dir/openssl.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option "-std=gnu90"
gmake[2]: *** [src/CMakeFiles/libssh2.dir/channel.c.o] Error 1
gmake[2]: *** [src/CMakeFiles/libssh2.dir/comp.c.o] Error 1
gmake[2]: *** [src/CMakeFiles/libssh2.dir/agent.c.o] Error 1
gmake[1]: *** [src/CMakeFiles/libssh2.dir/all] Error 2
gmake: *** [all] Error 2
thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.29/src/lib.rs:632:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: failed to run custom build command for `libssh2-sys v0.2.6`
process didn't exit successfully: `/tmp/Foo/target/debug/build/libssh2-sys-8ed7de87dd81e267/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.6/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/tmp/Foo/target/debug/build/libssh2-sys-cc3d6a502d9c7d34/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=c++" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is GNU 4.4.7
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.1e") 
-- Looking for EVP_aes_128_ctr
-- Looking for EVP_aes_128_ctr - not found
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3") 
-- Looking for include file unistd.h
-- Looking for include file unistd.h - not found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - not found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - not found
-- Looking for include file sys/select.h
-- Looking for include file sys/select.h - not found
-- Looking for include file sys/uio.h
-- Looking for include file sys/uio.h - not found
-- Looking for include file sys/socket.h
-- Looking for include file sys/socket.h - not found
-- Looking for include file sys/ioctl.h
-- Looking for include file sys/ioctl.h - not found
-- Looking for include file sys/time.h
-- Looking for include file sys/time.h - not found
-- Looking for include file sys/un.h
-- Looking for include file sys/un.h - not found
-- Looking for include file windows.h
-- Looking for include file windows.h - not found
-- Looking for include file ws2tcpip.h
-- Looking for include file ws2tcpip.h - not found
-- Looking for include file winsock2.h
-- Looking for include file winsock2.h - not found
-- Looking for sys/types.h
-- Looking for sys/types.h - not found
-- Looking for stdint.h
-- Looking for stdint.h - not found
-- Looking for stddef.h
-- Looking for stddef.h - not found
-- Check size of long long
-- Check size of long long - failed
-- Looking for gettimeofday
-- Looking for gettimeofday - not found
-- Looking for strtoll
-- Looking for strtoll - not found
-- Looking for _strtoi64
-- Looking for _strtoi64 - not found
-- Looking for snprintf
-- Looking for snprintf - not found
-- Looking for poll
-- Looking for poll - not found
-- Looking for socket
-- Looking for socket - not found
-- Looking for socket in socket
-- Looking for socket in socket - not found
-- Looking for socket in ws2_32
-- Looking for socket in ws2_32 - not found
-- Looking for select
-- Looking for select - not found
-- Looking for select in ws2_32
-- Looking for select in ws2_32 - not found
-- Looking for inet_addr
-- Looking for inet_addr - not found
-- Looking for inet_addr in nsl
-- Looking for inet_addr in nsl - not found
-- Looking for inet_addr in ws2_32
-- Looking for inet_addr in ws2_32 - not found
-- Performing Test HAVE_O_NONBLOCK
-- Performing Test HAVE_O_NONBLOCK - Failed
-- Performing Test HAVE_FIONBIO
-- Performing Test HAVE_FIONBIO - Failed
-- Performing Test HAVE_IOCTLSOCKET
-- Performing Test HAVE_IOCTLSOCKET - Failed
-- Performing Test HAVE_IOCTLSOCKET_CASE
-- Performing Test HAVE_IOCTLSOCKET_CASE - Failed
-- Performing Test HAVE_SO_NONBLOCK
-- Performing Test HAVE_SO_NONBLOCK - Failed
-- 
-- The following features have been enabled:

 * Compression , using zlib for compression
 * diffie-hellman-group-exchange-sha1 , "new" diffie-hellman-group-exchange-sha1 method
 * Logging , Logging of execution with debug trace

-- The following REQUIRED packages have been found:

 * OpenSSL
 * ZLIB

-- The following features have been disabled:

 * Shared library , creating libssh2 as a shared library (.so/.dll)
 * "none" cipher
 * "none" MAC

-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/Foo/target/debug/build/libssh2-sys-cc3d6a502d9c7d34/out/build
running: "cmake" "--build" "." "--target" "install" "--config" "Debug" "--"
Scanning dependencies of target libssh2
[  9%] [  9%] [ 14%] [ 19%] Building C object src/CMakeFiles/libssh2.dir/openssl.c.o
Building C object src/CMakeFiles/libssh2.dir/agent.c.o
Building C object src/CMakeFiles/libssh2.dir/channel.c.o
Building C object src/CMakeFiles/libssh2.dir/comp.c.o
cc1: error: unrecognized command line option "-std=gnu90"
cc1: error: unrecognized command line option "-std=gnu90"
cc1: error: unrecognized command line option "-std=gnu90"
gmake[2]: *** [src/CMakeFiles/libssh2.dir/openssl.c.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....
cc1: error: unrecognized command line option "-std=gnu90"
gmake[2]: *** [src/CMakeFiles/libssh2.dir/channel.c.o] Error 1
gmake[2]: *** [src/CMakeFiles/libssh2.dir/comp.c.o] Error 1
gmake[2]: *** [src/CMakeFiles/libssh2.dir/agent.c.o] Error 1
gmake[1]: *** [src/CMakeFiles/libssh2.dir/all] Error 2
gmake: *** [all] Error 2

--- stderr
fatal: Not a git repository (or any of the parent directories): .git
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER


thread 'main' panicked at '
command did not execute successfully, got: exit code: 2

build script failed, must exit now', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.29/src/lib.rs:632:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.
[root@centos65 Foo]# gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC) 

0.2.14 has breaking change

After release of ssh2 0.2.14 each my "cargo build" fails with error:

 Updating registry `https://github.com/rust-lang/crates.io-index`
error: native library `openssl` is being linked to by more than one version of the same package, but it can only be linked once; try updating or pinning your dependencies to ensure that this package only shows up once

  openssl-sys v0.7.17
  openssl-sys v0.9.0

After that I have to manually edit Cargo.lock to revert changes in dependencies back.

I understand my problem is a drop in the sea and generally it's not the problem of this crate, but could you please version it not as third number change (minor), to don't let Cargo automatically update dependency to next version?

Dependencies are declared explicitly, without "~" or "^", but Cargo is trying to update version anyway:

ssh2 = "0.2.13"
openssl = "0.7.14"
openssl-sys = "0.7.17"
libssh2-sys = "0.1.39"

0.2.6 fatal: Not a git repository

I'm not sure why this issue occurs. I've installed libssl-dev and other dependencies. I don't understand what a "not a Git repository" error is doing in a build log.

I was trying to install a new version of Cargo with cargo install cargo --force, then I got the same error for cargo install cargo-update.

  • rustc 1.20.0-nightly (445077963 2017-06-20)
  • cargo 0.21.0-nightly (50b1c24d1 2017-06-17)

Log for cargo install cargo-update:

    Updating registry `https://github.com/rust-lang/crates.io-index`
  Installing cargo-update v1.1.1
   Compiling void v1.0.2
   Compiling serde v1.0.8
   Compiling percent-encoding v1.0.0
   Compiling regex-syntax v0.4.1
   Compiling embed-resource v1.1.2
   Compiling unicode-normalization v0.1.5
   Compiling gcc v0.3.51
   Compiling array_tool v0.4.0
   Compiling json v0.11.6
   Compiling unicode-segmentation v1.1.0
   Compiling utf8-ranges v1.0.0
   Compiling matches v0.1.6
   Compiling libc v0.2.24
   Compiling ansi_term v0.9.0
   Compiling pkg-config v0.3.9
   Compiling openssl-probe v0.1.1
   Compiling lazy_static v0.2.8
   Compiling strsim v0.6.0
   Compiling bitflags v0.9.1
   Compiling quote v0.3.15
   Compiling semver-parser v0.7.0
   Compiling unicode-width v0.1.4
   Compiling vec_map v0.8.0
   Compiling unicode-xid v0.0.4
   Compiling unreachable v0.1.1
   Compiling cargo-update v1.1.1
   Compiling unicode-bidi v0.3.3
   Compiling thread-id v3.1.0
   Compiling atty v0.2.2
   Compiling memchr v1.0.1
   Compiling rand v0.3.15
   Compiling term_size v0.3.0
   Compiling tabwriter v1.0.3
   Compiling synom v0.11.3
   Compiling thread_local v0.3.3
   Compiling semver v0.6.0
   Compiling textwrap v0.6.0
   Compiling aho-corasick v0.6.3
   Compiling cmake v0.1.24
   Compiling curl-sys v0.3.12
   Compiling openssl-sys v0.9.14
   Compiling libz-sys v1.0.16
   Compiling syn v0.11.11
   Compiling lazysort v0.1.1
   Compiling toml v0.4.1
   Compiling clap v2.25.0
   Compiling idna v0.1.2
   Compiling libgit2-sys v0.6.12
   Compiling libssh2-sys v0.2.6
   Compiling regex v0.2.2
   Compiling url v1.5.0
error: failed to run custom build command for `libssh2-sys v0.2.6`
process didn't exit successfully: `/tmp/cargo-install.gZuO2k8v7E9P/release/build/libssh2-sys-bb7729048b38b82a/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/home/willem/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.2.6/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/tmp/cargo-install.gZuO2k8v7E9P/release/build/libssh2-sys-79db7a683b1f9e4b/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_COMPILER=/usr/bin/c++" "-DCMAKE_BUILD_TYPE=Release"

--- stderr
fatal: Not a git repository (or any of the parent directories): .git
thread 'main' panicked at '
failed to execute command: No such file or directory (os error 2)
is `cmake` not installed?

build script failed, must exit now', /home/willem/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.24/src/lib.rs:593
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:371
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:511
   6: std::panicking::begin_panic_fmt
             at /checkout/src/libstd/panicking.rs:495
   7: cmake::fail
   8: cmake::run
   9: cmake::Config::build
  10: build_script_build::main
  11: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  12: std::rt::lang_start
             at /checkout/src/libstd/panicking.rs:433
             at /checkout/src/libstd/panic.rs:361
             at /checkout/src/libstd/rt.rs:59
  13: __libc_start_main
  14: <unknown>

warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-update v1.1.1`, intermediate artifacts can be found at `/tmp/cargo-install.gZuO2k8v7E9P`

Caused by:
  build failed

scp_send stops at 16KB

All my scp_send requests stop at 16 KB (I'm not sure if it's my code that has an issue). I checked the size of the file I'm writing and it is 1962294272 bytes (about 2GB), could that be the problem?

How to use thread

i want use this lib like terminal but use thread tell me this

src/main.rs:82:23: 82:36 error: the trait `core::marker::Send` is not implemented for the type `*mut libssh2_sys::LIBSSH2_CHANNEL` [E0277]
src/main.rs:82     let thread_join = thread::spawn(move || {
                                     ^~~~~~~~~~~~~

Issues caused by unexpected semver version handling

Hi

I have a crate which depends on both ssh2 and hyper. Hyper is using openssl-sys 0.6.7 but ssh2-rs is using libssh2-sys which moved to openssl-sys 0.7.0 recently, without changing the MINOR version. This creates issues:

$ cargo build
native library `openssl` is being linked to by more than one package, and can only be linked to by one package

  openssl-sys v0.6.7
  openssl-sys v0.7.0

The workaround is to explicitly specify libssh2-sys older version in Cargo.toml, which is strange as I am only directly using ssh2-rs so I should not care about its dependencies:

[dependencies]
ssh2 = "0.2.9"
libssh2-sys = "=0.1.31"

I think openssh2-sys should increase the minor version when any of its dependencies is bumped with a new minor version. Then ssh2-rs should also raise the minor version accordingly when moving to the new libssh2-sys.That should make it possible for the user to control everything by specifying the ssh2-rs version only. I guess this is a lot of work as rust tends to favour many small crates but I think it is the right approach. Might also be a good idea if cratos.io force this kind of behaviour.

ZLIB_INCLUDE_DIR ,missing, though zlib is in scope

Hi,

I'm having a problem that ZLIB_INCLUDE_DIR is missing when compiling libssh2-sys, though zlib is in scope. I also tried to bring pkgconfig and/or libtool in scope (I guess they are used to find libraries sometimes, right), but it didn't help.

here's the build output:

   Compiling libssh2-sys v0.1.37
error: failed to run custom build command for `libssh2-sys v0.1.37`
Process didn't exit successfully: `/home/m/archive/development/rust/imag/libimagstorestdhook/target/debug/build/libssh2-sys-cbc6fdd97830bc3a/build-script-build` (exit code: 101)
--- stdout
running: "cmake" "/home/m/.cargo/registry/src/github.com-88ac128001ac3a9a/libssh2-sys-0.1.37/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/home/m/archive/development/rust/imag/libimagstorestdhook/target/debug/build/libssh2-sys-cbc6fdd97830bc3a/out" "-DCMAKE_C_FLAGS= -O0 -ffunction-sections -fdata-sections -m64 -fPIC" "-DCMAKE_C_COMPILER=/nix/store/6rfvkcxwglqxq08kh7w8a08p533m39gj-gcc-wrapper-5.3.0/bin/gcc" "-DCMAKE_CXX_FLAGS= -O0 -ffunction-sections -fdata-sections -m64 -fPIC" "-DCMAKE_CXX_COMPILER=/nix/store/6rfvkcxwglqxq08kh7w8a08p533m39gj-gcc-wrapper-5.3.0/bin/g++" "-DCMAKE_BUILD_TYPE=Debug"
-- Configuring incomplete, errors occurred!
See also "/home/m/archive/development/rust/imag/libimagstorestdhook/target/debug/build/libssh2-sys-cbc6fdd97830bc3a/out/build/CMakeFiles/CMakeOutput.log".

--- stderr
CMake Error at /nix/store/0l3swqskvpqndhcz22qp45x61d34fsxr-cmake-3.4.3/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
Call Stack (most recent call first):
  /nix/store/0l3swqskvpqndhcz22qp45x61d34fsxr-cmake-3.4.3/share/cmake-3.4/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
  /nix/store/0l3swqskvpqndhcz22qp45x61d34fsxr-cmake-3.4.3/share/cmake-3.4/Modules/FindZLIB.cmake:124 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  src/CMakeLists.txt:213 (find_package)


thread '<main>' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/m/.cargo/registry/src/github.com-88ac128001ac3a9a/cmake-0.1.17/src/lib.rs:463
note: Run with `RUST_BACKTRACE=1` for a backtrace.

error: third party subcommand `cargo-check` exited unsuccessfully

To learn more, run the command again with --verbose.

I'm needing this library for implementing https://github.com/matthiasbeyer/imag/pull/486 which uses the git2 crate which needs ssh-rs afaik.

Failed to build on OS X 10.10

I cannot build the ssh2 library on OS X any longer. Here is the log:

$ cargo build
   Compiling gcc v0.3.8
   Compiling pkg-config v0.3.5
   Compiling libc v0.1.8
   Compiling bitflags v0.1.1
   Compiling log v0.3.1
   Compiling libssh2-sys v0.1.25
   Compiling libz-sys v0.1.6
   Compiling openssl-sys v0.6.2
failed to run custom build command for `libssh2-sys v0.1.25`
Process didn't exit successfully: `<filtered>/projects/rust/<filtered>/target/debug/build/libssh2-sys-4edc1b7b6d8a6bc4/build-script-build` (exit code: 101)
--- stdout
running: "<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/configure" "--enable-shared=no" "--disable-examples-build" "--prefix=<filtered>/projects/rust/<filtered>/target/debug/build/libssh2-sys-4edc1b7b6d8a6bc4/out"
checking whether to enable maintainer-specific portions of Makefiles... no
checking for sed... /usr/bin/sed
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking libssh2 version... 1.5.0
checking build system type... x86_64-apple-darwin14.4.0
checking host system type... x86_64-apple-darwin14.4.0
configure: autobuild project... libssh2
configure: autobuild revision... 1.5.0
configure: autobuild hostname... <filtered>.lan
configure: autobuild timestamp... 20150711-133444
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for long long... yes
checking if _REENTRANT is already defined... no
checking if _REENTRANT is actually needed... no
checking if _REENTRANT is onwards defined... no
checking for library containing socket... none required
checking for library containing inet_addr... none required
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking whether ln -s works... yes
checking whether make sets $(MAKE)... (cached) yes
checking for sshd... /usr/sbin/sshd
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /usr/bin/sed
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm
checking the name lister (/usr/bin/nm) interface... BSD nm
checking the maximum length of command line arguments... 196608
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-apple-darwin14.4.0 file names to x86_64-apple-darwin14.4.0 format... func_convert_file_noop
checking how to convert x86_64-apple-darwin14.4.0 file names to toolchain format... func_convert_file_noop
checking for /Library/Developer/CommandLineTools/usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... dlltool
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm output from gcc object... ok
checking for sysroot... no
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Library/Developer/CommandLineTools/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin14.4.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether byte ordering is bigendian... no
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for ld used by GCC... /Library/Developer/CommandLineTools/usr/bin/ld
checking if the linker (/Library/Developer/CommandLineTools/usr/bin/ld) is GNU ld... no
checking for shared library run path origin... done
checking for libssl... yes
checking how to link with libssl... -lssl -lcrypto
checking for EVP_aes_128_ctr... yes
checking for libz... yes
checking how to link with libz... -lz
checking whether to enable pedantic and debug compiler options... no
checking whether to enable hidden symbols in the library... no
checking whether to build example applications... no
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/uio.h usability... yes
checking sys/uio.h presence... yes
checking for sys/uio.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking windows.h usability... no
checking windows.h presence... no
checking for windows.h... no
checking winsock2.h usability... no
checking winsock2.h presence... no
checking for winsock2.h... no
checking ws2tcpip.h usability... no
checking ws2tcpip.h presence... no
checking for ws2tcpip.h... no
configure: poll use is disabled on this platform
checking for gettimeofday... yes
checking for select... yes
checking for strtoll... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking non-blocking sockets style... O_NONBLOCK
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating example/Makefile
config.status: creating docs/Makefile
config.status: creating libssh2.pc
config.status: creating src/libssh2_config.h
config.status: creating example/libssh2_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: summary of build options:

  version:          1.5.0
  Host type:        x86_64-apple-darwin14.4.0
  Install prefix:   <filtered>/projects/rust/<filtered>/target/debug/build/libssh2-sys-4edc1b7b6d8a6bc4/out
  Compiler:         gcc
  Compiler flags:    -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN
  Library types:    Shared=no, Static=yes
  Crypto library:   OpenSSL (AES-CTR: yes)
  Debug build:      no
  Build examples:   no
  Path to sshd:     /usr/sbin/sshd (only for self-tests)
  zlib compression: yes

running: "make" "-j4"
/Library/Developer/CommandLineTools/usr/bin/make  all-am
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H   -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src   -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT channel.lo -MD -MP -MF .deps/channel.Tpo -c -o channel.lo <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/channel.c
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H   -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src   -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT comp.lo -MD -MP -MF .deps/comp.Tpo -c -o comp.lo <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/comp.c
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H   -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src   -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT crypt.lo -MD -MP -MF .deps/crypt.Tpo -c -o crypt.lo <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H   -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src   -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT hostkey.lo -MD -MP -MF .deps/hostkey.Tpo -c -o hostkey.lo <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT comp.lo -MD -MP -MF .deps/comp.Tpo -c <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/comp.c -o comp.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT hostkey.lo -MD -MP -MF .deps/hostkey.Tpo -c <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c -o hostkey.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT channel.lo -MD -MP -MF .deps/channel.Tpo -c <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/channel.c -o channel.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/include -I../src -ffunction-sections -fdata-sections -m64 -fPIC -DLIBSSH2_DARWIN -MT crypt.lo -MD -MP -MF .deps/crypt.Tpo -c <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c -o crypt.o
mv -f .deps/comp.Tpo .deps/comp.Plo
mv -f .deps/hostkey.Tpo .deps/hostkey.Plo
mv -f .deps/channel.Tpo .deps/channel.Plo

--- stderr
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/missing: Unknown `--is-lightweight' option
Try `<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/missing --help' for more information
configure: WARNING: 'missing' script is too old or missing
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:175:9: warning: 'EVP_DigestUpdate' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
        libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:111:45: note: expanded from macro 'libssh2_sha1_update'
#define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
                                            ^
/usr/include/openssl/evp.h:556:5: note: 'EVP_DigestUpdate' has been explicitly marked deprecated here
int     EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:177:5: warning: 'EVP_DigestFinal' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    libssh2_sha1_final(ctx, hash);
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:112:38:<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:112:9: warning: 'EVP_CIPHER_CTX_cleanup' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
 note: expanded from macro 'libssh2_sha1_final'
        _libssh2_cipher_dtor(&(*cctx)->h);
        ^
#define libssh2_sha1_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
                                     ^
/usr/include/openssl/evp.h:564:5: note: 'EVP_DigestFinal' has been explicitly marked deprecated here
int     EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:199:5: warning: 'RSA_free' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_rsa_free(rsactx);
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:140:35: note: expanded from macro '_libssh2_rsa_free'
#define _libssh2_rsa_free(rsactx) RSA_free(rsactx)
                                  ^
/usr/include/openssl/rsa.h:282:6: note: 'RSA_free' has been explicitly marked deprecated here
void    RSA_free (RSA *r) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:167:35: note: expanded from macro '_libssh2_cipher_dtor'
#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_cleanup(ctx)
                                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:359:9: warning: 'EVP_DigestUpdate' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
/usr/include/openssl/evp.h:637:5: note: 'EVP_CIPHER_CTX_cleanup' has been explicitly marked deprecated here
        libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:111:45: note: expanded from macro 'libssh2_sha1_update'
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
#define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
                                            ^
/usr/include/openssl/evp.h:556:5: note: 'EVP_DigestUpdate' has been explicitly marked deprecated here
int     EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:361:5: warning: 'EVP_DigestFinal' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    libssh2_sha1_final(ctx, hash);
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:112:38: note: expanded from macro 'libssh2_sha1_final'
#define libssh2_sha1_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
                                     ^
/usr/include/openssl/evp.h:564:5: note: 'EVP_DigestFinal' has been explicitly marked deprecated here
int     EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/hostkey.c:382:5: warning: 'DSA_free' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_dsa_free(dsactx);
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:145:35: note: expanded from macro '_libssh2_dsa_free'
#define _libssh2_dsa_free(dsactx) DSA_free(dsactx)
                                  ^
/usr/include/openssl/dsa.h:222:6: note: 'DSA_free' has been explicitly marked deprecated here
void    DSA_free (DSA *r) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:129:5: error: use of undeclared identifier 'EVP_aes_128_ctr'; did you mean 'EVP_aes_128_cbc'?
    _libssh2_cipher_aes128ctr
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    EVP_aes_128_cbc
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:154:35: note: expanded from macro '_libssh2_cipher_aes128ctr'
#define _libssh2_cipher_aes128ctr EVP_aes_128_ctr
                                  ^
/usr/include/openssl/evp.h:759:19: note: 'EVP_aes_128_cbc' declared here
const EVP_CIPHER *EVP_aes_128_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:129:5: warning: 'EVP_aes_128_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes128ctr
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:154:35: note: expanded from macro '_libssh2_cipher_aes128ctr'
#define _libssh2_cipher_aes128ctr EVP_aes_128_ctr
                                  ^
/usr/include/openssl/evp.h:759:19: note: 'EVP_aes_128_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_128_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:141:5: error: use of undeclared identifier 'EVP_aes_192_ctr'; did you mean 'EVP_aes_192_cbc'?
    _libssh2_cipher_aes192ctr
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    EVP_aes_192_cbc
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:155:35: note: expanded from macro '_libssh2_cipher_aes192ctr'
#define _libssh2_cipher_aes192ctr EVP_aes_192_ctr
                                  ^
/usr/include/openssl/evp.h:769:19: note: 'EVP_aes_192_cbc' declared here
const EVP_CIPHER *EVP_aes_192_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:141:5: warning: 'EVP_aes_192_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes192ctr
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:155:35: note: expanded from macro '_libssh2_cipher_aes192ctr'
#define _libssh2_cipher_aes192ctr EVP_aes_192_ctr
                                  ^
/usr/include/openssl/evp.h:769:19: note: 'EVP_aes_192_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_192_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/channel.c:1135:13: warning: 'RAND_bytes' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
            _libssh2_random(buffer, LIBSSH2_X11_RANDOM_COOKIE_LEN / 2);
            ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:107:35: note: expanded from macro '_libssh2_random'
#define _libssh2_random(buf, len) RAND_bytes ((buf), (len))
                                  ^
/usr/include/openssl/rand.h:104:6: note: 'RAND_bytes' has been explicitly marked deprecated here
int  RAND_bytes(unsigned char *buf,int num) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
     ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:153:5: error: use of undeclared identifier 'EVP_aes_256_ctr'; did you mean 'EVP_aes_256_cbc'?
    _libssh2_cipher_aes256ctr
    ^~~~~~~~~~~~~~~~~~~~~~~~~
    EVP_aes_256_cbc
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:156:35: note: expanded from macro '_libssh2_cipher_aes256ctr'
#define _libssh2_cipher_aes256ctr EVP_aes_256_ctr
                                  ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' declared here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:153:5: warning: 'EVP_aes_256_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes256ctr
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:156:35: note: expanded from macro '_libssh2_cipher_aes256ctr'
#define _libssh2_cipher_aes256ctr EVP_aes_256_ctr
                                  ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:167:5: warning: 'EVP_aes_128_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes128
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:152:32: note: expanded from macro '_libssh2_cipher_aes128'
#define _libssh2_cipher_aes128 EVP_aes_128_cbc
                               ^
/usr/include/openssl/evp.h:759:19: note: 'EVP_aes_128_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_128_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:179:5: warning: 'EVP_aes_192_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes192
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:151:32: note: expanded from macro '_libssh2_cipher_aes192'
#define _libssh2_cipher_aes192 EVP_aes_192_cbc
                               ^
/usr/include/openssl/evp.h:769:19: note: 'EVP_aes_192_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_192_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:191:5: warning: 'EVP_aes_256_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes256
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:150:32: note: expanded from macro '_libssh2_cipher_aes256'
#define _libssh2_cipher_aes256 EVP_aes_256_cbc
                               ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:205:5: warning: 'EVP_aes_256_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_aes256
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:150:32: note: expanded from macro '_libssh2_cipher_aes256'
#define _libssh2_cipher_aes256 EVP_aes_256_cbc
                               ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:219:5: warning: 'EVP_bf_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_blowfish
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:162:34: note: expanded from macro '_libssh2_cipher_blowfish'
#define _libssh2_cipher_blowfish EVP_bf_cbc
                                 ^
/usr/include/openssl/evp.h:738:19: note: 'EVP_bf_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_bf_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:233:5: warning: 'EVP_rc4' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_arcfour
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:163:33: note: expanded from macro '_libssh2_cipher_arcfour'
#define _libssh2_cipher_arcfour EVP_rc4
                                ^
/usr/include/openssl/evp.h:724:19: note: 'EVP_rc4' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_rc4(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
6 warnings generated.
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:268:5: warning: 'EVP_rc4' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_arcfour
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:163:33: note: expanded from macro '_libssh2_cipher_arcfour'
#define _libssh2_cipher_arcfour EVP_rc4
                                ^
/usr/include/openssl/evp.h:724:19: note: 'EVP_rc4' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_rc4(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:282:5: warning: 'EVP_cast5_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_cast5
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:164:31: note: expanded from macro '_libssh2_cipher_cast5'
#define _libssh2_cipher_cast5 EVP_cast5_cbc
                              ^
/usr/include/openssl/evp.h:745:19: note: 'EVP_cast5_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_cast5_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/crypt.c:296:5: warning: 'EVP_des_ede3_cbc' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
    _libssh2_cipher_3des
    ^
<filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/libssh2-1.5.0/src/openssl.h:165:30: note: expanded from macro '_libssh2_cipher_3des'
#define _libssh2_cipher_3des EVP_des_ede3_cbc
                             ^
/usr/include/openssl/evp.h:711:19: note: 'EVP_des_ede3_cbc' has been explicitly marked deprecated here
const EVP_CIPHER *EVP_des_ede3_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
                  ^
13 warnings and 3 errors generated.
make[1]: *** [crypt.lo] Error 1
make[1]: *** Waiting for unfinished jobs....
1 warning generated.
make: *** [all] Error 2
thread '<main>' panicked at 'command did not succeed, exited with: exit code: 2', <filtered>/.cargo/registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.25/build.rs:159

Any clues?

Fail to build on Windows

Hi

I am trying to build a binary which depends on ssh2-rs using cargo on Windows 7. I have msys64 installed and gcc 4.9.2-4.

Are there some instructions available on how to build on windows?

The error I get:

Build failed, waiting for other jobs to finish...
failed to run custom build command for `libssh2-sys v0.1.23`
Process didn't exit successfully: `C:\<edit>\target\debug\build\libssh2-sys-235a8bd8d34c9dc8\build-script-build` (exit code: 101)
--- stdout
running: "make" "-fGNUmakefile" "WITH_WINCNG=1" "WITH_ZLIB=1" "lib"
gcc -O2 -DNDEBUG -DLIBSSH2_WIN32  -fno-builtin -fno-strict-aliasing -Wall  -D_AMD64_ -DLIBSSH2_WINCNG -DLIBSSH2_HAVE_ZLIB -I../win32 -I../include -I../../zlib-1.2.8 -c ../src/channel.c -o release/channel.o
GNUmakefile:232: recipe for target 'release/channel.o' failed

--- stderr
In file included from /usr/include/cygwin/sys_time.h:13:0,
                 from /usr/include/sys/time.h:61,
                 from /usr/include/sys/_default_fcntl.h:196,
                 from /usr/include/sys/fcntl.h:3,
                 from /usr/include/fcntl.h:15,
                 from ../src/channel.c:45:
/usr/include/sys/select.h:31:5: error: conflicting types for ‘select’
 int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
     ^
In file included from ../win32/libssh2_config.h:10:0,
                 from ../src/libssh2_priv.h:44,
                 from ../src/channel.c:41:
/usr/include/w32api/winsock2.h:995:34: note: previous declaration of ‘select’ was here
   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
                                  ^
make: *** [release/channel.o] Error 1
thread '<main>' panicked at 'command did not succeed, exited with: exit code: 2', C:\msys64\<edit>\.cargo\registry\src\github.com-1ecc6299db9ec823\libssh2-sys-0.1.23\build.rs:123

Thanks

ssh2 libc dependency conflict

Currently I experience a build error when using the ssh2 crate from crates.io:

     Compiling ssh2 v0.2.9
  C:/msys/home/willem/.multirust/toolchains/stable/cargo\registry\src\github.com-0a35038f75765ae4\ssh2-0.2.9\src\channel.rs:225:49: 225:55 error: mismatched types:
   expected `u64`,
      found `usize`
  (expected u64,
      found usize) [E0308]
  C:/msys/home/willem/.multirust/toolchains/stable/cargo\registry\src\github.com-0a35038f75765ae4\ssh2-0.2.9\src\channel.rs:225                 exit_signal: convert(self, sig, siglen),

I guess this is related to the 0.1 dependency to libc when ssh2 v0.2.9 was created, and the libc 0.2 dependency the libssh2-sys crate has. When I directly use the master branch of the ssh2 crate, where the libc dependency is set to 0.2, no compilation errors do occur.

Could NOT find ZLIB

Hi! When I try to build cargo on Windows as a library for my program libssh2-rs fails to build with the following error:

toolchain: stable-x86_64-pc-windows-gnu
rustc-version: rustc 1.15.1 (021bd294c 2017-02-08)
OS: Windows 7 64bit
Msys64 installed

error: failed to run custom build command for libssh2-sys v0.2.5
process didn't exit successfully: E:\development\cargo-authors\target\debug\build\libssh2-sys-04373e2a6b69259d\build-script-build (exit code: 101)
--- stdout
running: "cmake" "C:\Users\***\.cargo\registry\src\github.com-1ecc6299db9ec823\libssh2-sys-0.2.5\libssh2" "-G" "MSYS Makefiles" "-DCRYPTO_BACKEND=WinCNG" "-DZLIB_INCLUDE_DIR=E:\development\cargo-authors\target\debug\build\libz-sys-c29f5c61ff9da9c5\out/include" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=E:\development\cargo-authors\target\debug\build\libssh2-sys-9b7d67f8c921632b\out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -m64" "-DCMAKE_BUILD_TYPE=Debug"
-- The C compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/msys64/usr/bin/gcc.exe
-- Check for working C compiler: C:/msys64/usr/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include files windows.h, bcrypt.h
-- Looking for include files windows.h, bcrypt.h - found
-- Looking for include file ntdef.h
-- Looking for include file ntdef.h - found
-- Looking for include file ntstatus.h
-- Looking for include file ntstatus.h - found
-- Looking for include files windows.h, wincrypt.h
-- Looking for include files windows.h, wincrypt.h - found
-- Configuring incomplete, errors occurred!
See also "E:/Development/cargo-authors/target/debug/build/libssh2-sys-9b7d67f8c921632b/out/build/CMakeFiles/CMakeOutput.
log".

--- stderr
fatal: Not a git repository (or any of the parent directories): .git
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8")
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.7/Modules/FindZLIB.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
src/CMakeLists.txt:239 (find_package)

thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users***.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.20\src\lib.rs:573

Connection and general performance

Is there a way how to
Improve performace? I run similar code in golang and rust using this library which is very impressive and in go similar code takes 306-309ms and in rust takes almost dubble around 600ms. One more thing, in go the rusult is very consistent 306,307,309ms where in rust sometimes it can be 490,550,600ms but most of the time it would be two times more than go code. Could it be related to fact that go is just better language for networking? or the library is using threads and they are not efficient as they are in go?

Sessions are unable to be returned

I am try to write some code that will initialize a session in another function but it doesn't seem like a session is able to be returned, and I get a run time error when attempting to use it:

fn setup() -> Session {
        let tcp = TcpStream::connect("127.0.0.1:22").unwrap();
        let mut sess = Session::new().unwrap();
        sess.handshake(&tcp).unwrap();
        sess.userauth_agent("username").unwrap();
        sess
    }


#[test]
fn it_doesnt_work() {
        let mut sess = setup();
        let mut channel = sess.channel_session();
        match channel {
            Ok(_) => println!("Ok"),
            Err(x) => println!("{}", x),
        }
}

Results in the error:
"Error { code: -7, msg: "Unable to send channel-open request" }"

Session::handshake is a footgun

So Session::handshake takes a &TcpStream, and has a note saying that the user has to make sure the socket lives long enough. This isn't particularly obvious and can lead to the socket being closed prematurely.

Session should probably take ownership of the stream and handle closing it in it's destructor. If that's not suitable, some clever use PhantomData and lifetimes should provide some protection.

This issue was triggered by a user on IRC being stung by this problem.

diffie-hellman-group-exchange-sha256 not supported

Hi

I am trying to connect to a server which is only allowing diffie-hellman-group-exchange-sha256 as key exchange protocol but the libssh2 version used by ssh2-rs does not seem to have support for diffie-hellman-group-exchange-sha256.

Can you update the libssh2 commit hash to point to a version which has support for diffie-hellman-group-exchange-sha256?

Thanks

include license text

Since I can't reopen #55, submitting new one..

Both Apache-2.0 and MIT require license text to be present along with source, so you really need to include license text.

Support keyboard-interactive authentication

Right now only password authentication is supported by this crate and not keyboard-interactive.

After looking around it looks like libssh2 does support it but the function libssh2_userauth_keyboard_interactive_ex is missing from from libssh2-sys.

Compilation fails on update.

failed to run custom build command for `libssh2-sys v0.1.31`
Process didn't exit successfully: `/home/dpc/lab/rust/mgit/target/debug/build/libssh2-sys-4cc87654f42e0c68/build-script-build` (exit code: 101)
--- stdout
OPT_LEVEL = Some("0")
PROFILE = Some("debug")
TARGET = Some("x86_64-unknown-linux-gnu")
debug=true opt-level=0
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-linux-gnu")
TARGET = Some("x86_64-unknown-linux-gnu")
HOST = Some("x86_64-unknown-linux-gnu")
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
running: "cmake" "/home/dpc/.multirust/toolchains/beta/cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.31/libssh2" "-DCRYPTO_BACKEND=OpenSSL" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=/home/dpc/lab/rust/mgit/target/debug/build/libssh2-sys-4cc87654f42e0c68/out" "-DCMAKE_C_FLAGS= -O0 -ffunction-sections -fdata-sections -g -m64 -fPIC" "-DCMAKE_C_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"

--- stderr
CMake Error: The source "/home/dpc/.multirust/toolchains/beta/cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.31/libssh2/CMakeLists.txt" does not match the source "/home/dpc/.multirust/toolchains/stable/cargo/registry/src/github.com-0a35038f75765ae4/libssh2-sys-0.1.31/libssh2/CMakeLists.txt" used to generate cache.  Re-run cmake with a different source directory.
thread '<main>' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/dpc/.multirust/toolchains/beta/cargo/registry/src/github.com-0a35038f75765ae4/cmake-0.1.7/src/lib.rs:320

Windows connections fail on handshake() with "socket disconnect"

I'm getting the following error attempting a connection to an Ubuntu 14.04-based SSH server when running the library with wine:
SSHSessionHandshakeFailed(Error { code: -13, msg: "socket disconnect" })

SSHSessionHandshakeFailed corresponds to the result from the call to handshake().

I previously tried with Windows and got the same error, I can retry again if that's a concern.

The same codebase works fine with Linux.

I've attempted printing the methods negotiated by the code under Linux and setting the preferences of the code to match. I've also tried enabling and disabling compression explicitly. None of my attempts have altered the error in any way.

Windows MSVC build: "Unable to exchange encryption keys"

The following code below successfully authenticates when built on Linux. When built with the MSVC build on windows it fails at the handshake with:

["diffie-hellman-group14-sha1", "diffie-hellman-group-exchange-sha1", "diffie-hellman-group1-sha1"]
["ssh-rsa", "ssh-dss"]
["aes256-cbc", "[email protected]", "aes192-cbc", "aes128-cbc", "arcfour128", "arcfour", "3des-cbc"]
ERROR: Error { code: -5, msg: "Unable to exchange encryption keys" }

I've verified that the server supports all three of the key exchange types. I also built ssh2-rs against libssh2 1.6.0 as they had fixed some WinCG bugs, but that also resulted in the same error. I could try and gather more debugging info on the client side, but I'm not sure how to configure libssh2 to spit out more info.

extern crate mush as ssh2;

use ssh2::Session;
use std::net::TcpStream;

use ssh2::MethodType::*;

fn main() {
    // Connect to the local SSH server
    let tcp = TcpStream::connect("aservericonnecto:22").unwrap();
    let mut sess = Session::new().unwrap();

    match sess.supported_algs(Kex) {
        Ok(res) => {
            println!("{:?}", res);
        },
        Err(e) => {
            println!("ERROR: {:?}", e);
            return
        }
    }

    match sess.supported_algs(HostKey) {
        Ok(res) => {
            println!("{:?}", res);
        },
        Err(e) => {
            println!("ERROR: {:?}", e);
            return
        }
    }

    match sess.supported_algs(CryptCs) {
        Ok(res) => {
            println!("{:?}", res);
        },
        Err(e) => {
            println!("ERROR: {:?}", e);
            return
        }
    }

    // Errors out here on Windows MSVC build
    match sess.handshake(&tcp) {
        Ok(_) => {},
        Err(e) => {
            println!("ERROR: {:?}", e);
            return
        }
    }

    // Try to authenticate with the first identity in the agent.
    match sess.userauth_agent("username") {
        Ok(_) => {}
        Err(e) => println!("ERROR: {:?}", e),
    }

    // Make sure we succeeded
    assert!(sess.authenticated());
}

Segmentation fault: 11

I am having issues with Segmentation fault: 11 using ssh2 library. Below is a simple example from documentation. Results are consistent. Have no idea whats going on and being a rust beginner does not help. Same issues occur connecting to various servers or virtual boxes, regardless.

I hope its not something trivial. I have no issues connecting to any of this servers in terminal.

Help would be much appreciated.

env:

  • rustc 1.15.0
  • cargo 0.16.0-dev (6e0c18c 2017-01-27)
  • OpenSSL 0.9.8zh 14 Jan 2016
  • ssh2 = "0.3.1"
  • macbook

code:

extern crate ssh2;

use std::net::TcpStream;
use ssh2::Session;

fn main() {
    let tcp = TcpStream::connect("localhost:2222").unwrap();
    let mut sess = Session::new().unwrap();
    sess.handshake(&tcp).unwrap();
    sess.userauth_password("root", "root").unwrap();
    assert!(sess.authenticated());
}

build and run:

cargo run
   Compiling sshtest v0.1.0 (file:///path/to/project/sshtest)
    Finished debug [unoptimized + debuginfo] target(s) in 0.30 secs
Segmentation fault: 11

rust-lldb trace:

Process 40320 stopped
* thread #1: tid = 0x30e9da, 0x0000000000000000, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
    frame #0: 0x0000000000000000
error: memory read failed for 0x0

Issues with ssh session to network gear.

I stuck upon problem with using this create when connecting to network gear instead of for example Linux server.
Following code works perfectly when host is Linux box but fail if its for example cisco switch:

                match channel {
                    Ok(mut c) => {
                        println!("Channel acquired !");
                        c.exec(cmd).expect("Channel error: ");
                        println!("Command executed !");
                        let mut s = String::new();
                        c.read_to_string(&mut s).unwrap();
                        s
                        // String::from("test")
                    }
                    Err(e) => {
                        println!("Something was WTF ..!");
                        String::from("")
                    }
                }

When running against cisco switch I'm getting following error:

Requesting channel ..
Channel acquired !
thread 'main' panicked at 'Channel error: : Error { code: -43, msg: "Failed waiting for channel success" }', ../src/libcore/result.rs:788

I'm suspecting that before exec I need to create shell or request pty.
Is there some example how to work with channel.shel()l and pty's not directly calling exec() ?

AsyncRead compatibility

It would be nice if ssh2::File were compatible with AsyncRead (eg returning ErrorKind::WouldBlock). Not sure if this is possible without breaking backwards compatibility.

Fails to build on Windows 7

When I try to build on Windows 7, the build fails with the following error messages:

$ cargo build
   Compiling libssh2-sys v0.2.6 (file:///C:/Users/kraaimx/src/ssh2-rs/libssh2-sys)
error: failed to run custom build command for `libssh2-sys v0.2.6 (file:///C:/Users/kraaimx/src/ssh2-rs/libssh2-sys)`
process didn't exit successfully: `C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-03a7f167d29f5538\build-script-build` (exit code: 101)
--- stdout
running: "cmake" "C:\\Users\\kraaimx\\src\\ssh2-rs\\libssh2-sys\\libssh2" "-G" "Visual Studio 15 2017 Win64" "-DCRYPTO_BACKEND=WinCNG" "-DZLIB_INCLUDE_DIR=C:\\Users\\kraaimx\\src\\ssh2-rs\\target\\debug\\build\\libz-sys-5d244e0788dc0878\\out/include" "-DBUILD_SHARED_LIBS=OFF" "-DENABLE_ZLIB_COMPRESSION=ON" "-DCMAKE_INSTALL_LIBDIR=lib" "-DBUILD_EXAMPLES=OFF" "-DBUILD_TESTING=OFF" "-DCMAKE_INSTALL_PREFIX=C:\\Users\\kraaimx\\src\\ssh2-rs\\target\\debug\\build\\libssh2-sys-29c08e12f584f8c3\\out" "-DCMAKE_C_FLAGS= /nologo /MD" "-DCMAKE_C_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_CXX_FLAGS= /nologo /MD" "-DCMAKE_CXX_FLAGS_DEBUG= /nologo /MD" "-DCMAKE_BUILD_TYPE=Debug"
-- Configuring incomplete, errors occurred!
See also "C:/Users/kraaimx/src/ssh2-rs/target/debug/build/libssh2-sys-29c08e12f584f8c3/out/build/CMakeFiles/CMakeOutput.log".

--- stderr
CMake Error at CMakeLists.txt:40 (project):
  Failed to run MSBuild command:

    MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine version 15.1.1012.6693
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 9/25/2017 12:44:35 PM.
    Project "C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-29c08e12f584f8c3\out\build\CMakeFiles\3.9.3\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-29c08e12f584f8c3\out\build\CMakeFiles\3.9.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
    Done Building Project "C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-29c08e12f584f8c3\out\build\CMakeFiles\3.9.3\VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-29c08e12f584f8c3\out\build\CMakeFiles\3.9.3\VCTargetsPath.vcxproj" (default target) (1) ->
      C:\Users\kraaimx\src\ssh2-rs\target\debug\build\libssh2-sys-29c08e12f584f8c3\out\build\CMakeFiles\3.9.3\VCTargetsPath.vcxproj(14,2): error MSB4019: The imported project "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

        0 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.09


  Exit code: 1



thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', C:\Users\kraaimx\.cargo\registry\src\github.com-1ecc6299db9ec823\cmake-0.1.26\src\lib.rs:599:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Panic during `Session::scp_send`

I am getting panics when trying to send a file using this crate:

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libcore/option.rs:323
stack backtrace:
   1:           0xe73cec - std::sys::imp::backtrace::tracing::imp::write::hb19afc01d31f8b8d
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:           0xe775ce - std::panicking::default_hook::{{closure}}::hc95fe3ab240055ab
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:351
   3:           0xe771d4 - std::panicking::default_hook::hb0959de6991e005f
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:367
   4:           0xe77a6b - std::panicking::rust_panic_with_hook::h2109fde6f0e4c63e
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:555
   5:           0xe778b4 - std::panicking::begin_panic::h49b7a814453fcc40
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:517
   6:           0xe77829 - std::panicking::begin_panic_fmt::h536a55f472b4abf0
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:501
   7:           0xe777b7 - rust_begin_unwind
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libstd/panicking.rs:477
   8:           0xebff3d - core::panicking::panic_fmt::he66a9a97711f43a8
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libcore/panicking.rs:69
   9:           0xebfe74 - core::panicking::panic::h6c850e48e8c19b5e
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libcore/panicking.rs:49
  10:           0xbe9efc - <core::option::Option<T>>::unwrap::ha09ee0454bdcc49c
                        at /buildslave/rust-buildbot/slave/stable-dist-rustc-musl-linux/build/src/libcore/macros.rs:21
  11:           0xbf0717 - ssh2::util::SessionBinding::from_raw_opt::h1bf5351e4f3941b8
                        at /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/ssh2-0.3.1/src/util.rs:23
  12:           0xbf020d - ssh2::session::Session::scp_send::h60e18108437c1a5d
                        at /home/rust/.cargo/registry/src/github.com-1ecc6299db9ec823/ssh2-0.3.1/src/session.rs:462
(the rest of the trace is inside my application)

The network conditions on the host are bad, but I wouldn't expect it to lead to panics.

The bug happens semi-regularly, so I can probably provide more information if you need.

Note: I'm linking to musl using ekidd's docker container - could it explain this behavior?

EDIT: I also got a panic during Session::channel_session, I suspect with the same cause (Error::last_error returning None in SessionBinding::from_raw_opt).

No apparent way to read both main channel and error channel

Aside from setting a short timeout, I don't see any way of reading from multiple channels. Programs will often write to both stdout and stderr, and it'd be nice to be able to capture both. The channel and/or stream aren't Sync so threads can't be used, and there doesn't seem to be any way of blocking on multiple streams in order to multiplex them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.