diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-11-10 21:15:58 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-11-14 04:58:38 +0000 |
commit | 0795c988b072ef45e1a389d51b49ec4ee235c216 (patch) | |
tree | 90a26ec72e0bc8d1537a816f073f4ee7e104f8a2 /extcap/ssh-base.c | |
parent | 7a29c3d2eb74d60cb6e60aa1ab89b9959370228b (diff) |
extcap: save debug flag and use it to activate ssh debug.
Change-Id: Ida32834f8c0838f1d815f7e33116b6a6161acf34
Reviewed-on: https://code.wireshark.org/review/30572
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'extcap/ssh-base.c')
-rw-r--r-- | extcap/ssh-base.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c index d67ef91fef..75d1572a0f 100644 --- a/extcap/ssh-base.c +++ b/extcap/ssh-base.c @@ -17,6 +17,13 @@ #include <extcap/extcap-base.h> #include <log.h> #include <string.h> +#include <libssh/callbacks.h> +#include <ws_attributes.h> + +void extcap_log(int priority _U_, const char *function, const char *buffer, void *userdata _U_) +{ + g_debug("[%s] %s", function, buffer); +} ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info) { @@ -48,6 +55,12 @@ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_inf goto failure; } + if (ssh_params->debug) { + int debug_level = SSH_LOG_INFO; + ssh_options_set(sshs, SSH_OPTIONS_LOG_VERBOSITY, &debug_level); + ssh_set_log_callback(extcap_log); + } + if (ssh_params->port != 0) { port = ssh_params->port; if (ssh_options_set(sshs, SSH_OPTIONS_PORT, &port)) { |