some merge cleanups
[ira/wip.git] / source3 / tests / trapdoor.c
1 /* test for a trapdoor uid system */
2
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <stdio.h>
6
7 main()
8 {
9         if (getuid() != 0) {
10                 fprintf(stderr,"ERROR: This test must be run as root - assuming non-trapdoor system\n");
11                 exit(0);
12         }
13
14         if (seteuid(1) != 0) exit(1);
15         if (geteuid() != 1) exit(1);
16         if (seteuid(0) != 0) exit(1);
17         if (geteuid() != 0) exit(1);
18
19         if (setegid(1) != 0) exit(1);
20         if (getegid() != 1) exit(1);
21         if (setegid(0) != 0) exit(1);
22         if (getegid() != 0) exit(1);
23
24         exit(0);
25 }