aboutsummaryrefslogtreecommitdiff
path: root/tests/mock_guest.c
blob: 2cf04b3065cdb03120752b0a25884cbf541fb8d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
 * Copyright © 2012 Canonical Ltd. All rights reserved.
 *
 * Author(s): David Barth <david.barth@canonical.com>
 *
 */

#include <pwd.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>

static struct passwd guest = { "guest",
							   "password",
							   500, 500,
							   "M. Guest",
							   "/tmp",
							   "/bin/true" };
struct passwd *
getpwnam (const char *username)
{ return &guest; }

int
setgroups(size_t size, const gid_t *list)
{
	errno = EPERM;
	return -1;
}

int
setgid(gid_t gid)
{ return 0; }

int
setuid(uid_t uid)
{ return 0; }

int
setegid(gid_t gid)
{ return 0; }

int
seteuid(uid_t uid)
{ return 0; }

int chmod(const char *path, mode_t mode)
{ return 0; }

int chown(const char *path, uid_t owner, gid_t group)
{ return 0; }