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 <gharris@sonic.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Guy Harris <gharris@sonic.net>
This commit is contained in:
Guy Harris 2020-07-16 02:03:08 -07:00
parent a1d2d18cb8
commit 9296677472
5 changed files with 2 additions and 44 deletions

View File

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

View File

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

View File

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

View File

@ -15,25 +15,6 @@
#include <libssh/libssh.h>
/*
* 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 <glib.h>
#ifndef STDERR_FILENO

View File

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