diff options
author | Jakub Jelen <jjelen@redhat.com> | 2019-09-13 17:40:14 +0200 |
---|---|---|
committer | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2019-09-30 15:58:36 +0200 |
commit | a1812e9ac1e517f949eba860538f6629561803a2 (patch) | |
tree | 1573f09194a0abd913bcf6464647a9393ec1d5f5 | |
parent | 0e3dbd6c69ac97cf1888d46e9ce446153c0bde9f (diff) | |
download | libssh-a1812e9ac1e517f949eba860538f6629561803a2.tar.gz libssh-a1812e9ac1e517f949eba860538f6629561803a2.tar.xz libssh-a1812e9ac1e517f949eba860538f6629561803a2.zip |
Skip the proxycommand test in case the netcat is not avaliable
Fixes: T142
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
(cherry picked from commit 4900ab6ca9a016c66c3ba1a2edd27fe155170e06)
-rw-r--r-- | tests/client/torture_proxycommand.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c index f6149c27..91b2d836 100644 --- a/tests/client/torture_proxycommand.c +++ b/tests/client/torture_proxycommand.c @@ -7,6 +7,7 @@ #include "libssh/priv.h" #include <sys/types.h> +#include <sys/stat.h> #include <pwd.h> #include <errno.h> #include <fcntl.h> @@ -65,10 +66,17 @@ static void torture_options_set_proxycommand(void **state) const char *address = torture_server_address(AF_INET); int port = torture_server_port(); char command[255] = {0}; + struct stat sb; int rc; socket_t fd; - rc = snprintf(command, sizeof(command), "nc %s %d", address, port); + rc = stat("/bin/nc", &sb); + if (rc != 0 || (sb.st_mode & S_IXOTH) == 0) { + SSH_LOG(SSH_LOG_WARNING, "Could not find /bin/nc: Skipping the test"); + skip(); + } + + rc = snprintf(command, sizeof(command), "/bin/nc %s %d", address, port); assert_true((size_t)rc < sizeof(command)); rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, command); |