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 | |
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')
-rw-r--r-- | extcap/ciscodump.c | 1 | ||||
-rw-r--r-- | extcap/extcap-base.c | 1 | ||||
-rw-r--r-- | extcap/extcap-base.h | 1 | ||||
-rw-r--r-- | extcap/ssh-base.c | 13 | ||||
-rw-r--r-- | extcap/ssh-base.h | 1 | ||||
-rw-r--r-- | extcap/sshdump.c | 1 |
6 files changed, 18 insertions, 0 deletions
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index 85c23c3580..49c3ecbbf2 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -690,6 +690,7 @@ int real_main(int argc, char **argv) g_warning("ERROR: count of packets must be specified (--remote-count)"); goto end; } + ssh_params->debug = extcap_conf->debug; ret = ssh_open_remote_connection(ssh_params, remote_interface, remote_filter, count, extcap_conf->fifo); } else { diff --git a/extcap/extcap-base.c b/extcap/extcap-base.c index 1ea4397181..f047ecb0bc 100644 --- a/extcap/extcap-base.c +++ b/extcap/extcap-base.c @@ -117,6 +117,7 @@ uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * #else setenv("G_MESSAGES_DEBUG", "all", 1); #endif + extcap->debug = TRUE; break; case EXTCAP_OPT_DEBUG_FILE: extcap_init_custom_log(optargument); diff --git a/extcap/extcap-base.h b/extcap/extcap-base.h index c3a95bedb3..021c2f5015 100644 --- a/extcap/extcap-base.h +++ b/extcap/extcap-base.h @@ -82,6 +82,7 @@ typedef struct _extcap_parameters char * help_header; GList * help_options; + gboolean debug; } extcap_parameters; void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription ); 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)) { diff --git a/extcap/ssh-base.h b/extcap/ssh-base.h index a19d5a2741..55565646d9 100644 --- a/extcap/ssh-base.h +++ b/extcap/ssh-base.h @@ -45,6 +45,7 @@ typedef struct _ssh_params { gchar* sshkey_path; gchar* sshkey_passphrase; gchar* proxycommand; + gboolean debug; } ssh_params_t; /* Create a ssh connection using all the possible authentication menthods */ diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 75c6086582..4796b857aa 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -512,6 +512,7 @@ int real_main(int argc, char **argv) goto end; } filter = concat_filters(extcap_conf->capture_filter, remote_filter); + ssh_params->debug = extcap_conf->debug; ret = ssh_open_remote_connection(ssh_params, remote_interface, filter, remote_capture_command, use_sudo, noprom, count, extcap_conf->fifo); g_free(filter); |