1
1

tests: Properly set the bob's UID also in other tests than pubkey

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Этот коммит содержится в:
Jakub Jelen 2018-10-29 18:25:03 +01:00 коммит произвёл Andreas Schneider
родитель f6b390084e
Коммит 4a95a35bc6

Просмотреть файл

@ -52,9 +52,16 @@ static int session_setup(void **state)
{
struct torture_state *s = *state;
int verbosity = torture_libssh_verbosity();
struct passwd *pwd;
bool b = false;
int rc;
pwd = getpwnam("bob");
assert_non_null(pwd);
rc = setuid(pwd->pw_uid);
assert_return_code(rc, errno);
s->ssh.session = ssh_new();
assert_non_null(s->ssh.session);
@ -80,19 +87,12 @@ static int session_teardown(void **state)
static int pubkey_setup(void **state)
{
int rc;
struct passwd *pwd;
rc = session_setup(state);
if (rc != 0) {
return rc;
}
pwd = getpwnam("bob");
assert_non_null(pwd);
rc = setuid(pwd->pw_uid);
assert_return_code(rc, errno);
/* Make sure we do not interfere with another ssh-agent */
unsetenv("SSH_AUTH_SOCK");
unsetenv("SSH_AGENT_PID");