summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2019-09-13 17:40:14 +0200
committerJakub Jelen <jjelen@redhat.com>2019-09-16 09:39:58 +0200
commit4900ab6ca9a016c66c3ba1a2edd27fe155170e06 (patch)
tree52b6c6a4f49a05931f3b8b1d81c8576da8d214fa
parent618b858e49ce48ad3b8a36d75215cf2635af8c16 (diff)
downloadlibssh-4900ab6ca9a016c66c3ba1a2edd27fe155170e06.tar.gz
libssh-4900ab6ca9a016c66c3ba1a2edd27fe155170e06.tar.xz
libssh-4900ab6ca9a016c66c3ba1a2edd27fe155170e06.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>
-rw-r--r--tests/client/torture_proxycommand.c10
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);