aboutsummaryrefslogtreecommitdiff
path: root/tests/mock_guest.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-09-20 08:39:53 +0000
committerTarmac <Unknown>2012-09-20 08:39:53 +0000
commit126edd829bbf88c1a2a186a874acb4a307f3b5a9 (patch)
tree877c48d3bef1123accafba2caa953d73bc2002c5 /tests/mock_guest.c
parentaa87c8fac598ef6e79a65d6f2eec93d8a4693063 (diff)
parent19c01abdd2c3a3d772cf8b7f54b819231ac4dcba (diff)
downloadlibpam-freerdp2-126edd829bbf88c1a2a186a874acb4a307f3b5a9.tar.gz
libpam-freerdp2-126edd829bbf88c1a2a186a874acb4a307f3b5a9.tar.bz2
libpam-freerdp2-126edd829bbf88c1a2a186a874acb4a307f3b5a9.zip
Adding a testing framework. Approved by Albert Astals Cid, jenkins.
Diffstat (limited to 'tests/mock_guest.c')
-rw-r--r--tests/mock_guest.c51
1 files changed, 51 insertions, 0 deletions
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 <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; }
+