tests: Use ncat instead of nc
The ncat tool from nmap is available on all unix platforms. The nc
binary might link to ncat or something else. Settle on one we know
also the options can be used if needed.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
(cherry picked from commit 6268417ac6
)
Этот коммит содержится в:
родитель
a7d509ca50
Коммит
90128929e7
@ -173,9 +173,9 @@ if (CLIENT_TESTING OR SERVER_TESTING)
|
||||
if (NOT SSHD_EXECUTABLE)
|
||||
message(SEND_ERROR "Could not find sshd which is required for client testing")
|
||||
endif()
|
||||
find_program(NC_EXECUTABLE
|
||||
find_program(NCAT_EXECUTABLE
|
||||
NAME
|
||||
nc
|
||||
ncat
|
||||
PATHS
|
||||
/bin
|
||||
/usr/bin
|
||||
|
@ -59,7 +59,7 @@ static int session_teardown(void **state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NC_EXECUTABLE
|
||||
#ifdef NCAT_EXECUTABLE
|
||||
static void torture_options_set_proxycommand(void **state)
|
||||
{
|
||||
struct torture_state *s = *state;
|
||||
@ -71,13 +71,18 @@ static void torture_options_set_proxycommand(void **state)
|
||||
int rc;
|
||||
socket_t fd;
|
||||
|
||||
rc = stat(NC_EXECUTABLE, &sb);
|
||||
rc = stat(NCAT_EXECUTABLE, &sb);
|
||||
if (rc != 0 || (sb.st_mode & S_IXOTH) == 0) {
|
||||
SSH_LOG(SSH_LOG_WARNING, "Could not find " NC_EXECUTABLE ": Skipping the test");
|
||||
SSH_LOG(SSH_LOG_WARNING,
|
||||
"Could not find " NCAT_EXECUTABLE ": Skipping the test");
|
||||
skip();
|
||||
}
|
||||
|
||||
rc = snprintf(command, sizeof(command), NC_EXECUTABLE " %s %d", address, port);
|
||||
rc = snprintf(command,
|
||||
sizeof(command),
|
||||
NCAT_EXECUTABLE " %s %d",
|
||||
address,
|
||||
port);
|
||||
assert_true((size_t)rc < sizeof(command));
|
||||
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, command);
|
||||
@ -90,7 +95,7 @@ static void torture_options_set_proxycommand(void **state)
|
||||
assert_int_equal(rc & O_RDWR, O_RDWR);
|
||||
}
|
||||
|
||||
#else /* NC_EXECUTABLE */
|
||||
#else /* NCAT_EXECUTABLE */
|
||||
|
||||
static void torture_options_set_proxycommand(void **state)
|
||||
{
|
||||
@ -98,7 +103,7 @@ static void torture_options_set_proxycommand(void **state)
|
||||
skip();
|
||||
}
|
||||
|
||||
#endif /* NC_EXECUTABLE */
|
||||
#endif /* NCAT_EXECUTABLE */
|
||||
|
||||
static void torture_options_set_proxycommand_notexist(void **state) {
|
||||
struct torture_state *s = *state;
|
||||
|
@ -64,7 +64,7 @@
|
||||
|
||||
/* Available programs */
|
||||
|
||||
#cmakedefine NC_EXECUTABLE "${NC_EXECUTABLE}"
|
||||
#cmakedefine NCAT_EXECUTABLE "${NCAT_EXECUTABLE}"
|
||||
#cmakedefine SSHD_EXECUTABLE "${SSHD_EXECUTABLE}"
|
||||
#cmakedefine SSH_EXECUTABLE "${SSH_EXECUTABLE}"
|
||||
#cmakedefine WITH_TIMEOUT ${WITH_TIMEOUT}
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user