diff options
author | Jakub Jelen <jjelen@redhat.com> | 2018-10-29 18:25:03 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-11-02 11:16:38 +0100 |
commit | 4a95a35bc6897fd0daa199f070a3a78879e7bfc4 (patch) | |
tree | 75b1cec3ba782e6d5254e3d699e0f53d9e59c5b0 /tests | |
parent | f6b390084e77ff3d97bc5e6294f104a41ca92332 (diff) | |
download | libssh-4a95a35bc6897fd0daa199f070a3a78879e7bfc4.tar.gz libssh-4a95a35bc6897fd0daa199f070a3a78879e7bfc4.tar.xz libssh-4a95a35bc6897fd0daa199f070a3a78879e7bfc4.zip |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client/torture_auth.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/client/torture_auth.c b/tests/client/torture_auth.c index 68375cb4..f3936158 100644 --- a/tests/client/torture_auth.c +++ b/tests/client/torture_auth.c @@ -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"); |