tests: Switch to user bob in setup

This makes sure we can apply options correctly.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Andreas Schneider
2016-02-02 11:26:53 +01:00
parent 1729d4a168
commit cbd75c3e35
3 changed files with 34 additions and 0 deletions

View File

@@ -24,6 +24,10 @@
#include "torture.h"
#include <libssh/libssh.h>
#include <errno.h>
#include <sys/types.h>
#include <pwd.h>
static int sshd_setup(void **state)
{
torture_setup_sshd_server(state);
@@ -40,6 +44,14 @@ static int sshd_teardown(void **state) {
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,