diff options
author | Wez Furlong <wez@wezfurlong.org> | 2019-07-24 08:04:51 -0700 |
---|---|---|
committer | Wez Furlong <wez@wezfurlong.org> | 2019-07-31 15:26:38 -0700 |
commit | f29ca5b717858d365f0477d824d2069ce727a702 (patch) | |
tree | 2b9d1301603b0ae38d5bb7650e42454b50fd14b3 /libssh2-sys | |
parent | 3aa8096bc4e1c6c762f8553c516b5ce099ba5f71 (diff) | |
download | ssh2-rs-f29ca5b717858d365f0477d824d2069ce727a702.zip |
Support keyboard-interactive authentication
Refs: https://github.com/alexcrichton/ssh2-rs/issues/65
Diffstat (limited to 'libssh2-sys')
-rw-r--r-- | libssh2-sys/lib.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libssh2-sys/lib.rs b/libssh2-sys/lib.rs index 5ce1dc2..8157dab 100644 --- a/libssh2-sys/lib.rs +++ b/libssh2-sys/lib.rs @@ -266,6 +266,30 @@ pub type LIBSSH2_PASSWD_CHANGEREQ_FUNC = extern "C" fn( abstrakt: *mut *mut c_void, ); +pub type LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC = extern "C" fn( + username: *const c_char, + username_len: c_int, + instruction: *const c_char, + instruction_len: c_int, + num_prompts: c_int, + prompts: *const LIBSSH2_USERAUTH_KBDINT_PROMPT, + responses: *mut LIBSSH2_USERAUTH_KBDINT_RESPONSE, + abstrakt: *mut *mut c_void, +); + +#[repr(C)] +pub struct LIBSSH2_USERAUTH_KBDINT_PROMPT { + pub text: *mut c_char, + pub length: c_uint, + pub echo: c_uchar, +} + +#[repr(C)] +pub struct LIBSSH2_USERAUTH_KBDINT_RESPONSE { + pub text: *mut c_char, + pub length: c_uint, +} + #[cfg(unix)] pub type libssh2_socket_t = c_int; #[cfg(all(windows, target_arch = "x86"))] @@ -287,6 +311,7 @@ extern "C" { realloc: Option<LIBSSH2_REALLOC_FUNC>, abstrakt: *mut c_void, ) -> *mut LIBSSH2_SESSION; + pub fn libssh2_session_abstract(session: *mut LIBSSH2_SESSION) -> *mut *mut c_void; pub fn libssh2_session_free(sess: *mut LIBSSH2_SESSION) -> c_int; pub fn libssh2_session_banner_get(sess: *mut LIBSSH2_SESSION) -> *const c_char; pub fn libssh2_session_banner_set(sess: *mut LIBSSH2_SESSION, banner: *const c_char) -> c_int; @@ -499,6 +524,12 @@ extern "C" { password_len: c_uint, password_change_cb: Option<LIBSSH2_PASSWD_CHANGEREQ_FUNC>, ) -> c_int; + pub fn libssh2_userauth_keyboard_interactive_ex( + session: *mut LIBSSH2_SESSION, + username: *const c_char, + username_len: c_uint, + callback: Option<LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC>, + ) -> c_int; // knownhost pub fn libssh2_knownhost_free(hosts: *mut LIBSSH2_KNOWNHOSTS); |