Skip to content

Commit e572735

Browse files
committed
Need a bigger version bump because libssh broke its ABI
The option enum variant values changed in a backwards incompatible way.
1 parent 995e64e commit e572735

File tree

4 files changed

+129
-107
lines changed

4 files changed

+129
-107
lines changed

libssh-rs-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libssh-rs-sys"
3-
version = "0.1.4"
3+
version = "0.2.0"
44
authors = ["Wez Furlong"]
55
edition = "2018"
66
links = "libssh"

libssh-rs-sys/src/lib.rs

Lines changed: 119 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* automatically generated by rust-bindgen 0.59.1 */
1+
/* automatically generated by rust-bindgen 0.65.1 */
22

33
#![allow(non_snake_case)]
44
#![allow(non_camel_case_types)]
@@ -187,16 +187,11 @@ pub const SSH2_OPEN_UNKNOWN_CHANNEL_TYPE: u32 = 3;
187187
pub const SSH2_OPEN_RESOURCE_SHORTAGE: u32 = 4;
188188
pub const SSH2_EXTENDED_DATA_STDERR: u32 = 1;
189189
pub type va_list = __builtin_va_list;
190-
pub type __uint8_t = ::std::os::raw::c_uchar;
191-
pub type __uint16_t = ::std::os::raw::c_ushort;
192-
pub type __uint32_t = ::std::os::raw::c_uint;
193-
pub type __uint64_t = ::std::os::raw::c_ulong;
194190
pub type __uid_t = ::std::os::raw::c_uint;
195191
pub type __gid_t = ::std::os::raw::c_uint;
196192
pub type __mode_t = ::std::os::raw::c_uint;
197193
pub type __time_t = ::std::os::raw::c_long;
198194
pub type __suseconds_t = ::std::os::raw::c_long;
199-
pub type __ssize_t = ::std::os::raw::c_long;
200195
pub type gid_t = __gid_t;
201196
pub type uid_t = __uid_t;
202197
pub type mode_t = __mode_t;
@@ -471,7 +466,8 @@ pub enum ssh_options_e {
471466
SSH_OPTIONS_PROCESS_CONFIG = 38,
472467
SSH_OPTIONS_REKEY_DATA = 39,
473468
SSH_OPTIONS_REKEY_TIME = 40,
474-
SSH_OPTIONS_IDENTITY_AGENT = 41,
469+
SSH_OPTIONS_RSA_MIN_SIZE = 41,
470+
SSH_OPTIONS_IDENTITY_AGENT = 42,
475471
}
476472
pub const SSH_SCP_WRITE: _bindgen_ty_11 = _bindgen_ty_11::SSH_SCP_WRITE;
477473
pub const SSH_SCP_READ: _bindgen_ty_11 = _bindgen_ty_11::SSH_SCP_READ;
@@ -677,14 +673,6 @@ extern "C" {
677673
extern "C" {
678674
pub fn ssh_channel_send_eof(channel: ssh_channel) -> ::std::os::raw::c_int;
679675
}
680-
extern "C" {
681-
pub fn ssh_channel_select(
682-
readchans: *mut ssh_channel,
683-
writechans: *mut ssh_channel,
684-
exceptchans: *mut ssh_channel,
685-
timeout: *mut timeval,
686-
) -> ::std::os::raw::c_int;
687-
}
688676
extern "C" {
689677
pub fn ssh_channel_set_blocking(channel: ssh_channel, blocking: ::std::os::raw::c_int);
690678
}
@@ -755,6 +743,15 @@ extern "C" {
755743
extern "C" {
756744
pub fn ssh_finalize() -> ::std::os::raw::c_int;
757745
}
746+
extern "C" {
747+
pub fn ssh_channel_open_forward_port(
748+
session: ssh_session,
749+
timeout_ms: ::std::os::raw::c_int,
750+
destination_port: *mut ::std::os::raw::c_int,
751+
originator: *mut *mut ::std::os::raw::c_char,
752+
originator_port: *mut ::std::os::raw::c_int,
753+
) -> ssh_channel;
754+
}
758755
extern "C" {
759756
pub fn ssh_channel_accept_forward(
760757
session: ssh_session,
@@ -871,6 +868,97 @@ extern "C" {
871868
len: usize,
872869
);
873870
}
871+
extern "C" {
872+
pub fn ssh_channel_select(
873+
readchans: *mut ssh_channel,
874+
writechans: *mut ssh_channel,
875+
exceptchans: *mut ssh_channel,
876+
timeout: *mut timeval,
877+
) -> ::std::os::raw::c_int;
878+
}
879+
extern "C" {
880+
pub fn ssh_scp_accept_request(scp: ssh_scp) -> ::std::os::raw::c_int;
881+
}
882+
extern "C" {
883+
pub fn ssh_scp_close(scp: ssh_scp) -> ::std::os::raw::c_int;
884+
}
885+
extern "C" {
886+
pub fn ssh_scp_deny_request(
887+
scp: ssh_scp,
888+
reason: *const ::std::os::raw::c_char,
889+
) -> ::std::os::raw::c_int;
890+
}
891+
extern "C" {
892+
pub fn ssh_scp_free(scp: ssh_scp);
893+
}
894+
extern "C" {
895+
pub fn ssh_scp_init(scp: ssh_scp) -> ::std::os::raw::c_int;
896+
}
897+
extern "C" {
898+
pub fn ssh_scp_leave_directory(scp: ssh_scp) -> ::std::os::raw::c_int;
899+
}
900+
extern "C" {
901+
pub fn ssh_scp_new(
902+
session: ssh_session,
903+
mode: ::std::os::raw::c_int,
904+
location: *const ::std::os::raw::c_char,
905+
) -> ssh_scp;
906+
}
907+
extern "C" {
908+
pub fn ssh_scp_pull_request(scp: ssh_scp) -> ::std::os::raw::c_int;
909+
}
910+
extern "C" {
911+
pub fn ssh_scp_push_directory(
912+
scp: ssh_scp,
913+
dirname: *const ::std::os::raw::c_char,
914+
mode: ::std::os::raw::c_int,
915+
) -> ::std::os::raw::c_int;
916+
}
917+
extern "C" {
918+
pub fn ssh_scp_push_file(
919+
scp: ssh_scp,
920+
filename: *const ::std::os::raw::c_char,
921+
size: usize,
922+
perms: ::std::os::raw::c_int,
923+
) -> ::std::os::raw::c_int;
924+
}
925+
extern "C" {
926+
pub fn ssh_scp_push_file64(
927+
scp: ssh_scp,
928+
filename: *const ::std::os::raw::c_char,
929+
size: u64,
930+
perms: ::std::os::raw::c_int,
931+
) -> ::std::os::raw::c_int;
932+
}
933+
extern "C" {
934+
pub fn ssh_scp_read(
935+
scp: ssh_scp,
936+
buffer: *mut ::std::os::raw::c_void,
937+
size: usize,
938+
) -> ::std::os::raw::c_int;
939+
}
940+
extern "C" {
941+
pub fn ssh_scp_request_get_filename(scp: ssh_scp) -> *const ::std::os::raw::c_char;
942+
}
943+
extern "C" {
944+
pub fn ssh_scp_request_get_permissions(scp: ssh_scp) -> ::std::os::raw::c_int;
945+
}
946+
extern "C" {
947+
pub fn ssh_scp_request_get_size(scp: ssh_scp) -> usize;
948+
}
949+
extern "C" {
950+
pub fn ssh_scp_request_get_size64(scp: ssh_scp) -> u64;
951+
}
952+
extern "C" {
953+
pub fn ssh_scp_request_get_warning(scp: ssh_scp) -> *const ::std::os::raw::c_char;
954+
}
955+
extern "C" {
956+
pub fn ssh_scp_write(
957+
scp: ssh_scp,
958+
buffer: *const ::std::os::raw::c_void,
959+
len: usize,
960+
) -> ::std::os::raw::c_int;
961+
}
874962
extern "C" {
875963
pub fn ssh_get_random(
876964
where_: *mut ::std::os::raw::c_void,
@@ -1073,6 +1161,9 @@ extern "C" {
10731161
extern "C" {
10741162
pub fn ssh_key_cmp(k1: ssh_key, k2: ssh_key, what: ssh_keycmp_e) -> ::std::os::raw::c_int;
10751163
}
1164+
extern "C" {
1165+
pub fn ssh_key_dup(key: ssh_key) -> ssh_key;
1166+
}
10761167
extern "C" {
10771168
pub fn ssh_pki_generate(
10781169
type_: ssh_keytypes_e,
@@ -1199,89 +1290,6 @@ extern "C" {
11991290
extern "C" {
12001291
pub fn ssh_gssapi_set_creds(session: ssh_session, creds: ssh_gssapi_creds);
12011292
}
1202-
extern "C" {
1203-
pub fn ssh_scp_accept_request(scp: ssh_scp) -> ::std::os::raw::c_int;
1204-
}
1205-
extern "C" {
1206-
pub fn ssh_scp_close(scp: ssh_scp) -> ::std::os::raw::c_int;
1207-
}
1208-
extern "C" {
1209-
pub fn ssh_scp_deny_request(
1210-
scp: ssh_scp,
1211-
reason: *const ::std::os::raw::c_char,
1212-
) -> ::std::os::raw::c_int;
1213-
}
1214-
extern "C" {
1215-
pub fn ssh_scp_free(scp: ssh_scp);
1216-
}
1217-
extern "C" {
1218-
pub fn ssh_scp_init(scp: ssh_scp) -> ::std::os::raw::c_int;
1219-
}
1220-
extern "C" {
1221-
pub fn ssh_scp_leave_directory(scp: ssh_scp) -> ::std::os::raw::c_int;
1222-
}
1223-
extern "C" {
1224-
pub fn ssh_scp_new(
1225-
session: ssh_session,
1226-
mode: ::std::os::raw::c_int,
1227-
location: *const ::std::os::raw::c_char,
1228-
) -> ssh_scp;
1229-
}
1230-
extern "C" {
1231-
pub fn ssh_scp_pull_request(scp: ssh_scp) -> ::std::os::raw::c_int;
1232-
}
1233-
extern "C" {
1234-
pub fn ssh_scp_push_directory(
1235-
scp: ssh_scp,
1236-
dirname: *const ::std::os::raw::c_char,
1237-
mode: ::std::os::raw::c_int,
1238-
) -> ::std::os::raw::c_int;
1239-
}
1240-
extern "C" {
1241-
pub fn ssh_scp_push_file(
1242-
scp: ssh_scp,
1243-
filename: *const ::std::os::raw::c_char,
1244-
size: usize,
1245-
perms: ::std::os::raw::c_int,
1246-
) -> ::std::os::raw::c_int;
1247-
}
1248-
extern "C" {
1249-
pub fn ssh_scp_push_file64(
1250-
scp: ssh_scp,
1251-
filename: *const ::std::os::raw::c_char,
1252-
size: u64,
1253-
perms: ::std::os::raw::c_int,
1254-
) -> ::std::os::raw::c_int;
1255-
}
1256-
extern "C" {
1257-
pub fn ssh_scp_read(
1258-
scp: ssh_scp,
1259-
buffer: *mut ::std::os::raw::c_void,
1260-
size: usize,
1261-
) -> ::std::os::raw::c_int;
1262-
}
1263-
extern "C" {
1264-
pub fn ssh_scp_request_get_filename(scp: ssh_scp) -> *const ::std::os::raw::c_char;
1265-
}
1266-
extern "C" {
1267-
pub fn ssh_scp_request_get_permissions(scp: ssh_scp) -> ::std::os::raw::c_int;
1268-
}
1269-
extern "C" {
1270-
pub fn ssh_scp_request_get_size(scp: ssh_scp) -> usize;
1271-
}
1272-
extern "C" {
1273-
pub fn ssh_scp_request_get_size64(scp: ssh_scp) -> u64;
1274-
}
1275-
extern "C" {
1276-
pub fn ssh_scp_request_get_warning(scp: ssh_scp) -> *const ::std::os::raw::c_char;
1277-
}
1278-
extern "C" {
1279-
pub fn ssh_scp_write(
1280-
scp: ssh_scp,
1281-
buffer: *const ::std::os::raw::c_void,
1282-
len: usize,
1283-
) -> ::std::os::raw::c_int;
1284-
}
12851293
extern "C" {
12861294
pub fn ssh_select(
12871295
channels: *mut ssh_channel,
@@ -1577,6 +1585,12 @@ extern "C" {
15771585
extern "C" {
15781586
pub fn ssh_buffer_get_len(buffer: ssh_buffer) -> u32;
15791587
}
1588+
extern "C" {
1589+
pub fn ssh_session_set_disconnect_message(
1590+
session: ssh_session,
1591+
message: *const ::std::os::raw::c_char,
1592+
) -> ::std::os::raw::c_int;
1593+
}
15801594
#[repr(C)]
15811595
#[derive(Debug, Copy, Clone)]
15821596
pub struct ssh_private_key_struct {
@@ -1665,7 +1679,7 @@ pub type ssh_callback_data = ::std::option::Option<
16651679
data: *const ::std::os::raw::c_void,
16661680
len: usize,
16671681
user: *mut ::std::os::raw::c_void,
1668-
) -> ::std::os::raw::c_int,
1682+
) -> usize,
16691683
>;
16701684
pub type ssh_callback_int_int = ::std::option::Option<
16711685
unsafe extern "C" fn(
@@ -2003,7 +2017,7 @@ pub type ssh_channel_write_wontblock_callback = ::std::option::Option<
20032017
unsafe extern "C" fn(
20042018
session: ssh_session,
20052019
channel: ssh_channel,
2006-
bytes: usize,
2020+
bytes: u32,
20072021
userdata: *mut ::std::os::raw::c_void,
20082022
) -> ::std::os::raw::c_int,
20092023
>;
@@ -2106,6 +2120,7 @@ pub enum ssh_bind_options_e {
21062120
SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS = 18,
21072121
SSH_BIND_OPTIONS_PROCESS_CONFIG = 19,
21082122
SSH_BIND_OPTIONS_MODULI = 20,
2123+
SSH_BIND_OPTIONS_RSA_MIN_SIZE = 21,
21092124
}
21102125
#[repr(C)]
21112126
#[derive(Debug, Copy, Clone)]
@@ -2186,6 +2201,10 @@ extern "C" {
21862201
extern "C" {
21872202
pub fn ssh_set_auth_methods(session: ssh_session, auth_methods: ::std::os::raw::c_int);
21882203
}
2204+
extern "C" {
2205+
pub fn ssh_send_issue_banner(session: ssh_session, banner: ssh_string)
2206+
-> ::std::os::raw::c_int;
2207+
}
21892208
extern "C" {
21902209
pub fn ssh_message_reply_default(msg: ssh_message) -> ::std::os::raw::c_int;
21912210
}

libssh-rs-sys/update-ffi.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ typedef unsigned long size_t;
99
#include <libssh/ssh2.h>
1010
EOT
1111

12+
touch vendored/include/libssh/libssh_version.h
13+
1214
bindgen \
1315
binding.h \
1416
-o src/lib.rs \
@@ -24,10 +26,11 @@ bindgen \
2426
--constified-enum ssh_known_hosts_e \
2527
--constified-enum ssh_auth_e \
2628
--constified-enum ssh_keytypes_e \
27-
--whitelist-type '(sftp|ssh).*' \
28-
--whitelist-function '(sftp|ssh).*' \
29-
--whitelist-var 'SSH.*' \
30-
--size_t-is-usize \
29+
--allowlist-type '(sftp|ssh).*' \
30+
--allowlist-function '(sftp|ssh).*' \
31+
--allowlist-var 'SSH.*' \
32+
--verbose \
3133
-- \
3234
-Ivendored/include
3335

36+
rm vendored/include/libssh/libssh_version.h

libssh-rs/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "libssh-rs"
3-
version = "0.1.9"
3+
version = "0.2.0"
44
edition = "2018"
55
repository = "https://github.com/wez/libssh-rs"
66
description = "Bindings to the libssh library"
@@ -10,7 +10,7 @@ license = "MIT"
1010

1111
[dependencies]
1212
bitflags = "1.3"
13-
libssh-rs-sys = { version = "0.1.4", path = "../libssh-rs-sys" }
13+
libssh-rs-sys = { version = "0.2.0", path = "../libssh-rs-sys" }
1414
thiserror = "1.0"
1515
# Pinned on this last version with openssl-src-300 until a newer release
1616
# is made that unblocks it.

0 commit comments

Comments
 (0)