summaryrefslogtreecommitdiff
path: root/source3/tests/trapdoor.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-07-29 03:08:05 +0000
committerAndrew Tridgell <tridge@samba.org>1998-07-29 03:08:05 +0000
commit64578c0589a3a741f81fb55c16eeb882128da00b (patch)
tree8b650156e44e4d39af8625185d857a88789b8074 /source3/tests/trapdoor.c
parentc48b3fce6be6d5d952cbcda0ddae223dda5a576f (diff)
downloadsamba-64578c0589a3a741f81fb55c16eeb882128da00b.tar.gz
samba-64578c0589a3a741f81fb55c16eeb882128da00b.tar.bz2
samba-64578c0589a3a741f81fb55c16eeb882128da00b.zip
merge from the autoconf2 branch to the main branch
(This used to be commit 3bda7ac417107a7b01d91805ca71c4330657ed21)
Diffstat (limited to 'source3/tests/trapdoor.c')
-rw-r--r--source3/tests/trapdoor.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/tests/trapdoor.c b/source3/tests/trapdoor.c
new file mode 100644
index 0000000000..83e10d0613
--- /dev/null
+++ b/source3/tests/trapdoor.c
@@ -0,0 +1,25 @@
+/* test for a trapdoor uid system */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+main()
+{
+ if (getuid() != 0) {
+ fprintf(stderr,"ERROR: This test must be run as root - assuming non-trapdoor system\n");
+ exit(0);
+ }
+
+ if (seteuid(1) != 0) exit(1);
+ if (geteuid() != 1) exit(1);
+ if (seteuid(0) != 0) exit(1);
+ if (geteuid() != 0) exit(1);
+
+ if (setegid(1) != 0) exit(1);
+ if (getegid() != 1) exit(1);
+ if (setegid(0) != 0) exit(1);
+ if (getegid() != 0) exit(1);
+
+ exit(0);
+}