From 92966774721fe914403cebbcbc38ceb7e4c01ea3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 16 Jul 2020 02:03:08 -0700 Subject: [PATCH] extcap: assume we're using libssh 0.6 or later. We require 0.6 or later in CMakeLists.txt, and both ssh_version() and LIBSSH_VERSION having to be fed to SSH_STRINGIFY() date back before 0.5, so just assume ssh_version() is available and LIBSSH_VERSION has to be fed to SSH_STRINGIFY(). Change-Id: I4f62a720424383f88e0410cad07dbe67d0c69297 Reviewed-on: https://code.wireshark.org/review/37881 Petri-Dish: Guy Harris Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo Reviewed-by: Guy Harris --- cmake/modules/FindLIBSSH.cmake | 12 ------------ cmakeconfig.h.in | 3 --- extcap/ciscodump.c | 6 +----- extcap/ssh-base.h | 19 ------------------- extcap/sshdump.c | 6 +----- 5 files changed, 2 insertions(+), 44 deletions(-) diff --git a/cmake/modules/FindLIBSSH.cmake b/cmake/modules/FindLIBSSH.cmake index 9afec5d7a8..c6f1781516 100644 --- a/cmake/modules/FindLIBSSH.cmake +++ b/cmake/modules/FindLIBSSH.cmake @@ -74,18 +74,6 @@ else () string(REGEX MATCH "[0-9]+" LIBSSH_VERSION_PATCH ${LIBSSH_VERSION_PATCH}) set(LIBSSH_VERSION ${LIBSSH_VERSION_MAJOR}.${LIBSSH_VERSION_MINOR}.${LIBSSH_VERSION_PATCH}) 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 b16baa11e3..b1c466c989 100644 --- a/cmakeconfig.h.in +++ b/cmakeconfig.h.in @@ -61,9 +61,6 @@ /* Define if LIBSSH support is enabled */ #cmakedefine HAVE_LIBSSH 1 -/* 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 fed926428f..42b4db31e7 100644 --- a/extcap/ciscodump.c +++ b/extcap/ciscodump.c @@ -551,12 +551,8 @@ 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", LIBSSH_VERSION_STRING); -#ifdef HAVE_SSH_VERSION + 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)); -#else - extcap_base_set_running_with(extcap_conf, "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/ssh-base.h b/extcap/ssh-base.h index 6a2f523a01..55565646d9 100644 --- a/extcap/ssh-base.h +++ b/extcap/ssh-base.h @@ -15,25 +15,6 @@ #include -/* - * Sigh. - * - * libssh 1.0 and 2.0 define LIBSSH_VERSION as a string. - * - * libssh 3.0 and later define it as three numbers with periods - * between them, so that you have to do SSH_STRINGIFY(LIBSSH_VERSION) - * to get the SSH version as a string. - * - * Fortunately, "needs SSH_STRINGIFY()" is true iff SSH_STRINGIFY is - * defined, so we can define LIBSSH_VERSION_STRING differently, - * depending on whether SSH_STRINGIFY is defined. - */ -#ifdef SSH_STRINGIFY -#define LIBSSH_VERSION_STRING SSH_STRINGIFY(LIBSSH_VERSION) -#else -#define LIBSSH_VERSION_STRING LIBSSH_VERSION -#endif - #include #ifndef STDERR_FILENO diff --git a/extcap/sshdump.c b/extcap/sshdump.c index 9d60b97989..4e13178ca6 100644 --- a/extcap/sshdump.c +++ b/extcap/sshdump.c @@ -373,12 +373,8 @@ 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", LIBSSH_VERSION_STRING); -#ifdef HAVE_SSH_VERSION + 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)); -#else - extcap_base_set_running_with(extcap_conf, "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(