mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-06 18:29:50 +09:00
tests: Add port option to torture_ssh_session
Signed-off-by: Alan Dunn <amdunn@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
8db4520d89
commit
f4154c503b
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user