mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
tests: search for netcat binary
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
3d2570ff5f
commit
177e76f753
@ -59,6 +59,7 @@ static int session_teardown(void **state)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef NC_EXECUTABLE
|
||||
static void torture_options_set_proxycommand(void **state)
|
||||
{
|
||||
struct torture_state *s = *state;
|
||||
@ -70,13 +71,13 @@ static void torture_options_set_proxycommand(void **state)
|
||||
int rc;
|
||||
socket_t fd;
|
||||
|
||||
rc = stat("/bin/nc", &sb);
|
||||
rc = stat(NC_EXECUTABLE, &sb);
|
||||
if (rc != 0 || (sb.st_mode & S_IXOTH) == 0) {
|
||||
SSH_LOG(SSH_LOG_WARNING, "Could not find /bin/nc: Skipping the test");
|
||||
SSH_LOG(SSH_LOG_WARNING, "Could not find " NC_EXECUTABLE ": Skipping the test");
|
||||
skip();
|
||||
}
|
||||
|
||||
rc = snprintf(command, sizeof(command), "/bin/nc %s %d", address, port);
|
||||
rc = snprintf(command, sizeof(command), NC_EXECUTABLE " %s %d", address, port);
|
||||
assert_true((size_t)rc < sizeof(command));
|
||||
|
||||
rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, command);
|
||||
@ -89,6 +90,16 @@ static void torture_options_set_proxycommand(void **state)
|
||||
assert_int_equal(rc & O_RDWR, O_RDWR);
|
||||
}
|
||||
|
||||
#else /* NC_EXECUTABLE */
|
||||
|
||||
static void torture_options_set_proxycommand(void **state)
|
||||
{
|
||||
(void) state;
|
||||
skip();
|
||||
}
|
||||
|
||||
#endif /* NC_EXECUTABLE */
|
||||
|
||||
static void torture_options_set_proxycommand_notexist(void **state) {
|
||||
struct torture_state *s = *state;
|
||||
ssh_session session = s->ssh.session;
|
||||
|
Reference in New Issue
Block a user