mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
torture: Fix building on Windows
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
(cherry-picked from commit b74a1841)
This commit is contained in:
@@ -229,6 +229,7 @@ static int verbosity = 0;
|
|||||||
static const char *pattern = NULL;
|
static const char *pattern = NULL;
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
|
||||||
static int _torture_auth_kbdint(ssh_session session,
|
static int _torture_auth_kbdint(ssh_session session,
|
||||||
const char *password) {
|
const char *password) {
|
||||||
const char *prompt;
|
const char *prompt;
|
||||||
@@ -537,7 +538,7 @@ ssh_bind torture_ssh_bind(const char *addr,
|
|||||||
return sshbind;
|
return sshbind;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif /* WITH_SERVER */
|
||||||
|
|
||||||
#ifdef WITH_SFTP
|
#ifdef WITH_SFTP
|
||||||
|
|
||||||
@@ -604,25 +605,6 @@ void torture_sftp_close(struct torture_sftp *t) {
|
|||||||
}
|
}
|
||||||
#endif /* WITH_SFTP */
|
#endif /* WITH_SFTP */
|
||||||
|
|
||||||
#endif /* _WIN32 */
|
|
||||||
|
|
||||||
void torture_write_file(const char *filename, const char *data){
|
|
||||||
int fd;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
assert_non_null(filename);
|
|
||||||
assert_true(filename[0] != '\0');
|
|
||||||
assert_non_null(data);
|
|
||||||
|
|
||||||
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600);
|
|
||||||
assert_true(fd >= 0);
|
|
||||||
|
|
||||||
rc = write(fd, data, strlen(data));
|
|
||||||
assert_int_equal(rc, strlen(data));
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *torture_get_testkey_internal(enum ssh_keytypes_e type,
|
static const char *torture_get_testkey_internal(enum ssh_keytypes_e type,
|
||||||
int bits,
|
int bits,
|
||||||
int with_passphrase,
|
int with_passphrase,
|
||||||
@@ -765,7 +747,7 @@ static void torture_setup_create_sshd_config(void **state)
|
|||||||
#ifndef OPENSSH_VERSION_MAJOR
|
#ifndef OPENSSH_VERSION_MAJOR
|
||||||
#define OPENSSH_VERSION_MAJOR 7U
|
#define OPENSSH_VERSION_MAJOR 7U
|
||||||
#define OPENSSH_VERSION_MINOR 0U
|
#define OPENSSH_VERSION_MINOR 0U
|
||||||
#endif
|
#endif /* OPENSSH_VERSION_MAJOR */
|
||||||
const char config_string[]=
|
const char config_string[]=
|
||||||
"Port 22\n"
|
"Port 22\n"
|
||||||
"ListenAddress 127.0.0.10\n"
|
"ListenAddress 127.0.0.10\n"
|
||||||
@@ -788,11 +770,11 @@ static void torture_setup_create_sshd_config(void **state)
|
|||||||
"HostKeyAlgorithms +ssh-dss\n"
|
"HostKeyAlgorithms +ssh-dss\n"
|
||||||
# if (OPENSSH_VERSION_MAJOR == 7 && OPENSSH_VERSION_MINOR < 6)
|
# if (OPENSSH_VERSION_MAJOR == 7 && OPENSSH_VERSION_MINOR < 6)
|
||||||
"Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc\n"
|
"Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc\n"
|
||||||
# else
|
# else /* OPENSSH_VERSION 7.0 - 7.5 */
|
||||||
"Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc\n"
|
"Ciphers +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc\n"
|
||||||
# endif
|
# endif /* OPENSSH_VERSION 7.0 - 7.6 */
|
||||||
"KexAlgorithms +diffie-hellman-group1-sha1"
|
"KexAlgorithms +diffie-hellman-group1-sha1"
|
||||||
#else
|
#else /* OPENSSH_VERSION >= 6.7 */
|
||||||
"Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,"
|
"Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,"
|
||||||
"aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,"
|
"aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,"
|
||||||
"aes256-gcm@openssh.com,arcfour128,arcfour256,arcfour,"
|
"aes256-gcm@openssh.com,arcfour128,arcfour256,arcfour,"
|
||||||
@@ -803,7 +785,7 @@ static void torture_setup_create_sshd_config(void **state)
|
|||||||
"diffie-hellman-group-exchange-sha1,"
|
"diffie-hellman-group-exchange-sha1,"
|
||||||
"diffie-hellman-group14-sha1,"
|
"diffie-hellman-group14-sha1,"
|
||||||
"diffie-hellman-group1-sha1\n"
|
"diffie-hellman-group1-sha1\n"
|
||||||
#endif
|
#endif /* OPENSSH_VERSION >= 6.7 */
|
||||||
"\n"
|
"\n"
|
||||||
"AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES\n"
|
"AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES\n"
|
||||||
"AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT\n"
|
"AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT\n"
|
||||||
@@ -971,6 +953,26 @@ void _torture_filter_tests(UnitTest *tests, size_t ntests){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
|
void torture_write_file(const char *filename, const char *data){
|
||||||
|
int fd;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
assert_non_null(filename);
|
||||||
|
assert_true(filename[0] != '\0');
|
||||||
|
assert_non_null(data);
|
||||||
|
|
||||||
|
fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, 0600);
|
||||||
|
assert_true(fd >= 0);
|
||||||
|
|
||||||
|
rc = write(fd, data, strlen(data));
|
||||||
|
assert_int_equal(rc, strlen(data));
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
struct argument_s arguments;
|
struct argument_s arguments;
|
||||||
char *env = getenv("LIBSSH_VERBOSITY");
|
char *env = getenv("LIBSSH_VERBOSITY");
|
||||||
|
|||||||
Reference in New Issue
Block a user