| 1 |
/* |
| 2 |
* This file is part of the SSH Library |
| 3 |
* |
| 4 |
* Copyright (c) 2018 by Andreas Schneider |
| 5 |
* |
| 6 |
* The SSH Library is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU Lesser General Public License as published by |
| 8 |
* the Free Software Foundation; either version 2.1 of the License, or (at your |
| 9 |
* option) any later version. |
| 10 |
* |
| 11 |
* The SSH Library is distributed in the hope that it will be useful, but |
| 12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 13 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
| 14 |
* License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public License |
| 17 |
* along with the SSH Library; see the file COPYING. If not, write to |
| 18 |
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
| 19 |
* MA 02111-1307, USA. |
| 20 |
*/ |
| 21 |
|
| 22 |
#include "config.h" |
| 23 |
|
| 24 |
#define LIBSSH_STATIC |
| 25 |
|
| 26 |
#include "torture.h" |
| 27 |
#include "torture_key.h" |
| 28 |
|
| 29 |
#include <sys/types.h> |
| 30 |
#include <pwd.h> |
| 31 |
|
| 32 |
#include "knownhosts.c" |
| 33 |
|
| 34 |
#define TMP_FILE_TEMPLATE "known_hosts_XXXXXX" |
| 35 |
|
| 36 |
#define BAD_RSA "AAAAB3NzaC1yc2EAAAADAQABAAABAQDXvXuawzaArEwkLIXTz/EWywLOC" \ |
| 37 |
"tqQL3P9yKkrhz6AplXP2PhOh5pyxa1VfGKe453jNeYBJ0ROto3BshXgZX" \ |
| 38 |
"bo86oLXTkbe0gO5xi3r5WjXxjOFvRRTLot5fPLNDOv9+TnsPmkNn0iIey" \ |
| 39 |
"PnfrcPIyjWt5zSWUfkNC8oNHxsiSshjpbJvTXSDipukpUy41d7jg4uWGu" \ |
| 40 |
"onMTF7yu7HfuHqq7lhb0WlwSpfbqAbfYARBddcdcARyhix4RMWZZqVY20" \ |
| 41 |
"H3Vsjq8bjKC+NJXFce1PRg+qcOWQdlXEei4dkzAvHvfQRx1TjzkrBZ6B6" \ |
| 42 |
"thmZtyeb9IsiB0tg2g0JN2VTAGkxqp" |
| 43 |
|
| 44 |
const char template[] = "temp_dir_XXXXXX"; |
| 45 |
|
| 46 |
static int sshd_group_setup(void **state) |
| 47 |
{ |
| 48 |
torture_setup_sshd_server(state, false); |
| 49 |
|
| 50 |
return 0; |
| 51 |
} |
| 52 |
|
| 53 |
static int sshd_group_teardown(void **state) { |
| 54 |
torture_teardown_sshd_server(state); |
| 55 |
|
| 56 |
return 0; |
| 57 |
} |
| 58 |
|
| 59 |
static int session_setup(void **state) |
| 60 |
{ |
| 61 |
struct torture_state *s = *state; |
| 62 |
int verbosity = torture_libssh_verbosity(); |
| 63 |
struct passwd *pwd; |
| 64 |
int rc; |
| 65 |
|
| 66 |
bool process_config = false; |
| 67 |
|
| 68 |
pwd = getpwnam("bob"); |
| 69 |
assert_non_null(pwd); |
| 70 |
|
| 71 |
rc = setuid(pwd->pw_uid); |
| 72 |
assert_return_code(rc, errno); |
| 73 |
|
| 74 |
s->ssh.session = ssh_new(); |
| 75 |
assert_non_null(s->ssh.session); |
| 76 |
|
| 77 |
rc = ssh_options_set(s->ssh.session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); |
| 78 |
assert_ssh_return_code(s->ssh.session, rc); |
| 79 |
|
| 80 |
rc = ssh_options_set(s->ssh.session, SSH_OPTIONS_PROCESS_CONFIG, |
| 81 |
&process_config); |
| 82 |
assert_ssh_return_code(s->ssh.session, rc); |
| 83 |
|
| 84 |
rc = ssh_options_set(s->ssh.session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER); |
| 85 |
assert_ssh_return_code(s->ssh.session, rc); |
| 86 |
|
| 87 |
rc = ssh_options_set(s->ssh.session, |
| 88 |
SSH_OPTIONS_USER, |
| 89 |
TORTURE_SSH_USER_ALICE); |
| 90 |
assert_ssh_return_code(s->ssh.session, rc); |
| 91 |
|
| 92 |
return 0; |
| 93 |
} |
| 94 |
|
| 95 |
static int session_teardown(void **state) |
| 96 |
{ |
| 97 |
struct torture_state *s = *state; |
| 98 |
ssh_disconnect(s->ssh.session); |
| 99 |
ssh_free(s->ssh.session); |
| 100 |
|
| 101 |
return 0; |
| 102 |
} |
| 103 |
|
| 104 |
#define KNOWN_HOST_ENTRY_ECDSA "127.0.0.10 ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAHOg+9vHW2kJB50j7c7WkcCcOtwgZdeXMpAeEl17sFnTTrT8wYo1FCzE07wV262vIC+AE3fXUJ7sJ/CkFIdk/8/gQEY1jyoXB3Bsee16VwhJGsMzGGh1FJ0XXhRJjUbG18qbH9JiSgE1N4fIM0zJG68fAyUxRxCI1wUobOOB7EmFZd18g==\n" |
| 105 |
#define KNOWN_HOST_ENTRY_ED25519 "127.0.0.10 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBWWnxuCYiOyvMYLtkgoEyEKlLV+klM+BU6Nh3PmAiqX\n" |
| 106 |
static void torture_knownhosts_export(void **state) |
| 107 |
{ |
| 108 |
struct torture_state *s = *state; |
| 109 |
ssh_session session = s->ssh.session; |
| 110 |
char *entry = NULL; |
| 111 |
char *p = NULL; |
| 112 |
int rc; |
| 113 |
|
| 114 |
rc = ssh_connect(session); |
| 115 |
assert_ssh_return_code(session, rc); |
| 116 |
|
| 117 |
rc = ssh_session_export_known_hosts_entry(session, &entry); |
| 118 |
assert_ssh_return_code(session, rc); |
| 119 |
|
| 120 |
p = strstr(entry, "ssh-ed25519"); |
| 121 |
if (p != NULL) { |
| 122 |
assert_string_equal(entry, KNOWN_HOST_ENTRY_ED25519); |
| 123 |
} else { |
| 124 |
assert_string_equal(entry, KNOWN_HOST_ENTRY_ECDSA); |
| 125 |
} |
| 126 |
SAFE_FREE(entry); |
| 127 |
} |
| 128 |
|
| 129 |
static void torture_knownhosts_write_and_verify(void **state) |
| 130 |
{ |
| 131 |
struct torture_state *s = *state; |
| 132 |
ssh_session session = s->ssh.session; |
| 133 |
enum ssh_known_hosts_e found; |
| 134 |
int rc; |
| 135 |
|
| 136 |
rc = ssh_connect(session); |
| 137 |
assert_ssh_return_code(session, rc); |
| 138 |
|
| 139 |
rc = ssh_session_update_known_hosts(session); |
| 140 |
assert_ssh_return_code(session, rc); |
| 141 |
|
| 142 |
found = ssh_session_is_known_server(session); |
| 143 |
assert_int_equal(found, SSH_KNOWN_HOSTS_OK); |
| 144 |
} |
| 145 |
|
| 146 |
static void torture_knownhosts_precheck(void **state) |
| 147 |
{ |
| 148 |
struct torture_state *s = *state; |
| 149 |
ssh_session session = s->ssh.session; |
| 150 |
struct ssh_list *algo_list = NULL; |
| 151 |
struct ssh_iterator *it = NULL; |
| 152 |
size_t algo_count; |
| 153 |
const char *algo = NULL; |
| 154 |
char tmp_file[1024] = {0}; |
| 155 |
char *known_hosts_file = NULL; |
| 156 |
FILE *file; |
| 157 |
int rc; |
| 158 |
|
| 159 |
snprintf(tmp_file, |
| 160 |
sizeof(tmp_file), |
| 161 |
"%s/%s", |
| 162 |
s->socket_dir, |
| 163 |
TMP_FILE_TEMPLATE); |
| 164 |
|
| 165 |
known_hosts_file = torture_create_temp_file(tmp_file); |
| 166 |
assert_non_null(known_hosts_file); |
| 167 |
|
| 168 |
file = fopen(known_hosts_file, "w"); |
| 169 |
assert_non_null(file); |
| 170 |
fprintf(file, |
| 171 |
"127.0.0.10 %s\n", |
| 172 |
torture_get_testkey_pub(SSH_KEYTYPE_RSA)); |
| 173 |
|
| 174 |
fprintf(file, |
| 175 |
"127.0.0.10 %s\n", |
| 176 |
torture_get_testkey_pub(SSH_KEYTYPE_ED25519)); |
| 177 |
|
| 178 |
fprintf(file, |
| 179 |
"127.0.0.10 %s\n", |
| 180 |
torture_get_testkey_pub(SSH_KEYTYPE_ECDSA_P521)); |
| 181 |
|
| 182 |
fclose(file); |
| 183 |
|
| 184 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 185 |
assert_ssh_return_code(session, rc); |
| 186 |
free(known_hosts_file); |
| 187 |
|
| 188 |
algo_list = ssh_known_hosts_get_algorithms(session); |
| 189 |
assert_non_null(algo_list); |
| 190 |
|
| 191 |
algo_count = ssh_list_count(algo_list); |
| 192 |
assert_int_equal(algo_count, 3); |
| 193 |
|
| 194 |
it = ssh_list_get_iterator(algo_list); |
| 195 |
assert_non_null(it); |
| 196 |
algo = ssh_iterator_value(const char *, it); |
| 197 |
assert_string_equal(algo, "ssh-rsa"); |
| 198 |
|
| 199 |
ssh_list_remove(algo_list, it); |
| 200 |
|
| 201 |
it = ssh_list_get_iterator(algo_list); |
| 202 |
assert_non_null(it); |
| 203 |
algo = ssh_iterator_value(const char *, it); |
| 204 |
assert_string_equal(algo, "ssh-ed25519"); |
| 205 |
|
| 206 |
ssh_list_remove(algo_list, it); |
| 207 |
|
| 208 |
it = ssh_list_get_iterator(algo_list); |
| 209 |
assert_non_null(it); |
| 210 |
algo = ssh_iterator_value(const char *, it); |
| 211 |
assert_string_equal(algo, "ecdsa-sha2-nistp521"); |
| 212 |
|
| 213 |
ssh_list_free(algo_list); |
| 214 |
} |
| 215 |
|
| 216 |
static void torture_knownhosts_duplicate(void **state) |
| 217 |
{ |
| 218 |
struct torture_state *s = *state; |
| 219 |
ssh_session session = s->ssh.session; |
| 220 |
struct ssh_list *algo_list = NULL; |
| 221 |
struct ssh_iterator *it = NULL; |
| 222 |
size_t algo_count; |
| 223 |
const char *algo = NULL; |
| 224 |
char tmp_file[1024] = {0}; |
| 225 |
char *known_hosts_file = NULL; |
| 226 |
FILE *file; |
| 227 |
int rc; |
| 228 |
|
| 229 |
snprintf(tmp_file, |
| 230 |
sizeof(tmp_file), |
| 231 |
"%s/%s", |
| 232 |
s->socket_dir, |
| 233 |
TMP_FILE_TEMPLATE); |
| 234 |
|
| 235 |
known_hosts_file = torture_create_temp_file(tmp_file); |
| 236 |
assert_non_null(known_hosts_file); |
| 237 |
|
| 238 |
file = fopen(known_hosts_file, "w"); |
| 239 |
assert_non_null(file); |
| 240 |
fprintf(file, |
| 241 |
"127.0.0.10 %s\n", |
| 242 |
torture_get_testkey_pub(SSH_KEYTYPE_RSA)); |
| 243 |
|
| 244 |
fprintf(file, |
| 245 |
"127.0.0.10 %s\n", |
| 246 |
torture_get_testkey_pub(SSH_KEYTYPE_RSA)); |
| 247 |
|
| 248 |
fprintf(file, |
| 249 |
"127.0.0.10 %s\n", |
| 250 |
torture_get_testkey_pub(SSH_KEYTYPE_RSA)); |
| 251 |
|
| 252 |
fclose(file); |
| 253 |
|
| 254 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 255 |
assert_ssh_return_code(session, rc); |
| 256 |
free(known_hosts_file); |
| 257 |
|
| 258 |
algo_list = ssh_known_hosts_get_algorithms(session); |
| 259 |
assert_non_null(algo_list); |
| 260 |
|
| 261 |
algo_count = ssh_list_count(algo_list); |
| 262 |
assert_int_equal(algo_count, 1); |
| 263 |
|
| 264 |
it = ssh_list_get_iterator(algo_list); |
| 265 |
assert_non_null(it); |
| 266 |
algo = ssh_iterator_value(const char *, it); |
| 267 |
assert_string_equal(algo, "ssh-rsa"); |
| 268 |
|
| 269 |
ssh_list_free(algo_list); |
| 270 |
} |
| 271 |
|
| 272 |
static void torture_knownhosts_other(void **state) |
| 273 |
{ |
| 274 |
struct torture_state *s = *state; |
| 275 |
ssh_session session = s->ssh.session; |
| 276 |
char tmp_file[1024] = {0}; |
| 277 |
char *known_hosts_file = NULL; |
| 278 |
enum ssh_known_hosts_e found; |
| 279 |
FILE *file = NULL; |
| 280 |
int rc; |
| 281 |
|
| 282 |
snprintf(tmp_file, |
| 283 |
sizeof(tmp_file), |
| 284 |
"%s/%s", |
| 285 |
s->socket_dir, |
| 286 |
TMP_FILE_TEMPLATE); |
| 287 |
|
| 288 |
known_hosts_file = torture_create_temp_file(tmp_file); |
| 289 |
assert_non_null(known_hosts_file); |
| 290 |
|
| 291 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 292 |
assert_ssh_return_code(session, rc); |
| 293 |
|
| 294 |
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "ecdsa-sha2-nistp521"); |
| 295 |
assert_ssh_return_code(session, rc); |
| 296 |
|
| 297 |
file = fopen(known_hosts_file, "w"); |
| 298 |
assert_non_null(file); |
| 299 |
fprintf(file, |
| 300 |
"127.0.0.10 %s\n", |
| 301 |
torture_get_testkey_pub(SSH_KEYTYPE_RSA)); |
| 302 |
fclose(file); |
| 303 |
free(known_hosts_file); |
| 304 |
|
| 305 |
rc = ssh_connect(session); |
| 306 |
assert_ssh_return_code(session, rc); |
| 307 |
|
| 308 |
found = ssh_session_is_known_server(session); |
| 309 |
assert_int_equal(found, SSH_KNOWN_HOSTS_OTHER); |
| 310 |
} |
| 311 |
|
| 312 |
static void torture_knownhosts_unknown(void **state) |
| 313 |
{ |
| 314 |
struct torture_state *s = *state; |
| 315 |
ssh_session session = s->ssh.session; |
| 316 |
char tmp_file[1024] = {0}; |
| 317 |
char *known_hosts_file = NULL; |
| 318 |
enum ssh_known_hosts_e found; |
| 319 |
int rc; |
| 320 |
|
| 321 |
snprintf(tmp_file, |
| 322 |
sizeof(tmp_file), |
| 323 |
"%s/%s", |
| 324 |
s->socket_dir, |
| 325 |
TMP_FILE_TEMPLATE); |
| 326 |
|
| 327 |
known_hosts_file = torture_create_temp_file(tmp_file); |
| 328 |
assert_non_null(known_hosts_file); |
| 329 |
|
| 330 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 331 |
assert_ssh_return_code(session, rc); |
| 332 |
|
| 333 |
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "ecdsa-sha2-nistp521"); |
| 334 |
assert_ssh_return_code(session, rc); |
| 335 |
|
| 336 |
rc = ssh_connect(session); |
| 337 |
assert_ssh_return_code(session, rc); |
| 338 |
|
| 339 |
found = ssh_session_is_known_server(session); |
| 340 |
assert_int_equal(found, SSH_KNOWN_HOSTS_UNKNOWN); |
| 341 |
|
| 342 |
rc = ssh_session_update_known_hosts(session); |
| 343 |
assert_ssh_return_code(session, rc); |
| 344 |
|
| 345 |
ssh_disconnect(session); |
| 346 |
ssh_free(session); |
| 347 |
|
| 348 |
/* connect again and check host key */ |
| 349 |
session = ssh_new(); |
| 350 |
assert_non_null(session); |
| 351 |
|
| 352 |
s->ssh.session = session; |
| 353 |
|
| 354 |
rc = ssh_options_set(s->ssh.session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER); |
| 355 |
assert_ssh_return_code(s->ssh.session, rc); |
| 356 |
|
| 357 |
rc = ssh_options_set(s->ssh.session, |
| 358 |
SSH_OPTIONS_USER, |
| 359 |
TORTURE_SSH_USER_ALICE); |
| 360 |
assert_ssh_return_code(s->ssh.session, rc); |
| 361 |
|
| 362 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 363 |
assert_ssh_return_code(session, rc); |
| 364 |
|
| 365 |
rc = ssh_connect(session); |
| 366 |
assert_ssh_return_code(session, rc); |
| 367 |
|
| 368 |
/* ssh-rsa is the default but libssh should try ssh-ed25519 instead */ |
| 369 |
found = ssh_session_is_known_server(session); |
| 370 |
assert_int_equal(found, SSH_KNOWN_HOSTS_OK); |
| 371 |
|
| 372 |
/* session will be freed by session_teardown() */ |
| 373 |
free(known_hosts_file); |
| 374 |
} |
| 375 |
|
| 376 |
static void torture_knownhosts_conflict(void **state) |
| 377 |
{ |
| 378 |
struct torture_state *s = *state; |
| 379 |
ssh_session session = s->ssh.session; |
| 380 |
char tmp_file[1024] = {0}; |
| 381 |
char *known_hosts_file = NULL; |
| 382 |
enum ssh_known_hosts_e found; |
| 383 |
FILE *file = NULL; |
| 384 |
int rc; |
| 385 |
|
| 386 |
snprintf(tmp_file, |
| 387 |
sizeof(tmp_file), |
| 388 |
"%s/%s", |
| 389 |
s->socket_dir, |
| 390 |
TMP_FILE_TEMPLATE); |
| 391 |
|
| 392 |
known_hosts_file = torture_create_temp_file(tmp_file); |
| 393 |
assert_non_null(known_hosts_file); |
| 394 |
|
| 395 |
file = fopen(known_hosts_file, "w"); |
| 396 |
assert_non_null(file); |
| 397 |
fprintf(file, |
| 398 |
"127.0.0.10 %s %s\n", |
| 399 |
"ssh-rsa", |
| 400 |
BAD_RSA); |
| 401 |
fclose(file); |
| 402 |
|
| 403 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 404 |
assert_ssh_return_code(session, rc); |
| 405 |
|
| 406 |
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "rsa-sha2-256"); |
| 407 |
assert_ssh_return_code(session, rc); |
| 408 |
|
| 409 |
rc = ssh_connect(session); |
| 410 |
assert_ssh_return_code(session, rc); |
| 411 |
|
| 412 |
found = ssh_session_is_known_server(session); |
| 413 |
assert_int_equal(found, SSH_KNOWN_HOSTS_CHANGED); |
| 414 |
|
| 415 |
rc = ssh_session_update_known_hosts(session); |
| 416 |
assert_ssh_return_code(session, rc); |
| 417 |
|
| 418 |
ssh_disconnect(session); |
| 419 |
ssh_free(session); |
| 420 |
|
| 421 |
/* connect again and check host key */ |
| 422 |
session = ssh_new(); |
| 423 |
assert_non_null(session); |
| 424 |
|
| 425 |
s->ssh.session = session; |
| 426 |
|
| 427 |
rc = ssh_options_set(session, SSH_OPTIONS_HOST, TORTURE_SSH_SERVER); |
| 428 |
assert_ssh_return_code(session, rc); |
| 429 |
|
| 430 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, known_hosts_file); |
| 431 |
assert_ssh_return_code(session, rc); |
| 432 |
|
| 433 |
rc = ssh_options_set(session, SSH_OPTIONS_HOSTKEYS, "rsa-sha2-256"); |
| 434 |
assert_ssh_return_code(session, rc); |
| 435 |
|
| 436 |
rc = ssh_connect(session); |
| 437 |
assert_ssh_return_code(session, rc); |
| 438 |
|
| 439 |
found = ssh_session_is_known_server(session); |
| 440 |
assert_int_equal(found, SSH_KNOWN_HOSTS_OK); |
| 441 |
|
| 442 |
/* session will be freed by session_teardown() */ |
| 443 |
free(known_hosts_file); |
| 444 |
} |
| 445 |
|
| 446 |
static void torture_knownhosts_new_file(void **state) |
| 447 |
{ |
| 448 |
struct torture_state *s = *state; |
| 449 |
ssh_session session = s->ssh.session; |
| 450 |
enum ssh_known_hosts_e found; |
| 451 |
int rc; |
| 452 |
|
| 453 |
char new_known_hosts[256]; |
| 454 |
char *tmp_dir = NULL; |
| 455 |
ssize_t count = 0; |
| 456 |
|
| 457 |
/* Create a disposable directory */ |
| 458 |
tmp_dir = torture_make_temp_dir(template); |
| 459 |
assert_non_null(tmp_dir); |
| 460 |
|
| 461 |
count = snprintf(new_known_hosts, sizeof(new_known_hosts), |
| 462 |
"%s/a/b/c/d/known_hosts", tmp_dir); |
| 463 |
assert_return_code(count, errno); |
| 464 |
|
| 465 |
rc = ssh_options_set(session, SSH_OPTIONS_KNOWNHOSTS, new_known_hosts); |
| 466 |
assert_ssh_return_code(session, rc); |
| 467 |
|
| 468 |
rc = ssh_connect(session); |
| 469 |
assert_ssh_return_code(session, rc); |
| 470 |
|
| 471 |
rc = ssh_session_update_known_hosts(session); |
| 472 |
assert_ssh_return_code(session, rc); |
| 473 |
|
| 474 |
found = ssh_session_is_known_server(session); |
| 475 |
assert_int_equal(found, SSH_KNOWN_HOSTS_OK); |
| 476 |
|
| 477 |
/* Cleanup */ |
| 478 |
torture_rmdirs(tmp_dir); |
| 479 |
|
| 480 |
SAFE_FREE(tmp_dir); |
| 481 |
} |
| 482 |
|
| 483 |
int torture_run_tests(void) { |
| 484 |
int rc; |
| 485 |
struct CMUnitTest tests[] = { |
| 486 |
cmocka_unit_test_setup_teardown(torture_knownhosts_export, |
| 487 |
session_setup, |
| 488 |
session_teardown), |
| 489 |
cmocka_unit_test_setup_teardown(torture_knownhosts_write_and_verify, |
| 490 |
session_setup, |
| 491 |
session_teardown), |
| 492 |
cmocka_unit_test_setup_teardown(torture_knownhosts_precheck, |
| 493 |
session_setup, |
| 494 |
session_teardown), |
| 495 |
cmocka_unit_test_setup_teardown(torture_knownhosts_other, |
| 496 |
session_setup, |
| 497 |
session_teardown), |
| 498 |
cmocka_unit_test_setup_teardown(torture_knownhosts_unknown, |
| 499 |
session_setup, |
| 500 |
session_teardown), |
| 501 |
cmocka_unit_test_setup_teardown(torture_knownhosts_conflict, |
| 502 |
session_setup, |
| 503 |
session_teardown), |
| 504 |
cmocka_unit_test_setup_teardown(torture_knownhosts_duplicate, |
| 505 |
session_setup, |
| 506 |
session_teardown), |
| 507 |
cmocka_unit_test_setup_teardown(torture_knownhosts_new_file, |
| 508 |
session_setup, |
| 509 |
session_teardown), |
| 510 |
}; |
| 511 |
|
| 512 |
ssh_init(); |
| 513 |
|
| 514 |
torture_filter_tests(tests); |
| 515 |
rc = cmocka_run_group_tests(tests, sshd_group_setup, sshd_group_teardown); |
| 516 |
|
| 517 |
ssh_finalize(); |
| 518 |
return rc; |
| 519 |
} |