diff --git a/README.md b/README.md index 89c0561..facdc95 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,7 @@ and the `libssh-rs` crate which provides safe bindings based on `libssh-rs-sys`. The `vendored` feature causes a static version of libssh to be compiled and linked into your program. If no system `libssh` is detected at build time, or that system library is too old, then the vendored -`libssh` implementation will be used automatically. Note that the `libssh-rs` bindings make use of -a couple of new interfaces that have not made it into a released version of `libssh` at the time -of writing this note, so all users will be effectively running with `vendored` enabled until libssh -releases version `0.9.7`. +`libssh` implementation will be used automatically. The `vendored-openssl` feature causes a vendored copy of `openssl` to be compiled and linked into your program. @@ -35,4 +32,3 @@ viral clause in the case where you modify `libssh`. The license is explained that simply using an unmodified `libssh-rs-sys` crate will not trigger that viral clause, and you are thus able to use this crate under the terms of the MIT license. - diff --git a/libssh-rs-sys/README.md b/libssh-rs-sys/README.md index c473b76..2183e69 100644 --- a/libssh-rs-sys/README.md +++ b/libssh-rs-sys/README.md @@ -10,10 +10,7 @@ Native bindings to [libssh](https://www.libssh.org/). The `vendored` feature causes a static version of libssh to be compiled and linked into your program. If no system `libssh` is detected at build time, or that system library is too old, then the vendored -`libssh` implementation will be used automatically. Note that the `libssh-rs` bindings make use of -a couple of new interfaces that have not made it into a released version of `libssh` at the time -of writing this note, so all users will be effectively running with `vendored` enabled until libssh -releases version `0.9.7`. +`libssh` implementation will be used automatically. The `vendored-openssl` feature causes a vendored copy of `openssl` to be compiled and linked into your program. @@ -32,4 +29,3 @@ viral clause in the case where you modify `libssh`. The license is explained that simply using an unmodified `libssh-rs-sys` crate will not trigger that viral clause, and you are thus able to use this crate under the terms of the MIT license. - diff --git a/libssh-rs-sys/build.rs b/libssh-rs-sys/build.rs index a1ed0e0..c357203 100644 --- a/libssh-rs-sys/build.rs +++ b/libssh-rs-sys/build.rs @@ -3,9 +3,7 @@ use std::path::PathBuf; fn main() { if std::env::var_os("CARGO_FEATURE_VENDORED").is_none() && pkg_config::Config::new() - // ssh_userauth_publickey_auto_get_current_identity - // is not yet in a released version of libssh - .atleast_version("0.9.7") + .atleast_version("0.12.2") .probe("libssh") .is_ok() { @@ -135,8 +133,8 @@ fn main() { let version = std::fs::read_to_string("vendored/include/libssh/libssh_version.h.cmake") .unwrap() .replace("@libssh_VERSION_MAJOR@", "0") - .replace("@libssh_VERSION_MINOR@", "8") - .replace("@libssh_VERSION_PATCH@", "90"); + .replace("@libssh_VERSION_MINOR@", "12") + .replace("@libssh_VERSION_PATCH@", "2"); std::fs::create_dir_all(include.join("libssh")).unwrap(); std::fs::write(include.join("libssh/libssh_version.h"), version).unwrap(); @@ -196,6 +194,7 @@ fn main() { "connector.c", "crypto_common.c", "curve25519.c", + "curve25519_crypto.c", "dh-gex.c", "dh.c", "dh_crypto.c", @@ -209,11 +208,14 @@ fn main() { "external/ed25519.c", "external/fe25519.c", "external/ge25519.c", + "external/libcrux_mlkem768_sha3.c", "external/poly1305.c", "external/sc25519.c", + "external/sntrup761.c", "getpass.c", "getrandom_crypto.c", "gzip.c", + "hybrid_mlkem.c", "init.c", "kdf.c", "kex.c", @@ -226,12 +228,15 @@ fn main() { "md_crypto.c", "messages.c", "misc.c", + "mlkem.c", + "mlkem_native.c", "options.c", "packet.c", "packet_cb.c", "packet_crypt.c", "pcap.c", "pki.c", + "pki_context.c", "pki_container_openssh.c", "pki_crypto.c", // "pki_ed25519.c", gcrypt only @@ -245,6 +250,7 @@ fn main() { "sftp_common.c", "sftp_aio.c", "socket.c", + "sntrup761.c", "string.c", "threads.c", "threads/libcrypto.c", diff --git a/libssh-rs-sys/src/lib.rs b/libssh-rs-sys/src/lib.rs index 49a2110..9064c33 100644 --- a/libssh-rs-sys/src/lib.rs +++ b/libssh-rs-sys/src/lib.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.69.4 */ +/* automatically generated by rust-bindgen 0.72.1 */ #![allow(non_snake_case)] #![allow(non_camel_case_types)] @@ -17,6 +17,7 @@ pub const SSH_AUTH_METHOD_PUBLICKEY: u32 = 4; pub const SSH_AUTH_METHOD_HOSTBASED: u32 = 8; pub const SSH_AUTH_METHOD_INTERACTIVE: u32 = 16; pub const SSH_AUTH_METHOD_GSSAPI_MIC: u32 = 32; +pub const SSH_AUTH_METHOD_GSSAPI_KEYEX: u32 = 64; pub const SSH_CLOSED: u32 = 1; pub const SSH_READ_PENDING: u32 = 2; pub const SSH_CLOSED_ERROR: u32 = 4; @@ -31,6 +32,12 @@ pub const SSH_LOG_WARN: u32 = 1; pub const SSH_LOG_INFO: u32 = 2; pub const SSH_LOG_DEBUG: u32 = 3; pub const SSH_LOG_TRACE: u32 = 4; +pub const SSH_SK_USER_PRESENCE_REQD: u32 = 1; +pub const SSH_SK_USER_VERIFICATION_REQD: u32 = 4; +pub const SSH_SK_FORCE_OPERATION: u32 = 16; +pub const SSH_SK_RESIDENT_KEY: u32 = 32; +pub const SSH_SK_OPTION_NAME_DEVICE_PATH: &[u8; 7] = b"device\0"; +pub const SSH_SK_OPTION_NAME_USER_ID: &[u8; 5] = b"user\0"; pub const SSH_SOCKET_FLOW_WRITEWILLBLOCK: u32 = 1; pub const SSH_SOCKET_FLOW_WRITEWONTBLOCK: u32 = 2; pub const SSH_SOCKET_EXCEPTION_EOF: u32 = 1; @@ -130,13 +137,20 @@ pub const SSH2_MSG_KEXDH_INIT: u32 = 30; pub const SSH2_MSG_KEXDH_REPLY: u32 = 31; pub const SSH2_MSG_KEX_ECDH_INIT: u32 = 30; pub const SSH2_MSG_KEX_ECDH_REPLY: u32 = 31; -pub const SSH2_MSG_ECMQV_INIT: u32 = 30; -pub const SSH2_MSG_ECMQV_REPLY: u32 = 31; +pub const SSH2_MSG_KEX_HYBRID_INIT: u32 = 30; +pub const SSH2_MSG_KEX_HYBRID_REPLY: u32 = 31; pub const SSH2_MSG_KEX_DH_GEX_REQUEST_OLD: u32 = 30; pub const SSH2_MSG_KEX_DH_GEX_GROUP: u32 = 31; pub const SSH2_MSG_KEX_DH_GEX_INIT: u32 = 32; pub const SSH2_MSG_KEX_DH_GEX_REPLY: u32 = 33; pub const SSH2_MSG_KEX_DH_GEX_REQUEST: u32 = 34; +pub const SSH2_MSG_KEXGSS_INIT: u32 = 30; +pub const SSH2_MSG_KEXGSS_CONTINUE: u32 = 31; +pub const SSH2_MSG_KEXGSS_COMPLETE: u32 = 32; +pub const SSH2_MSG_KEXGSS_HOSTKEY: u32 = 33; +pub const SSH2_MSG_KEXGSS_ERROR: u32 = 34; +pub const SSH2_MSG_KEXGSS_GROUPREQ: u32 = 40; +pub const SSH2_MSG_KEXGSS_GROUP: u32 = 41; pub const SSH2_MSG_USERAUTH_REQUEST: u32 = 50; pub const SSH2_MSG_USERAUTH_FAILURE: u32 = 51; pub const SSH2_MSG_USERAUTH_SUCCESS: u32 = 52; @@ -186,12 +200,12 @@ pub const SSH2_OPEN_CONNECT_FAILED: u32 = 2; pub const SSH2_OPEN_UNKNOWN_CHANNEL_TYPE: u32 = 3; pub const SSH2_OPEN_RESOURCE_SHORTAGE: u32 = 4; pub const SSH2_EXTENDED_DATA_STDERR: u32 = 1; -pub type va_list = __builtin_va_list; pub type __uid_t = ::std::os::raw::c_uint; pub type __gid_t = ::std::os::raw::c_uint; pub type __mode_t = ::std::os::raw::c_uint; pub type __time_t = ::std::os::raw::c_long; pub type __suseconds_t = ::std::os::raw::c_long; +pub type va_list = __builtin_va_list; pub type gid_t = __gid_t; pub type uid_t = __uid_t; pub type mode_t = __mode_t; @@ -282,6 +296,12 @@ pub struct ssh_connector_struct { _unused: [u8; 0], } pub type ssh_connector = *mut ssh_connector_struct; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ssh_pki_ctx_struct { + _unused: [u8; 0], +} +pub type ssh_pki_ctx = *mut ssh_pki_ctx_struct; pub type ssh_gssapi_creds = *mut ::std::os::raw::c_void; pub type socket_t = ::std::os::raw::c_int; #[repr(u32)] @@ -435,6 +455,13 @@ pub enum ssh_control_master_options_e { } #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ssh_address_family_options_e { + SSH_ADDRESS_FAMILY_ANY = 0, + SSH_ADDRESS_FAMILY_INET = 1, + SSH_ADDRESS_FAMILY_INET6 = 2, +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum ssh_options_e { SSH_OPTIONS_HOST = 0, SSH_OPTIONS_PORT = 1, @@ -485,6 +512,11 @@ pub enum ssh_options_e { SSH_OPTIONS_CERTIFICATE = 46, SSH_OPTIONS_PROXYJUMP = 47, SSH_OPTIONS_PROXYJUMP_CB_LIST_APPEND = 48, + SSH_OPTIONS_PKI_CONTEXT = 49, + SSH_OPTIONS_ADDRESS_FAMILY = 50, + SSH_OPTIONS_GSSAPI_KEY_EXCHANGE = 51, + SSH_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS = 52, + SSH_OPTIONS_NEXT_IDENTITY = 53, } pub const SSH_SCP_WRITE: _bindgen_ty_11 = _bindgen_ty_11::SSH_SCP_WRITE; pub const SSH_SCP_READ: _bindgen_ty_11 = _bindgen_ty_11::SSH_SCP_READ; @@ -516,32 +548,32 @@ pub enum ssh_connector_flags_e { SSH_CONNECTOR_STDERR = 2, SSH_CONNECTOR_BOTH = 3, } -extern "C" { +unsafe extern "C" { pub fn ssh_blocking_flush( session: ssh_session, timeout: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_accept_x11( channel: ssh_channel, timeout_ms: ::std::os::raw::c_int, ) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_change_pty_size( channel: ssh_channel, cols: ::std::os::raw::c_int, rows: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_close(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_free(channel: ssh_channel); } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_get_exit_state( channel: ssh_channel, pexit_code: *mut u32, @@ -549,28 +581,28 @@ extern "C" { pcore_dumped: *mut ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_get_exit_status(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_get_session(channel: ssh_channel) -> ssh_session; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_is_closed(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_is_eof(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_is_open(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_new(session: ssh_session) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_auth_agent(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_forward( channel: ssh_channel, remotehost: *const ::std::os::raw::c_char, @@ -579,7 +611,7 @@ extern "C" { localport: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_forward_unix( channel: ssh_channel, remotepath: *const ::std::os::raw::c_char, @@ -587,30 +619,30 @@ extern "C" { localport: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_session(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_x11( channel: ssh_channel, orig_addr: *const ::std::os::raw::c_char, orig_port: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_poll( channel: ssh_channel, is_stderr: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_poll_timeout( channel: ssh_channel, timeout: ::std::os::raw::c_int, is_stderr: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_read( channel: ssh_channel, dest: *mut ::std::os::raw::c_void, @@ -618,7 +650,7 @@ extern "C" { is_stderr: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_read_timeout( channel: ssh_channel, dest: *mut ::std::os::raw::c_void, @@ -627,7 +659,7 @@ extern "C" { timeout_ms: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_read_nonblocking( channel: ssh_channel, dest: *mut ::std::os::raw::c_void, @@ -635,23 +667,23 @@ extern "C" { is_stderr: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_env( channel: ssh_channel, name: *const ::std::os::raw::c_char, value: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_exec( channel: ssh_channel, cmd: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_pty(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_pty_size( channel: ssh_channel, term: *const ::std::os::raw::c_char, @@ -659,7 +691,7 @@ extern "C" { rows: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_pty_size_modes( channel: ssh_channel, term: *const ::std::os::raw::c_char, @@ -669,31 +701,31 @@ extern "C" { modes_len: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_shell(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_send_signal( channel: ssh_channel, signum: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_send_break( channel: ssh_channel, length: u32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_sftp(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_subsystem( channel: ssh_channel, subsystem: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_x11( channel: ssh_channel, single_connection: ::std::os::raw::c_int, @@ -702,83 +734,83 @@ extern "C" { screen_number: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_auth_agent(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_send_eof(channel: ssh_channel) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_set_blocking(channel: ssh_channel, blocking: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_set_counter(channel: ssh_channel, counter: ssh_counter); } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_write( channel: ssh_channel, data: *const ::std::os::raw::c_void, len: u32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_write_stderr( channel: ssh_channel, data: *const ::std::os::raw::c_void, len: u32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_window_size(channel: ssh_channel) -> u32; } -extern "C" { +unsafe extern "C" { pub fn ssh_basename(path: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_clean_pubkey_hash(hash: *mut *mut ::std::os::raw::c_uchar); } -extern "C" { +unsafe extern "C" { pub fn ssh_connect(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_new(session: ssh_session) -> ssh_connector; } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_free(connector: ssh_connector); } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_set_in_channel( connector: ssh_connector, channel: ssh_channel, flags: ssh_connector_flags_e, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_set_out_channel( connector: ssh_connector, channel: ssh_channel, flags: ssh_connector_flags_e, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_set_in_fd(connector: ssh_connector, fd: socket_t); } -extern "C" { +unsafe extern "C" { pub fn ssh_connector_set_out_fd(connector: ssh_connector, fd: socket_t); } -extern "C" { +unsafe extern "C" { pub fn ssh_copyright() -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_disconnect(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_dirname(path: *const ::std::os::raw::c_char) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_finalize() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_forward_port( session: ssh_session, timeout_ms: ::std::os::raw::c_int, @@ -787,21 +819,21 @@ extern "C" { originator_port: *mut ::std::os::raw::c_int, ) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_accept_forward( session: ssh_session, timeout_ms: ::std::os::raw::c_int, destination_port: *mut ::std::os::raw::c_int, ) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_cancel_forward( session: ssh_session, address: *const ::std::os::raw::c_char, port: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_listen_forward( session: ssh_session, address: *const ::std::os::raw::c_char, @@ -809,37 +841,37 @@ extern "C" { bound_port: *mut ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_free(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_get_disconnect_message(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_error(error: *mut ::std::os::raw::c_void) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_error_code(error: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_fd(session: ssh_session) -> socket_t; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_hexa( what: *const ::std::os::raw::c_uchar, len: usize, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_issue_banner(session: ssh_session) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_openssh_version(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_request_no_more_sessions(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_server_publickey( session: ssh_session, key: *mut ssh_key, @@ -852,7 +884,7 @@ pub enum ssh_publickey_hash_type { SSH_PUBLICKEY_HASH_MD5 = 1, SSH_PUBLICKEY_HASH_SHA256 = 2, } -extern "C" { +unsafe extern "C" { pub fn ssh_get_publickey_hash( key: ssh_key, type_: ssh_publickey_hash_type, @@ -860,26 +892,26 @@ extern "C" { hlen: *mut usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_pubkey_hash( session: ssh_session, hash: *mut *mut ::std::os::raw::c_uchar, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_forward_accept( session: ssh_session, timeout_ms: ::std::os::raw::c_int, ) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_forward_cancel( session: ssh_session, address: *const ::std::os::raw::c_char, port: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_forward_listen( session: ssh_session, address: *const ::std::os::raw::c_char, @@ -887,26 +919,26 @@ extern "C" { bound_port: *mut ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_publickey(session: ssh_session, key: *mut ssh_key) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_write_knownhost(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_dump_knownhost(session: ssh_session) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_is_server_known(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_print_hexa( descr: *const ::std::os::raw::c_char, what: *const ::std::os::raw::c_uchar, len: usize, ); } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_select( readchans: *mut ssh_channel, writechans: *mut ssh_channel, @@ -914,45 +946,45 @@ extern "C" { timeout: *mut timeval, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_accept_request(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_close(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_deny_request( scp: ssh_scp, reason: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_free(scp: ssh_scp); } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_init(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_leave_directory(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_new( session: ssh_session, mode: ::std::os::raw::c_int, location: *const ::std::os::raw::c_char, ) -> ssh_scp; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_pull_request(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_push_directory( scp: ssh_scp, dirname: *const ::std::os::raw::c_char, mode: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_push_file( scp: ssh_scp, filename: *const ::std::os::raw::c_char, @@ -960,7 +992,7 @@ extern "C" { perms: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_push_file64( scp: ssh_scp, filename: *const ::std::os::raw::c_char, @@ -968,104 +1000,104 @@ extern "C" { perms: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_read( scp: ssh_scp, buffer: *mut ::std::os::raw::c_void, size: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_request_get_filename(scp: ssh_scp) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_request_get_permissions(scp: ssh_scp) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_request_get_size(scp: ssh_scp) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_request_get_size64(scp: ssh_scp) -> u64; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_request_get_warning(scp: ssh_scp) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_scp_write( scp: ssh_scp, buffer: *const ::std::os::raw::c_void, len: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_random( where_: *mut ::std::os::raw::c_void, len: ::std::os::raw::c_int, strong: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_version(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_status(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_poll_flags(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_init() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_is_blocking(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_is_connected(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_knownhosts_entry_free(entry: *mut ssh_knownhosts_entry); } -extern "C" { +unsafe extern "C" { pub fn ssh_known_hosts_parse_line( host: *const ::std::os::raw::c_char, line: *const ::std::os::raw::c_char, entry: *mut *mut ssh_knownhosts_entry, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_has_known_hosts_entry(session: ssh_session) -> ssh_known_hosts_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_export_known_hosts_entry( session: ssh_session, pentry_string: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_update_known_hosts(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_get_known_hosts_entry( session: ssh_session, pentry: *mut *mut ssh_knownhosts_entry, ) -> ssh_known_hosts_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_is_known_server(session: ssh_session) -> ssh_known_hosts_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_log_level(level: ::std::os::raw::c_int) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_log_level() -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_log_userdata() -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_log_userdata(data: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_vlog( verbosity: ::std::os::raw::c_int, function: *const ::std::os::raw::c_char, @@ -1073,7 +1105,7 @@ extern "C" { va: *mut va_list, ); } -extern "C" { +unsafe extern "C" { pub fn ssh_log( session: ssh_session, prioriry: ::std::os::raw::c_int, @@ -1081,85 +1113,85 @@ extern "C" { ... ); } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_reply_accept(msg: ssh_message) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_reply_accept_channel( msg: ssh_message, chan: ssh_channel, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_reply_success(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_free(msg: ssh_message); } -extern "C" { +unsafe extern "C" { pub fn ssh_message_get(session: ssh_session) -> ssh_message; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_subtype(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_type(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_mkdir( pathname: *const ::std::os::raw::c_char, mode: mode_t, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_new() -> ssh_session; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_copy(src: ssh_session, dest: *mut ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_getopt( session: ssh_session, argcptr: *mut ::std::os::raw::c_int, argv: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_parse_config( session: ssh_session, filename: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_set( session: ssh_session, type_: ssh_options_e, value: *const ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_get( session: ssh_session, type_: ssh_options_e, value: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_options_get_port( session: ssh_session, port_target: *mut ::std::os::raw::c_uint, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pcap_file_close(pcap: ssh_pcap_file) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pcap_file_free(pcap: ssh_pcap_file); } -extern "C" { +unsafe extern "C" { pub fn ssh_pcap_file_new() -> ssh_pcap_file; } -extern "C" { +unsafe extern "C" { pub fn ssh_pcap_file_open( pcap: ssh_pcap_file, filename: *const ::std::os::raw::c_char, @@ -1182,41 +1214,57 @@ pub enum ssh_file_format_e { SSH_FILE_FORMAT_OPENSSH = 1, SSH_FILE_FORMAT_PEM = 2, } -extern "C" { +unsafe extern "C" { pub fn ssh_key_new() -> ssh_key; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_free(key: ssh_key); } -extern "C" { +unsafe extern "C" { pub fn ssh_key_type(key: ssh_key) -> ssh_keytypes_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_type_to_char(type_: ssh_keytypes_e) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_type_from_name(name: *const ::std::os::raw::c_char) -> ssh_keytypes_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_is_public(k: ssh_key) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_is_private(k: ssh_key) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_cmp(k1: ssh_key, k2: ssh_key, what: ssh_keycmp_e) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_key_dup(key: ssh_key) -> ssh_key; } -extern "C" { +unsafe extern "C" { + pub fn ssh_key_get_sk_flags(key: ssh_key) -> u32; +} +unsafe extern "C" { + pub fn ssh_key_get_sk_application(key: ssh_key) -> ssh_string; +} +unsafe extern "C" { + pub fn ssh_key_get_sk_user_id(key: ssh_key) -> ssh_string; +} +unsafe extern "C" { pub fn ssh_pki_generate( type_: ssh_keytypes_e, parameter: ::std::os::raw::c_int, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { + pub fn ssh_pki_generate_key( + type_: ssh_keytypes_e, + pki_context: ssh_pki_ctx, + pkey: *mut ssh_key, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { pub fn ssh_pki_import_privkey_base64( b64_key: *const ::std::os::raw::c_char, passphrase: *const ::std::os::raw::c_char, @@ -1225,7 +1273,7 @@ extern "C" { pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_privkey_base64( privkey: ssh_key, passphrase: *const ::std::os::raw::c_char, @@ -1234,7 +1282,7 @@ extern "C" { b64_key: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_privkey_base64_format( privkey: ssh_key, passphrase: *const ::std::os::raw::c_char, @@ -1244,7 +1292,7 @@ extern "C" { format: ssh_file_format_e, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_import_privkey_file( filename: *const ::std::os::raw::c_char, passphrase: *const ::std::os::raw::c_char, @@ -1253,7 +1301,7 @@ extern "C" { pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_privkey_file( privkey: ssh_key, passphrase: *const ::std::os::raw::c_char, @@ -1262,7 +1310,7 @@ extern "C" { filename: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_privkey_file_format( privkey: ssh_key, passphrase: *const ::std::os::raw::c_char, @@ -1272,90 +1320,90 @@ extern "C" { format: ssh_file_format_e, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_copy_cert_to_privkey( cert_key: ssh_key, privkey: ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_import_pubkey_base64( b64_key: *const ::std::os::raw::c_char, type_: ssh_keytypes_e, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_import_pubkey_file( filename: *const ::std::os::raw::c_char, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_import_cert_base64( b64_cert: *const ::std::os::raw::c_char, type_: ssh_keytypes_e, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_import_cert_file( filename: *const ::std::os::raw::c_char, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_privkey_to_pubkey( privkey: ssh_key, pkey: *mut ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_pubkey_base64( key: ssh_key, b64_key: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_export_pubkey_file( key: ssh_key, filename: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_pki_key_ecdsa_name(key: ssh_key) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_fingerprint_hash( type_: ssh_publickey_hash_type, hash: *mut ::std::os::raw::c_uchar, len: usize, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_print_hash( type_: ssh_publickey_hash_type, hash: *mut ::std::os::raw::c_uchar, len: usize, ); } -extern "C" { +unsafe extern "C" { pub fn ssh_send_ignore( session: ssh_session, data: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_send_debug( session: ssh_session, message: *const ::std::os::raw::c_char, always_display: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_gssapi_set_creds(session: ssh_session, creds: ssh_gssapi_creds); } -extern "C" { +unsafe extern "C" { pub fn ssh_select( channels: *mut ssh_channel, outchannels: *mut ssh_channel, @@ -1364,182 +1412,191 @@ extern "C" { timeout: *mut timeval, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_service_request( session: ssh_session, service: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_agent_channel( session: ssh_session, channel: ssh_channel, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_agent_socket(session: ssh_session, fd: socket_t) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_blocking(session: ssh_session, blocking: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_counters(session: ssh_session, scounter: ssh_counter, rcounter: ssh_counter); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_fd_except(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_fd_toread(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_fd_towrite(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_silent_disconnect(session: ssh_session); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_pcap_file( session: ssh_session, pcapfile: ssh_pcap_file, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_none( session: ssh_session, username: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_list( session: ssh_session, username: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_try_publickey( session: ssh_session, username: *const ::std::os::raw::c_char, pubkey: ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_publickey( session: ssh_session, username: *const ::std::os::raw::c_char, privkey: ssh_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_agent( session: ssh_session, username: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_publickey_auto_get_current_identity( session: ssh_session, value: *mut *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_publickey_auto( session: ssh_session, username: *const ::std::os::raw::c_char, passphrase: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_password( session: ssh_session, username: *const ::std::os::raw::c_char, password: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint( session: ssh_session, user: *const ::std::os::raw::c_char, submethods: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getinstruction( session: ssh_session, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getname(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getnprompts(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getprompt( session: ssh_session, i: ::std::os::raw::c_uint, echo: *mut ::std::os::raw::c_char, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getnanswers(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_getanswer( session: ssh_session, i: ::std::os::raw::c_uint, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_kbdint_setanswer( session: ssh_session, i: ::std::os::raw::c_uint, answer: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_gssapi(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { + pub fn ssh_userauth_gssapi_keyex(session: ssh_session) -> ::std::os::raw::c_int; +} +unsafe extern "C" { pub fn ssh_version(req_version: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_burn(str_: ssh_string); } -extern "C" { +unsafe extern "C" { pub fn ssh_string_copy(str_: ssh_string) -> ssh_string; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_data(str_: ssh_string) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_fill( str_: ssh_string, data: *const ::std::os::raw::c_void, len: usize, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_free(str_: ssh_string); } -extern "C" { +unsafe extern "C" { pub fn ssh_string_from_char(what: *const ::std::os::raw::c_char) -> ssh_string; } -extern "C" { +unsafe extern "C" { + pub fn ssh_string_from_data(data: *const ::std::os::raw::c_void, len: usize) -> ssh_string; +} +unsafe extern "C" { pub fn ssh_string_len(str_: ssh_string) -> usize; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_new(size: usize) -> ssh_string; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_get_char(str_: ssh_string) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_to_char(str_: ssh_string) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_string_free_char(s: *mut ::std::os::raw::c_char); } -extern "C" { +unsafe extern "C" { + pub fn ssh_string_cmp(s1: ssh_string, s2: ssh_string) -> ::std::os::raw::c_int; +} +unsafe extern "C" { pub fn ssh_getpass( prompt: *const ::std::os::raw::c_char, buf: *mut ::std::os::raw::c_char, @@ -1555,10 +1612,10 @@ pub type ssh_event_callback = ::std::option::Option< userdata: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int, >; -extern "C" { +unsafe extern "C" { pub fn ssh_event_new() -> ssh_event; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_add_fd( event: ssh_event, fd: socket_t, @@ -1567,95 +1624,181 @@ extern "C" { userdata: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_add_session(event: ssh_event, session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_add_connector( event: ssh_event, connector: ssh_connector, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_dopoll( event: ssh_event, timeout: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_remove_fd(event: ssh_event, fd: socket_t) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_remove_session( event: ssh_event, session: ssh_session, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_remove_connector( event: ssh_event, connector: ssh_connector, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_event_free(event: ssh_event); } -extern "C" { +unsafe extern "C" { pub fn ssh_get_clientbanner(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_serverbanner(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_kex_algo(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { + pub fn ssh_session_kex_is_gss(session: ssh_session) -> bool; +} +unsafe extern "C" { pub fn ssh_get_cipher_in(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_cipher_out(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_hmac_in(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_hmac_out(session: ssh_session) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { + pub fn ssh_get_supported_methods(type_: ssh_kex_types_e) -> *const ::std::os::raw::c_char; +} +unsafe extern "C" { pub fn ssh_buffer_new() -> ssh_buffer; } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_free(buffer: ssh_buffer); } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_reinit(buffer: ssh_buffer) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_add_data( buffer: ssh_buffer, data: *const ::std::os::raw::c_void, len: u32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_get_data( buffer: ssh_buffer, data: *mut ::std::os::raw::c_void, requestedlen: u32, ) -> u32; } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_get(buffer: ssh_buffer) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn ssh_buffer_get_len(buffer: ssh_buffer) -> u32; } -extern "C" { +unsafe extern "C" { pub fn ssh_session_set_disconnect_message( session: ssh_session, message: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum sshsig_digest_e { + SSHSIG_DIGEST_SHA2_256 = 0, + SSHSIG_DIGEST_SHA2_512 = 1, +} +unsafe extern "C" { + pub fn sshsig_sign( + data: *const ::std::os::raw::c_void, + data_length: usize, + privkey: ssh_key, + pki_context: ssh_pki_ctx, + sig_namespace: *const ::std::os::raw::c_char, + hash_alg: sshsig_digest_e, + signature: *mut *mut ::std::os::raw::c_char, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn sshsig_verify( + data: *const ::std::os::raw::c_void, + data_length: usize, + signature: *const ::std::os::raw::c_char, + sig_namespace: *const ::std::os::raw::c_char, + sign_key: *mut ssh_key, + ) -> ::std::os::raw::c_int; +} +#[repr(u32)] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum ssh_pki_options_e { + SSH_PKI_OPTION_RSA_KEY_SIZE = 0, + SSH_PKI_OPTION_SK_APPLICATION = 1, + SSH_PKI_OPTION_SK_FLAGS = 2, + SSH_PKI_OPTION_SK_USER_ID = 3, + SSH_PKI_OPTION_SK_CHALLENGE = 4, + SSH_PKI_OPTION_SK_CALLBACKS = 5, +} +unsafe extern "C" { + pub fn ssh_pki_ctx_new() -> ssh_pki_ctx; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_options_set( + context: ssh_pki_ctx, + option: ssh_pki_options_e, + value: *const ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_set_sk_pin_callback( + context: ssh_pki_ctx, + pin_callback: ssh_auth_callback, + userdata: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_sk_callbacks_option_set( + context: ssh_pki_ctx, + name: *const ::std::os::raw::c_char, + value: *const ::std::os::raw::c_char, + required: bool, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_sk_callbacks_options_clear(context: ssh_pki_ctx) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_get_sk_attestation_buffer( + context: *const ssh_pki_ctx_struct, + attestation_buffer: *mut ssh_buffer, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { + pub fn ssh_pki_ctx_free(context: ssh_pki_ctx); +} +unsafe extern "C" { + pub fn ssh_sk_resident_keys_load( + pki_context: *const ssh_pki_ctx_struct, + resident_keys_result: *mut *mut ssh_key, + num_keys_found_result: *mut usize, + ) -> ::std::os::raw::c_int; +} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ssh_private_key_struct { @@ -1668,10 +1811,10 @@ pub struct ssh_public_key_struct { _unused: [u8; 0], } pub type ssh_public_key = *mut ssh_public_key_struct; -extern "C" { +unsafe extern "C" { pub fn ssh_auth_list(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_offer_pubkey( session: ssh_session, username: *const ::std::os::raw::c_char, @@ -1679,7 +1822,7 @@ extern "C" { publickey: ssh_string, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_pubkey( session: ssh_session, username: *const ::std::os::raw::c_char, @@ -1687,20 +1830,20 @@ extern "C" { privatekey: ssh_private_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_agent_pubkey( session: ssh_session, username: *const ::std::os::raw::c_char, publickey: ssh_public_key, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_autopubkey( session: ssh_session, passphrase: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_userauth_privatekey_file( session: ssh_session, username: *const ::std::os::raw::c_char, @@ -1708,7 +1851,7 @@ extern "C" { passphrase: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_publickey_to_file( session: ssh_session, file: *const ::std::os::raw::c_char, @@ -1716,7 +1859,7 @@ extern "C" { type_: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_try_publickey_from_file( session: ssh_session, keyfile: *const ::std::os::raw::c_char, @@ -1724,16 +1867,16 @@ extern "C" { type_: *mut ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_privatekey_type(privatekey: ssh_private_key) -> ssh_keytypes_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_pubkey(session: ssh_session) -> ssh_string; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_retrieve(session: ssh_session, packettype: u32) -> ssh_message; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_publickey(msg: ssh_message) -> ssh_public_key; } pub type ssh_callback_int = ::std::option::Option< @@ -1802,6 +1945,8 @@ pub type ssh_global_request_callback = ::std::option::Option< userdata: *mut ::std::os::raw::c_void, ), >; +pub type ssh_connect_status_callback = + ::std::option::Option; pub type ssh_channel_open_request_x11_callback = ::std::option::Option< unsafe extern "C" fn( session: ssh_session, @@ -1833,9 +1978,7 @@ pub struct ssh_callbacks_struct { pub userdata: *mut ::std::os::raw::c_void, pub auth_function: ssh_auth_callback, pub log_function: ssh_log_callback, - pub connect_status_function: ::std::option::Option< - unsafe extern "C" fn(userdata: *mut ::std::os::raw::c_void, status: f32), - >, + pub connect_status_function: ssh_connect_status_callback, pub global_request_function: ssh_global_request_callback, pub channel_open_request_x11_function: ssh_channel_open_request_x11_callback, pub channel_open_request_auth_agent_function: ssh_channel_open_request_auth_agent_callback, @@ -1875,6 +2018,13 @@ pub type ssh_auth_pubkey_callback = ::std::option::Option< userdata: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int, >; +pub type ssh_auth_kbdint_callback = ::std::option::Option< + unsafe extern "C" fn( + message: ssh_message, + session: ssh_session, + userdata: *mut ::std::os::raw::c_void, + ) -> ::std::os::raw::c_int, +>; pub type ssh_service_request_callback = ::std::option::Option< unsafe extern "C" fn( session: ssh_session, @@ -1914,6 +2064,16 @@ pub type ssh_gssapi_verify_mic_callback = ::std::option::Option< userdata: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int, >; +pub type ssh_channel_open_request_direct_tcpip_callback = ::std::option::Option< + unsafe extern "C" fn( + session: ssh_session, + destination_address: *const ::std::os::raw::c_char, + destination_port: ::std::os::raw::c_int, + originator_address: *const ::std::os::raw::c_char, + originator_port: ::std::os::raw::c_int, + userdata: *mut ::std::os::raw::c_void, + ) -> ssh_channel, +>; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ssh_server_callbacks_struct { @@ -1928,9 +2088,11 @@ pub struct ssh_server_callbacks_struct { pub gssapi_select_oid_function: ssh_gssapi_select_oid_callback, pub gssapi_accept_sec_ctx_function: ssh_gssapi_accept_sec_ctx_callback, pub gssapi_verify_mic_function: ssh_gssapi_verify_mic_callback, + pub channel_open_request_direct_tcpip_function: ssh_channel_open_request_direct_tcpip_callback, + pub auth_kbdint_function: ssh_auth_kbdint_callback, } pub type ssh_server_callbacks = *mut ssh_server_callbacks_struct; -extern "C" { +unsafe extern "C" { pub fn ssh_set_server_callbacks( session: ssh_session, cb: ssh_server_callbacks, @@ -1963,7 +2125,7 @@ pub struct ssh_packet_callbacks_struct { pub user: *mut ::std::os::raw::c_void, } pub type ssh_packet_callbacks = *mut ssh_packet_callbacks_struct; -extern "C" { +unsafe extern "C" { pub fn ssh_set_callbacks(session: ssh_session, cb: ssh_callbacks) -> ::std::os::raw::c_int; } pub type ssh_channel_data_callback = ::std::option::Option< @@ -2137,19 +2299,19 @@ pub struct ssh_channel_callbacks_struct { pub channel_request_response_function: ssh_channel_request_resp_callback, } pub type ssh_channel_callbacks = *mut ssh_channel_callbacks_struct; -extern "C" { +unsafe extern "C" { pub fn ssh_set_channel_callbacks( channel: ssh_channel, cb: ssh_channel_callbacks, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_add_channel_callbacks( channel: ssh_channel, cb: ssh_channel_callbacks, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_remove_channel_callbacks( channel: ssh_channel, cb: ssh_channel_callbacks, @@ -2170,24 +2332,24 @@ pub struct ssh_threads_callbacks_struct { pub mutex_unlock: ssh_thread_callback, pub thread_id: ssh_thread_id_callback, } -extern "C" { +unsafe extern "C" { pub fn ssh_threads_set_callbacks( cb: *mut ssh_threads_callbacks_struct, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_threads_get_default() -> *mut ssh_threads_callbacks_struct; } -extern "C" { +unsafe extern "C" { pub fn ssh_threads_get_pthread() -> *mut ssh_threads_callbacks_struct; } -extern "C" { +unsafe extern "C" { pub fn ssh_threads_get_noop() -> *mut ssh_threads_callbacks_struct; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_log_callback(cb: ssh_logging_callback) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_get_log_callback() -> ssh_logging_callback; } pub type ssh_jump_before_connection_callback = ::std::option::Option< @@ -2216,6 +2378,74 @@ pub struct ssh_jump_callbacks_struct { pub verify_knownhost: ssh_jump_verify_knownhost_callback, pub authenticate: ssh_jump_authenticate_callback, } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sk_enroll_response { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sk_sign_response { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sk_resident_key { + _unused: [u8; 0], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sk_option { + _unused: [u8; 0], +} +pub type sk_api_version_callback = ::std::option::Option u32>; +pub type sk_enroll_callback = ::std::option::Option< + unsafe extern "C" fn( + alg: u32, + challenge: *const u8, + challenge_len: usize, + application: *const ::std::os::raw::c_char, + flags: u8, + pin: *const ::std::os::raw::c_char, + options: *mut *mut sk_option, + enroll_response: *mut *mut sk_enroll_response, + ) -> ::std::os::raw::c_int, +>; +pub type sk_sign_callback = ::std::option::Option< + unsafe extern "C" fn( + alg: u32, + data: *const u8, + data_len: usize, + application: *const ::std::os::raw::c_char, + key_handle: *const u8, + key_handle_len: usize, + flags: u8, + pin: *const ::std::os::raw::c_char, + options: *mut *mut sk_option, + sign_response: *mut *mut sk_sign_response, + ) -> ::std::os::raw::c_int, +>; +pub type sk_load_resident_keys_callback = ::std::option::Option< + unsafe extern "C" fn( + pin: *const ::std::os::raw::c_char, + options: *mut *mut sk_option, + resident_keys: *mut *mut *mut sk_resident_key, + num_keys_found: *mut usize, + ) -> ::std::os::raw::c_int, +>; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ssh_sk_callbacks_struct { + pub size: usize, + pub api_version: sk_api_version_callback, + pub enroll: sk_enroll_callback, + pub sign: sk_sign_callback, + pub load_resident_keys: sk_load_resident_keys_callback, +} +pub type ssh_sk_callbacks = *mut ssh_sk_callbacks_struct; +unsafe extern "C" { + pub fn ssh_sk_get_default_callbacks() -> *const ssh_sk_callbacks_struct; +} #[repr(u32)] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum ssh_bind_options_e { @@ -2242,6 +2472,8 @@ pub enum ssh_bind_options_e { SSH_BIND_OPTIONS_MODULI = 20, SSH_BIND_OPTIONS_RSA_MIN_SIZE = 21, SSH_BIND_OPTIONS_IMPORT_KEY_STR = 22, + SSH_BIND_OPTIONS_GSSAPI_KEY_EXCHANGE = 23, + SSH_BIND_OPTIONS_GSSAPI_KEY_EXCHANGE_ALGS = 24, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -2259,114 +2491,114 @@ pub struct ssh_bind_callbacks_struct { pub incoming_connection: ssh_bind_incoming_connection_callback, } pub type ssh_bind_callbacks = *mut ssh_bind_callbacks_struct; -extern "C" { +unsafe extern "C" { pub fn ssh_bind_new() -> ssh_bind; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_options_set( sshbind: ssh_bind, type_: ssh_bind_options_e, value: *const ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_options_parse_config( sshbind: ssh_bind, filename: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_listen(ssh_bind_o: ssh_bind) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_set_callbacks( sshbind: ssh_bind, callbacks: ssh_bind_callbacks, userdata: *mut ::std::os::raw::c_void, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_set_blocking(ssh_bind_o: ssh_bind, blocking: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_get_fd(ssh_bind_o: ssh_bind) -> socket_t; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_set_fd(ssh_bind_o: ssh_bind, fd: socket_t); } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_fd_toaccept(ssh_bind_o: ssh_bind); } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_accept(ssh_bind_o: ssh_bind, session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_accept_fd( ssh_bind_o: ssh_bind, session: ssh_session, fd: socket_t, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_gssapi_get_creds(session: ssh_session) -> ssh_gssapi_creds; } -extern "C" { +unsafe extern "C" { pub fn ssh_handle_key_exchange(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_server_init_kex(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_bind_free(ssh_bind_o: ssh_bind); } -extern "C" { +unsafe extern "C" { pub fn ssh_set_auth_methods(session: ssh_session, auth_methods: ::std::os::raw::c_int); } -extern "C" { +unsafe extern "C" { pub fn ssh_send_issue_banner(session: ssh_session, banner: ssh_string) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_reply_default(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_user(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_password(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_pubkey(msg: ssh_message) -> ssh_key; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_kbdint_is_response(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_publickey_state(msg: ssh_message) -> ssh_publickey_state_e; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_reply_success( msg: ssh_message, partial: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_reply_pk_ok( msg: ssh_message, algo: ssh_string, pubkey: ssh_string, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_reply_pk_ok_simple(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_set_methods( msg: ssh_message, methods: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_auth_interactive_request( msg: ssh_message, name: *const ::std::os::raw::c_char, @@ -2376,19 +2608,19 @@ extern "C" { echo: *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_service_reply_success(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_service_service(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_global_request_reply_success( msg: ssh_message, bound_port: u16, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_set_message_callback( session: ssh_session, ssh_bind_message_callback: ::std::option::Option< @@ -2401,87 +2633,87 @@ extern "C" { data: *mut ::std::os::raw::c_void, ); } -extern "C" { +unsafe extern "C" { pub fn ssh_execute_message_callbacks(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_originator( msg: ssh_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_originator_port( msg: ssh_message, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_destination( msg: ssh_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_open_destination_port( msg: ssh_message, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_channel(msg: ssh_message) -> ssh_channel; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_pty_term(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_pty_width(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_pty_height(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_pty_pxwidth(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_pty_pxheight(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_env_name(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_env_value(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_command(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_subsystem(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_x11_single_connection( msg: ssh_message, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_x11_auth_protocol( msg: ssh_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_x11_auth_cookie( msg: ssh_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_channel_request_x11_screen_number(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_global_request_address(msg: ssh_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn ssh_message_global_request_port(msg: ssh_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_open_reverse_forward( channel: ssh_channel, remotehost: *const ::std::os::raw::c_char, @@ -2490,13 +2722,13 @@ extern "C" { localport: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_send_exit_status( channel: ssh_channel, exit_status: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_channel_request_send_exit_signal( channel: ssh_channel, signum: *const ::std::os::raw::c_char, @@ -2505,10 +2737,10 @@ extern "C" { lang: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_send_keepalive(session: ssh_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn ssh_accept(session: ssh_session) -> ::std::os::raw::c_int; } pub type sftp_attributes = *mut sftp_attributes_struct; @@ -2534,6 +2766,7 @@ pub struct sftp_aio_struct { _unused: [u8; 0], } pub type sftp_aio = *mut sftp_aio_struct; +pub type sftp_name_id_map = *mut sftp_name_id_map_struct; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct sftp_session_struct { @@ -2549,6 +2782,7 @@ pub struct sftp_session_struct { pub ext: sftp_ext, pub read_packet: sftp_packet, pub limits: sftp_limits_t, + pub outstanding_ids: *mut ssh_list, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -2669,75 +2903,82 @@ pub struct sftp_limits_struct { pub max_write_length: u64, pub max_open_handles: u64, } -extern "C" { +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct sftp_name_id_map_struct { + pub count: u32, + pub ids: *mut u32, + pub names: *mut *mut ::std::os::raw::c_char, +} +unsafe extern "C" { pub fn sftp_new(session: ssh_session) -> sftp_session; } -extern "C" { +unsafe extern "C" { pub fn sftp_new_channel(session: ssh_session, channel: ssh_channel) -> sftp_session; } -extern "C" { +unsafe extern "C" { pub fn sftp_free(sftp: sftp_session); } -extern "C" { +unsafe extern "C" { pub fn sftp_init(sftp: sftp_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_get_error(sftp: sftp_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_extensions_get_count(sftp: sftp_session) -> ::std::os::raw::c_uint; } -extern "C" { +unsafe extern "C" { pub fn sftp_extensions_get_name( sftp: sftp_session, indexn: ::std::os::raw::c_uint, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_extensions_get_data( sftp: sftp_session, indexn: ::std::os::raw::c_uint, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_extension_supported( sftp: sftp_session, name: *const ::std::os::raw::c_char, data: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_opendir(session: sftp_session, path: *const ::std::os::raw::c_char) -> sftp_dir; } -extern "C" { +unsafe extern "C" { pub fn sftp_readdir(session: sftp_session, dir: sftp_dir) -> sftp_attributes; } -extern "C" { +unsafe extern "C" { pub fn sftp_dir_eof(dir: sftp_dir) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_stat(session: sftp_session, path: *const ::std::os::raw::c_char) -> sftp_attributes; } -extern "C" { +unsafe extern "C" { pub fn sftp_lstat( session: sftp_session, path: *const ::std::os::raw::c_char, ) -> sftp_attributes; } -extern "C" { +unsafe extern "C" { pub fn sftp_fstat(file: sftp_file) -> sftp_attributes; } -extern "C" { +unsafe extern "C" { pub fn sftp_attributes_free(file: sftp_attributes); } -extern "C" { +unsafe extern "C" { pub fn sftp_closedir(dir: sftp_dir) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_close(file: sftp_file) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_open( session: sftp_session, file: *const ::std::os::raw::c_char, @@ -2745,19 +2986,19 @@ extern "C" { mode: mode_t, ) -> sftp_file; } -extern "C" { +unsafe extern "C" { pub fn sftp_file_set_nonblocking(handle: sftp_file); } -extern "C" { +unsafe extern "C" { pub fn sftp_file_set_blocking(handle: sftp_file); } -extern "C" { +unsafe extern "C" { pub fn sftp_read(file: sftp_file, buf: *mut ::std::os::raw::c_void, count: usize) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_async_read_begin(file: sftp_file, len: u32) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_async_read( file: sftp_file, data: *mut ::std::os::raw::c_void, @@ -2765,23 +3006,23 @@ extern "C" { id: u32, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_write(file: sftp_file, buf: *const ::std::os::raw::c_void, count: usize) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_aio_free(aio: sftp_aio); } -extern "C" { +unsafe extern "C" { pub fn sftp_aio_begin_read(file: sftp_file, len: usize, aio: *mut sftp_aio) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_aio_wait_read( aio: *mut sftp_aio, buf: *mut ::std::os::raw::c_void, buf_size: usize, ) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_aio_begin_write( file: sftp_file, buf: *const ::std::os::raw::c_void, @@ -2789,65 +3030,65 @@ extern "C" { aio: *mut sftp_aio, ) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_aio_wait_write(aio: *mut sftp_aio) -> isize; } -extern "C" { +unsafe extern "C" { pub fn sftp_seek(file: sftp_file, new_offset: u32) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_seek64(file: sftp_file, new_offset: u64) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_tell(file: sftp_file) -> ::std::os::raw::c_ulong; } -extern "C" { +unsafe extern "C" { pub fn sftp_tell64(file: sftp_file) -> u64; } -extern "C" { +unsafe extern "C" { pub fn sftp_rewind(file: sftp_file); } -extern "C" { +unsafe extern "C" { pub fn sftp_unlink( sftp: sftp_session, file: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_rmdir( sftp: sftp_session, directory: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_mkdir( sftp: sftp_session, directory: *const ::std::os::raw::c_char, mode: mode_t, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_rename( sftp: sftp_session, original: *const ::std::os::raw::c_char, newname: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_setstat( sftp: sftp_session, file: *const ::std::os::raw::c_char, attr: sftp_attributes, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_lsetstat( sftp: sftp_session, file: *const ::std::os::raw::c_char, attr: sftp_attributes, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_chown( sftp: sftp_session, file: *const ::std::os::raw::c_char, @@ -2855,147 +3096,160 @@ extern "C" { group: gid_t, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_chmod( sftp: sftp_session, file: *const ::std::os::raw::c_char, mode: mode_t, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_utimes( sftp: sftp_session, file: *const ::std::os::raw::c_char, times: *const timeval, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_symlink( sftp: sftp_session, target: *const ::std::os::raw::c_char, dest: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_readlink( sftp: sftp_session, path: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_hardlink( sftp: sftp_session, oldpath: *const ::std::os::raw::c_char, newpath: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_statvfs(sftp: sftp_session, path: *const ::std::os::raw::c_char) -> sftp_statvfs_t; } -extern "C" { +unsafe extern "C" { pub fn sftp_fstatvfs(file: sftp_file) -> sftp_statvfs_t; } -extern "C" { +unsafe extern "C" { pub fn sftp_statvfs_free(statvfs_o: sftp_statvfs_t); } -extern "C" { +unsafe extern "C" { pub fn sftp_fsync(file: sftp_file) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_limits(sftp: sftp_session) -> sftp_limits_t; } -extern "C" { +unsafe extern "C" { pub fn sftp_limits_free(limits: sftp_limits_t); } -extern "C" { +unsafe extern "C" { pub fn sftp_canonicalize_path( sftp: sftp_session, path: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_server_version(sftp: sftp_session) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_expand_path( sftp: sftp_session, path: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_home_directory( sftp: sftp_session, username: *const ::std::os::raw::c_char, ) -> *mut ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { + pub fn sftp_name_id_map_new(count: u32) -> sftp_name_id_map; +} +unsafe extern "C" { + pub fn sftp_name_id_map_free(map: sftp_name_id_map); +} +unsafe extern "C" { + pub fn sftp_get_users_groups_by_id( + sftp: sftp_session, + users_map: sftp_name_id_map, + groups_map: sftp_name_id_map, + ) -> ::std::os::raw::c_int; +} +unsafe extern "C" { pub fn sftp_get_client_message(sftp: sftp_session) -> sftp_client_message; } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_free(msg: sftp_client_message); } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_get_type(msg: sftp_client_message) -> u8; } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_get_filename( msg: sftp_client_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_set_filename( msg: sftp_client_message, newname: *const ::std::os::raw::c_char, ); } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_get_data(msg: sftp_client_message) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_get_flags(msg: sftp_client_message) -> u32; } -extern "C" { +unsafe extern "C" { pub fn sftp_client_message_get_submessage( msg: sftp_client_message, ) -> *const ::std::os::raw::c_char; } -extern "C" { +unsafe extern "C" { pub fn sftp_send_client_message( sftp: sftp_session, msg: sftp_client_message, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_name( msg: sftp_client_message, name: *const ::std::os::raw::c_char, attr: sftp_attributes, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_handle(msg: sftp_client_message, handle: ssh_string) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_handle_alloc(sftp: sftp_session, info: *mut ::std::os::raw::c_void) -> ssh_string; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_attr( msg: sftp_client_message, attr: sftp_attributes, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_handle(sftp: sftp_session, handle: ssh_string) -> *mut ::std::os::raw::c_void; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_status( msg: sftp_client_message, status: u32, message: *const ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_names_add( msg: sftp_client_message, file: *const ::std::os::raw::c_char, @@ -3003,17 +3257,17 @@ extern "C" { attr: sftp_attributes, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_names(msg: sftp_client_message) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_reply_data( msg: sftp_client_message, data: *const ::std::os::raw::c_void, len: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int; } -extern "C" { +unsafe extern "C" { pub fn sftp_handle_remove(sftp: sftp_session, handle: *mut ::std::os::raw::c_void); } pub type __builtin_va_list = [__va_list_tag; 1usize]; @@ -3025,3 +3279,8 @@ pub struct __va_list_tag { pub overflow_arg_area: *mut ::std::os::raw::c_void, pub reg_save_area: *mut ::std::os::raw::c_void, } +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct ssh_list { + pub _address: u8, +} diff --git a/libssh-rs-sys/update-ffi.sh b/libssh-rs-sys/update-ffi.sh index 23f1bf8..3948a85 100755 --- a/libssh-rs-sys/update-ffi.sh +++ b/libssh-rs-sys/update-ffi.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Regenerate the ffi bindings cat >binding.h <<-EOT typedef unsigned long size_t; @@ -31,6 +31,6 @@ bindgen \ --allowlist-var 'SSH.*' \ --verbose \ -- \ - -Ivendored/include + -Ivendored/include rm vendored/include/libssh/libssh_version.h diff --git a/libssh-rs-sys/vendored b/libssh-rs-sys/vendored index ca9c055..07430de 160000 --- a/libssh-rs-sys/vendored +++ b/libssh-rs-sys/vendored @@ -1 +1 @@ -Subproject commit ca9c055d7c78ce357346ac7c2b14047568d47aa1 +Subproject commit 07430deb9b97b751ec5ea5a7fc307f40bf042e0a diff --git a/libssh-rs/README.md b/libssh-rs/README.md index e26ae1f..94ee9f2 100644 --- a/libssh-rs/README.md +++ b/libssh-rs/README.md @@ -10,10 +10,7 @@ Bindings to [libssh](https://www.libssh.org/). The `vendored` feature causes a static version of libssh to be compiled and linked into your program. If no system `libssh` is detected at build time, or that system library is too old, then the vendored -`libssh` implementation will be used automatically. Note that the `libssh-rs` bindings make use of -a couple of new interfaces that have not made it into a released version of `libssh` at the time -of writing this note, so all users will be effectively running with `vendored` enabled until libssh -releases version `0.9.7`. +`libssh` implementation will be used automatically. The `vendored-openssl` feature causes a vendored copy of `openssl` to be compiled and linked into your program.