diff options
author | Guy Harris <gharris@sonic.net> | 2020-07-16 02:42:52 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-07-16 10:00:01 +0000 |
commit | 3dedaf80648c00a5c1e7b6498d553f793600cc23 (patch) | |
tree | ecd21aea14de9a0e0063610b0e0016439b828e2b /extcap | |
parent | 92966774721fe914403cebbcbc38ceb7e4c01ea3 (diff) |
extcap: put the code to add lissh version information into a common routine.
add_libssh_info() can be used by ciscodump, sshdump. and any other
extcap program that uses libssh.
Change-Id: I60474bd610eeb7dfb6ec07fc1aaaf19c4f745cdd
Reviewed-on: https://code.wireshark.org/review/37882
Petri-Dish: Guy Harris <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'extcap')
-rw-r--r-- | extcap/ciscodump.c | 3 | ||||
-rw-r--r-- | extcap/ssh-base.c | 6 | ||||
-rw-r--r-- | extcap/ssh-base.h | 5 | ||||
-rw-r--r-- | extcap/sshdump.c | 3 |
4 files changed, 13 insertions, 4 deletions
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index 42b4db31e7..9b845fd8d7 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -551,8 +551,7 @@ int main(int argc, char *argv[]) help_url = data_file_url("ciscodump.html"); extcap_base_set_util_info(extcap_conf, argv[0], CISCODUMP_VERSION_MAJOR, CISCODUMP_VERSION_MINOR, CISCODUMP_VERSION_RELEASE, help_url); - extcap_base_set_compiled_with(extcap_conf, "libssh version %s", SSH_STRINGIFY(LIBSSH_VERSION)); - extcap_base_set_running_with(extcap_conf, "libssh version %s", ssh_version(0)); + add_libssh_info(extcap_conf); g_free(help_url); extcap_base_register_interface(extcap_conf, CISCODUMP_EXTCAP_INTERFACE, "Cisco remote capture", 147, "Remote capture dependent DLT"); diff --git a/extcap/ssh-base.c b/extcap/ssh-base.c index eb3853e4cf..342cf6d578 100644 --- a/extcap/ssh-base.c +++ b/extcap/ssh-base.c @@ -25,6 +25,12 @@ static void extcap_log(int priority _U_, const char *function, const char *buffe g_debug("[%s] %s", function, buffer); } +void add_libssh_info(extcap_parameters * extcap_conf) +{ + extcap_base_set_compiled_with(extcap_conf, "libssh version %s", SSH_STRINGIFY(LIBSSH_VERSION)); + extcap_base_set_running_with(extcap_conf, "libssh version %s", ssh_version(0)); +} + ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info) { ssh_session sshs; diff --git a/extcap/ssh-base.h b/extcap/ssh-base.h index 55565646d9..11a6d62043 100644 --- a/extcap/ssh-base.h +++ b/extcap/ssh-base.h @@ -17,6 +17,8 @@ #include <glib.h> +#include <extcap/extcap-base.h> + #ifndef STDERR_FILENO #define STDERR_FILENO 2 #endif @@ -48,6 +50,9 @@ typedef struct _ssh_params { gboolean debug; } ssh_params_t; +/* Add libssh version information to an extcap_parameters structure */ +void add_libssh_info(extcap_parameters * extcap_conf); + /* Create a ssh connection using all the possible authentication menthods */ ssh_session create_ssh_connection(const ssh_params_t* ssh_params, char** err_info); diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 4e13178ca6..5d5861cb5b 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -373,8 +373,7 @@ int main(int argc, char *argv[]) extcap_base_set_util_info(extcap_conf, argv[0], SSHDUMP_VERSION_MAJOR, SSHDUMP_VERSION_MINOR, SSHDUMP_VERSION_RELEASE, help_url); g_free(help_url); - extcap_base_set_compiled_with(extcap_conf, "libssh version %s", SSH_STRINGIFY(LIBSSH_VERSION)); - extcap_base_set_running_with(extcap_conf, "libssh version %s", ssh_version(0)); + add_libssh_info(extcap_conf); extcap_base_register_interface(extcap_conf, SSH_EXTCAP_INTERFACE, "SSH remote capture", 147, "Remote capture dependent DLT"); help_header = g_strdup_printf( |