From e552688b70889a4879ef16ce38bc8c95e6f447c7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 19 Sep 2012 14:35:36 -0500 Subject: Steal a bunch of test infrastructure from libpam-icaclient --- tests/mock_guest.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests/mock_guest.c (limited to 'tests/mock_guest.c') diff --git a/tests/mock_guest.c b/tests/mock_guest.c new file mode 100644 index 0000000..2cf04b3 --- /dev/null +++ b/tests/mock_guest.c @@ -0,0 +1,51 @@ +/* + * Copyright © 2012 Canonical Ltd. All rights reserved. + * + * Author(s): David Barth + * + */ + +#include +#include +#include +#include + +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; } + -- cgit v1.2.3