1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-29 13:01:13 +03:00

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

@ -25,6 +25,10 @@
#include "libssh/libssh.h"
#include "libssh/priv.h"
#include <errno.h>
#include <sys/types.h>
#include <pwd.h>
static int sshd_setup(void **state)
{
torture_setup_sshd_server(state);
@ -41,6 +45,14 @@ static int sshd_teardown(void **state) {
static int session_setup(void **state) {
struct torture_state *s = *state;
int verbosity = torture_libssh_verbosity();
struct passwd *pwd;
int rc;
pwd = getpwnam("bob");
assert_non_null(pwd);
rc = setuid(pwd->pw_uid);
assert_return_code(rc, errno);
ssh_init();