diff options
author | Alan Dunn <amdunn@gmail.com> | 2014-04-19 14:27:48 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-01-20 19:41:53 +0100 |
commit | f4154c503b4f16e318853a4ef028295558798655 (patch) | |
tree | 83ff50223c44ebe1c9e3c6fc3e6136f6d736c821 | |
parent | 8db4520d891249b287cc246626635dd550fb3e42 (diff) | |
download | libssh-f4154c503b4f16e318853a4ef028295558798655.tar.gz libssh-f4154c503b4f16e318853a4ef028295558798655.tar.xz libssh-f4154c503b4f16e318853a4ef028295558798655.zip |
tests: Add port option to torture_ssh_session
Signed-off-by: Alan Dunn <amdunn@gmail.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | tests/client/torture_forward.c | 2 | ||||
-rw-r--r-- | tests/client/torture_request_env.c | 2 | ||||
-rw-r--r-- | tests/client/torture_sftp_dir.c | 2 | ||||
-rw-r--r-- | tests/client/torture_sftp_read.c | 2 | ||||
-rw-r--r-- | tests/torture.c | 7 | ||||
-rw-r--r-- | tests/torture.h | 1 |
6 files changed, 12 insertions, 4 deletions
diff --git a/tests/client/torture_forward.c b/tests/client/torture_forward.c index 5754386f..0ffeae05 100644 --- a/tests/client/torture_forward.c +++ b/tests/client/torture_forward.c @@ -39,7 +39,7 @@ static void setup(void **state) user = getenv("TORTURE_USER"); password = getenv("TORTURE_PASSWORD"); - session = torture_ssh_session(host, user, password); + session = torture_ssh_session(host, NULL, user, password); assert_non_null(session); *state = session; diff --git a/tests/client/torture_request_env.c b/tests/client/torture_request_env.c index 7c7338ed..fc3843df 100644 --- a/tests/client/torture_request_env.c +++ b/tests/client/torture_request_env.c @@ -39,7 +39,7 @@ static void setup(void **state) user = getenv("TORTURE_USER"); password = getenv("TORTURE_PASSWORD"); - session = torture_ssh_session(host, user, password); + session = torture_ssh_session(host, NULL, user, password); assert_false(session == NULL); *state = session; diff --git a/tests/client/torture_sftp_dir.c b/tests/client/torture_sftp_dir.c index 8d2bcda8..b2e3fa38 100644 --- a/tests/client/torture_sftp_dir.c +++ b/tests/client/torture_sftp_dir.c @@ -18,7 +18,7 @@ static void setup(void **state) { user = getenv("TORTURE_USER"); password = getenv("TORTURE_PASSWORD"); - session = torture_ssh_session(host, user, password); + session = torture_ssh_session(host, NULL, user, password); assert_false(session == NULL); t = torture_sftp_session(session); assert_false(t == NULL); diff --git a/tests/client/torture_sftp_read.c b/tests/client/torture_sftp_read.c index 1e40e2cf..dac5ef7b 100644 --- a/tests/client/torture_sftp_read.c +++ b/tests/client/torture_sftp_read.c @@ -20,7 +20,7 @@ static void setup(void **state) { user = getenv("TORTURE_USER"); password = getenv("TORTURE_PASSWORD"); - session = torture_ssh_session(host, user, password); + session = torture_ssh_session(host, NULL, user, password); assert_false(session == NULL); t = torture_sftp_session(session); assert_false(t == NULL); diff --git a/tests/torture.c b/tests/torture.c index 2ba5556c..74640031 100644 --- a/tests/torture.c +++ b/tests/torture.c @@ -315,6 +315,7 @@ int torture_isdir(const char *path) { } ssh_session torture_ssh_session(const char *host, + const unsigned int *port, const char *user, const char *password) { ssh_session session; @@ -334,6 +335,12 @@ ssh_session torture_ssh_session(const char *host, goto failed; } + if (port != NULL) { + if (ssh_options_set(session, SSH_OPTIONS_PORT, port) < 0) { + goto failed; + } + } + if (user != NULL) { if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) { goto failed; diff --git a/tests/torture.h b/tests/torture.h index ffcea8bb..bfad2c97 100644 --- a/tests/torture.h +++ b/tests/torture.h @@ -62,6 +62,7 @@ int torture_isdir(const char *path); int torture_libssh_verbosity(void); ssh_session torture_ssh_session(const char *host, + const unsigned int *port, const char *user, const char *password); |