wez / libssh-rs

Rust bindings for libssh https://www.libssh.org/
MIT License
31 stars 19 forks source link

Enabled LibSSH's WITH_SERVER flag #19

Closed JetpackDuba closed 1 year ago

JetpackDuba commented 1 year ago

Fixes issue #18.

Quoting myself:

When using a statically built version of libssh with CMake it worked just fine, after a lot of digging and comparing, I've found that this issue shows up when building libssh with the flag WITH_SERVER disabled/off (Enabled by default when building with CMake). After enabling it and adding some modifications to the files list, it worked perfectly (tested on ArchLinux and Windows).

The GLOBAL_BIND_CONFIG flag value ("/etc/ssh/libssh_server_config") was copied from CMake default config, as it was required for the WITH_SERVER flag. Also note that bind_config.c wasn't necessary when building on Linux but it was on Windows.

wez commented 1 year ago

Thanks for digging in. This issue is weird! My theory is that the ssh_message_reply_default implementation that gets compiled in WITH_SERVER makes the difference here; most of the rest of the code in the added files seems like it wouldn't have an impact on anything.

JetpackDuba commented 1 year ago

Not really sure, unfortunately I'm not familiar with libssh, but seems possible. Shouldn't the server methods be available in case someone wants to implement SSH from the server side?

The linting has failed so I've pushed one more change to fix it.