forked from osmocom/wireshark
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>osmith/wip
parent
93012800c8
commit
dccc382b4f
|
@ -52,6 +52,8 @@ else ()
|
|||
)
|
||||
|
||||
if(LIBSSH_INCLUDE_DIR AND LIBSSH_LIBRARY)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
set(LIBSSH_INCLUDE_DIRS
|
||||
${LIBSSH_INCLUDE_DIR}
|
||||
)
|
||||
|
@ -73,6 +75,18 @@ else ()
|
|||
set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH})
|
||||
set(LIBSSH_VERSION_STRING "${LIBSSH_VERSION}")
|
||||
endif()
|
||||
|
||||
#
|
||||
# Check whether we have ssh_version(), which would let us
|
||||
# determine the version of libssh at run time.
|
||||
#
|
||||
cmake_push_check_state()
|
||||
set(CMAKE_REQUIRED_INCLUDES ${LIBSSH_INCLUDE_DIRS})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${LIBSSH_LIBRARIES})
|
||||
|
||||
check_symbol_exists("ssh_version" libssh/libssh.h HAVE_SSH_VERSION)
|
||||
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBSSH_FOUND to TRUE if
|
||||
|
|
|
@ -62,6 +62,9 @@
|
|||
#cmakedefine HAVE_LIBSSH 1
|
||||
#cmakedefine LIBSSH_VERSION_STRING "@LIBSSH_VERSION_STRING@"
|
||||
|
||||
/* Define to 1 if you have the `ssh_version' function. */
|
||||
#cmakedefine HAVE_SSH_VERSION 1
|
||||
|
||||
/* Define if you have the 'dlget' function. */
|
||||
#cmakedefine HAVE_DLGET 1
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue