]> git.ipfire.org Git - thirdparty/fcron.git/commitdiff
moved adhoc test away from main source code (not usable as is) ver3_3_0
authorThibault Godouet <yo8192@users.noreply.github.com>
Sun, 14 Aug 2016 09:51:00 +0000 (10:51 +0100)
committerThibault Godouet <yo8192@users.noreply.github.com>
Sun, 14 Aug 2016 09:51:00 +0000 (10:51 +0100)
tests/README.tests [deleted file]
tests/test-open.c [deleted file]
tests/test-types.c [deleted file]
tests/test-uidgid.c [deleted file]

diff --git a/tests/README.tests b/tests/README.tests
deleted file mode 100644 (file)
index 021edbf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-This directory contains some test code. Think of this as an embryo of unit tests, which would need to be better integrated with some unit-test framework.
diff --git a/tests/test-open.c b/tests/test-open.c
deleted file mode 100644 (file)
index 349d0a9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-
-int main(int argc, char *argv[]) {
-    int fd;
-    if ( (fd = open("/tmp/test", O_RDWR | O_CREAT, (mode_t) 0)) < 0 )
-        perror("open()");
-
-    return 0;
-}
diff --git a/tests/test-types.c b/tests/test-types.c
deleted file mode 100644 (file)
index c3802cd..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <limits.h>
-
-
-int main(int argc, char **argv) {
-
-    long a = LONG_MAX-10;
-    unsigned long b = a;
-    long c = b;
-
-    printf("a=%ld %lu %lx b=%ld %lu %lx c=%ld %lu %lx LONG_MAX=%ld %lu %lx ULONG_MAX=%ld %lu %lx\n", a,a,a,b,b,b,c,c,c,LONG_MAX,LONG_MAX,LONG_MAX,ULONG_MAX,ULONG_MAX,ULONG_MAX);
-
-}
diff --git a/tests/test-uidgid.c b/tests/test-uidgid.c
deleted file mode 100644 (file)
index 56d1d1a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-
-// if run as user and suid fcron sgid fcron: can set(e)uid() from/to user/fcron back and forth
-// if run as root and suid fcron sgid fcron: can seteuid() from/to root/fcron back and forth BUT CANNOT setuid back to root
-// if run as user and suid root sgid root: can seteuid() from/to root/fcron back and forth BUT CANNOT setuid back to root
-// if run as root and suid root sgid root: can set(e)uid() from/to user/fcron back and forth (i.e. always stay uid/euid 0!)
-
-
-int main(int argc, char *argv[]) {
-    uid_t uid = getuid();
-    uid_t euid = geteuid();
-    gid_t gid = getgid();
-    gid_t egid = getegid();
-
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-   printf("seteuid(uid)\n");
-    if ( seteuid(uid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("seteuid(euid)\n");
-    if ( seteuid(euid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("seteuid(uid)\n");
-    if ( seteuid(uid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("seteuid(euid)\n");
-    if ( seteuid(euid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("setuid(uid)\n");
-    if ( setuid(uid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("setuid(euid)\n");
-    if ( setuid(euid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("setuid(uid)\n");
-    if ( setuid(uid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-    printf("setuid(euid)\n");
-    if ( setuid(euid) < 0 ) return 1;
-    printf("=== uid=%d gid=%d euid=%d egid=%d\n", getuid(), getgid(), geteuid(), getegid());
-
-
-    printf("=== DONE\n");
-
-    return 0;
-
-}
-