diff options
author | Guy Harris <gharris@sonic.net> | 2020-07-15 15:28:10 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-07-15 23:43:22 +0000 |
commit | dccc382b4f8d0380fa73f31f6ad8625459ff7046 (patch) | |
tree | 01c9086c63520da5bf885ce609824ba19df4aa8b /extcap | |
parent | 93012800c8b27815db844785d61c79a93d1fb834 (diff) |
Show the version of libssh being used, if possible.
If we have ssh_version(), then ssh_version(0) will return a string for
the version being used.
Change-Id: I0717f6d4d5c3fa04aa7938dc6bc0d4c8abfa95fd
Reviewed-on: https://code.wireshark.org/review/37875
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 | 7 | ||||
-rw-r--r-- | extcap/extcap-base.c | 11 | ||||
-rw-r--r-- | extcap/extcap-base.h | 2 | ||||
-rw-r--r-- | extcap/sshdump.c | 7 |
4 files changed, 22 insertions, 5 deletions
diff --git a/extcap/ciscodump.c b/extcap/ciscodump.c index e190e9fe8a..b50944d038 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -551,7 +551,12 @@ 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_add_library_info(extcap_conf, "libssh", LIBSSH_VERSION_STRING); + extcap_base_add_info(extcap_conf, "Compiled with libssh version %s", LIBSSH_VERSION_STRING); +#ifdef HAVE_SSH_VERSION + extcap_base_add_info(extcap_conf, "Running with libssh version %s", ssh_version(0)); +#else + extcap_base_add_info(extcap_conf, "Running with libssh (unknown version)"); +#endif 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/extcap-base.c b/extcap/extcap-base.c index 67fcf63125..80a2312c5b 100644 --- a/extcap/extcap-base.c +++ b/extcap/extcap-base.c @@ -96,11 +96,18 @@ void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, extcap->helppage = g_strdup(helppage); } -void extcap_base_add_library_info(extcap_parameters * extcap, const char * libname, const char * libversion) +void extcap_base_add_info(extcap_parameters * extcap, const char *fmt, ...) { gchar * old_version = extcap->version; - extcap->version = g_strdup_printf("%s\nCompiled with %s version %s", old_version, libname, libversion); + va_list ap; + gchar * info; + + va_start(ap, fmt); + info = g_strdup_vprintf(fmt, ap); + va_end(ap); + extcap->version = g_strdup_printf("%s\n%s", old_version, info); g_free(old_version); + g_free(info); } static void extcap_custom_log(const gchar *log_domain, diff --git a/extcap/extcap-base.h b/extcap/extcap-base.h index b016f2661f..8fa6d872c6 100644 --- a/extcap/extcap-base.h +++ b/extcap/extcap-base.h @@ -87,7 +87,7 @@ typedef struct _extcap_parameters void extcap_base_register_interface(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltdescription ); void extcap_base_register_interface_ext(extcap_parameters * extcap, const char * interface, const char * ifdescription, uint16_t dlt, const char * dltname, const char * dltdescription ); void extcap_base_set_util_info(extcap_parameters * extcap, const char * exename, const char * major, const char * minor, const char * release, const char * helppage); -void extcap_base_add_library_info(extcap_parameters * extcap, const char * libname, const char * libversion); +void extcap_base_add_info(extcap_parameters * extcap, const char *fmt, ...); uint8_t extcap_base_parse_options(extcap_parameters * extcap, int result, char * optargument); uint8_t extcap_base_handle_interface(extcap_parameters * extcap); void extcap_base_cleanup(extcap_parameters ** extcap); diff --git a/extcap/sshdump.c b/extcap/sshdump.c index faa4c7afdc..76f38e3bf4 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -373,7 +373,12 @@ 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_add_library_info(extcap_conf, "libssh", LIBSSH_VERSION_STRING); + extcap_base_add_info(extcap_conf, "Compiled with libssh version %s", LIBSSH_VERSION_STRING); +#ifdef HAVE_SSH_VERSION + extcap_base_add_info(extcap_conf, "Running with libssh version %s", ssh_version(0)); +#else + extcap_base_add_info(extcap_conf, "Running with libssh (unknown version)"); +#endif extcap_base_register_interface(extcap_conf, SSH_EXTCAP_INTERFACE, "SSH remote capture", 147, "Remote capture dependent DLT"); help_header = g_strdup_printf( |