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>
This commit is contained in:
Guy Harris 2020-07-16 02:42:52 -07:00
parent 9296677472
commit 3dedaf8064
4 changed files with 13 additions and 4 deletions

View File

@ -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");

View File

@ -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;

View File

@ -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);

View File

@ -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(