static void setup(void **state) { ssh_session session; struct torture_sftp *t; const char *host; const char *user; const char *password; host = getenv("TORTURE_HOST"); if (host == NULL) { host = "localhost"; } user = getenv("TORTURE_USER"); password = getenv("TORTURE_PASSWORD"); session = torture_ssh_session(host, NULL, user, password); assert_false(session == NULL); t = torture_sftp_session(session); assert_false(t == NULL); *state = t; }
static int session_setup(void **state) { struct torture_state *s = *state; struct passwd *pwd; int rc; pwd = getpwnam("bob"); assert_non_null(pwd); rc = setuid(pwd->pw_uid); assert_return_code(rc, errno); s->ssh.session = torture_ssh_session(TORTURE_SSH_SERVER, NULL, TORTURE_SSH_USER_ALICE, NULL); assert_non_null(s->ssh.session); s->ssh.tsftp = torture_sftp_session(s->ssh.session); assert_non_null(s->ssh.tsftp); return 0; }