diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-12-10 08:17:30 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-12-10 17:52:56 +0100 |
commit | 055bf830dbdab879078e592e607e71890e7e67f5 (patch) | |
tree | 87f865cd83e36e01ca6dc12690cd42329a3af952 | |
parent | 8c812dbfa388340a73e015b834cf4a24b7bc19d2 (diff) | |
download | libssh-055bf830dbdab879078e592e607e71890e7e67f5.tar.gz libssh-055bf830dbdab879078e592e607e71890e7e67f5.tar.xz libssh-055bf830dbdab879078e592e607e71890e7e67f5.zip |
tests: Use torture_server_address() in proxycommand test
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | tests/client/torture_proxycommand.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c index 9608e663..a72a2eb6 100644 --- a/tests/client/torture_proxycommand.c +++ b/tests/client/torture_proxycommand.c @@ -58,13 +58,20 @@ static int session_teardown(void **state) return 0; } -static void torture_options_set_proxycommand(void **state) { +static void torture_options_set_proxycommand(void **state) +{ struct torture_state *s = *state; ssh_session session = s->ssh.session; + const char *address = torture_server_address(AF_INET); + int port = torture_server_port(); + char command[255] = {0}; int rc; socket_t fd; - rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "nc 127.0.0.10 22"); + rc = snprintf(command, sizeof(command), "nc %s %d", address, port); + assert_true((size_t)rc < sizeof(command)); + + rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, command); assert_int_equal(rc, 0); rc = ssh_connect(session); assert_ssh_return_code(session, rc); |