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>
Этот коммит содержится в:
родитель
f6b390084e
Коммит
4a95a35bc6
@ -52,9 +52,16 @@ static int session_setup(void **state)
|
|||||||
{
|
{
|
||||||
struct torture_state *s = *state;
|
struct torture_state *s = *state;
|
||||||
int verbosity = torture_libssh_verbosity();
|
int verbosity = torture_libssh_verbosity();
|
||||||
|
struct passwd *pwd;
|
||||||
bool b = false;
|
bool b = false;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
pwd = getpwnam("bob");
|
||||||
|
assert_non_null(pwd);
|
||||||
|
|
||||||
|
rc = setuid(pwd->pw_uid);
|
||||||
|
assert_return_code(rc, errno);
|
||||||
|
|
||||||
s->ssh.session = ssh_new();
|
s->ssh.session = ssh_new();
|
||||||
assert_non_null(s->ssh.session);
|
assert_non_null(s->ssh.session);
|
||||||
|
|
||||||
@ -80,19 +87,12 @@ static int session_teardown(void **state)
|
|||||||
static int pubkey_setup(void **state)
|
static int pubkey_setup(void **state)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
struct passwd *pwd;
|
|
||||||
|
|
||||||
rc = session_setup(state);
|
rc = session_setup(state);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
return rc;
|
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 */
|
/* Make sure we do not interfere with another ssh-agent */
|
||||||
unsetenv("SSH_AUTH_SOCK");
|
unsetenv("SSH_AUTH_SOCK");
|
||||||
unsetenv("SSH_AGENT_PID");
|
unsetenv("SSH_AGENT_PID");
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user