aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2016-03-16 12:32:29 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-03-21 20:06:04 +0100
commite37fd83254f32866c4205f61e5cce5f26a08a030 (patch)
tree9525b8d9523211e625f3af210fdf53ed8b9b345c /tests
parent926b9e937bb99c43704bdeec510e766b4d5af98b (diff)
downloadlibssh-e37fd83254f32866c4205f61e5cce5f26a08a030.tar.gz
libssh-e37fd83254f32866c4205f61e5cce5f26a08a030.tar.xz
libssh-e37fd83254f32866c4205f61e5cce5f26a08a030.zip
tests: Make test suite work out of the box on Debian
* tests/torture.c (torture_setup_create_sshd_config): Rework how the location of the sftp server is discovered, and add the Debian-specific location. Signed-off-by: Justus Winter <justus@g10code.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/torture.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/torture.c b/tests/torture.c
index 5ee95b62..8921e9e6 100644
--- a/tests/torture.c
+++ b/tests/torture.c
@@ -866,7 +866,15 @@ static void torture_setup_create_sshd_config(void **state)
char sshd_config[2048];
char sshd_path[1024];
struct stat sb;
+ const char *sftp_server_locations[] = {
+ "/usr/lib/ssh/sftp-server",
+ "/usr/libexec/sftp-server",
+ "/usr/libexec/openssh/sftp-server",
+ "/usr/lib/openssh/sftp-server", /* Debian */
+ };
+ size_t sftp_sl_size = ARRAY_SIZE(sftp_server_locations);
const char *sftp_server;
+ size_t i;
int rc;
snprintf(sshd_path,
@@ -904,16 +912,13 @@ static void torture_setup_create_sshd_config(void **state)
assert_non_null(s->socket_dir);
- sftp_server = "/usr/lib/ssh/sftp-server";
- rc = lstat(sftp_server, &sb);
- if (rc < 0) {
- sftp_server = "/usr/libexec/sftp-server";
- rc = lstat(sftp_server, &sb);
- if (rc < 0) {
- sftp_server = "/usr/libexec/openssh/sftp-server";
+ sftp_server = getenv("TORTURE_SFTP_SERVER");
+ if (sftp_server == NULL) {
+ for (i = 0; i < sftp_sl_size; i++) {
+ sftp_server = sftp_server_locations[i];
rc = lstat(sftp_server, &sb);
- if (rc < 0) {
- sftp_server = getenv("TORTURE_SFTP_SERVER");
+ if (rc == 0) {
+ break;
}
}
}