aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/modules/FindLIBSSH.cmake14
-rw-r--r--cmakeconfig.h.in3
-rw-r--r--extcap/ciscodump.c7
-rw-r--r--extcap/extcap-base.c11
-rw-r--r--extcap/extcap-base.h2
-rw-r--r--extcap/sshdump.c7
6 files changed, 39 insertions, 5 deletions
diff --git a/cmake/modules/FindLIBSSH.cmake b/cmake/modules/FindLIBSSH.cmake
index ee2004de6e..29368bc1c5 100644
--- a/cmake/modules/FindLIBSSH.cmake
+++ b/cmake/modules/FindLIBSSH.cmake
@@ -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
diff --git a/cmakeconfig.h.in b/cmakeconfig.h.in
index dc562f35c0..e671388fb7 100644
--- a/cmakeconfig.h.in
+++ b/cmakeconfig.h.in
@@ -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
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(