From be8e844ec731a7885bbee37a2f977ed4dae2a3c7 Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sun, 10 Jul 2016 12:24:34 -0400 Subject: compile fixes --- src/faudit/faudit.h | 3 ++- src/faudit/network.c | 1 - src/faudit/seccomp.c | 5 +---- src/faudit/syscall.c | 20 ++++++++++++++------ src/libtracelog/libtracelog.c | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/faudit/faudit.h b/src/faudit/faudit.h index f54f95f98..3c08a3eab 100644 --- a/src/faudit/faudit.h +++ b/src/faudit/faudit.h @@ -20,6 +20,7 @@ #ifndef FAUDIT_H #define FAUDIT_H +#define _GNU_SOURCE #include #include #include @@ -57,4 +58,4 @@ void network_test(void); // dbus.c void dbus_test(void); -#endif \ No newline at end of file +#endif diff --git a/src/faudit/network.c b/src/faudit/network.c index 39821cd25..0e0ad1844 100644 --- a/src/faudit/network.c +++ b/src/faudit/network.c @@ -48,7 +48,6 @@ void check_ssh(void) { } void check_netlink(void) { - socklen_t addr_len; int sock = socket(AF_NETLINK, SOCK_RAW | SOCK_CLOEXEC, 0); if (sock == -1) { printf("GOOD: I cannot connect to netlink socket. Network utilities such as iproute2 will not work in the sandbox.\n"); diff --git a/src/faudit/seccomp.c b/src/faudit/seccomp.c index 099e0e420..6f5d23c48 100644 --- a/src/faudit/seccomp.c +++ b/src/faudit/seccomp.c @@ -77,9 +77,6 @@ void seccomp_test(void) { printf("init_module... "); fflush(0); syscall_run("init_module"); - printf("finit_module... "); fflush(0); - syscall_run("finit_module"); - printf("delete_module... "); fflush(0); syscall_run("delete_module"); @@ -100,4 +97,4 @@ void seccomp_test(void) { else fprintf(stderr, "Error: unrecognized seccomp mode\n"); -} \ No newline at end of file +} diff --git a/src/faudit/syscall.c b/src/faudit/syscall.c index 7088ad340..bc28936c9 100644 --- a/src/faudit/syscall.c +++ b/src/faudit/syscall.c @@ -18,8 +18,20 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "faudit.h" +#include +#include +#include +#include +extern int init_module(void *module_image, unsigned long len, + const char *param_values); +extern int finit_module(int fd, const char *param_values, + int flags); +extern int delete_module(const char *name, int flags); +extern int pivot_root(const char *new_root, const char *put_old); void syscall_helper(int argc, char **argv) { + (void) argc; + if (strcmp(argv[2], "mount") == 0) { mount(NULL, NULL, NULL, 0, NULL); printf("\nUGLY: mount syscall permitted.\n"); @@ -44,16 +56,12 @@ void syscall_helper(int argc, char **argv) { init_module(NULL, 0, NULL); printf("\nUGLY: init_module syscall permitted.\n"); } - else if (strcmp(argv[2], "finit_module") == 0) { - swapoff(0, NULL, 0); - printf("\nUGLY: finit_module syscall permitted.\n"); - } else if (strcmp(argv[2], "delete_module") == 0) { delete_module(NULL, 0); printf("\nUGLY: delete_module syscall permitted.\n"); } else if (strcmp(argv[2], "chroot") == 0) { - int rv = chroot(NULL); + int rv = chroot("/blablabla-57281292"); (void) rv; printf("\nUGLY: chroot syscall permitted.\n"); } @@ -85,4 +93,4 @@ void syscall_run(const char *name) { // wait for the child to finish waitpid(child, NULL, 0); -} \ No newline at end of file +} diff --git a/src/libtracelog/libtracelog.c b/src/libtracelog/libtracelog.c index 0a6d8299f..3e65587c4 100644 --- a/src/libtracelog/libtracelog.c +++ b/src/libtracelog/libtracelog.c @@ -92,7 +92,7 @@ static void storage_add(const char *str) { } // global variable to keep current working directory -char* cwd = NULL; +static char* cwd = NULL; static char *storage_find(const char *str) { #ifdef DEBUG @@ -108,7 +108,7 @@ static char *storage_find(const char *str) { int allocated = 0; if (strstr(str, "..") || strstr(str, "/./") || strstr(str, "//") || str[0] != '/') { - if (cwd != NULL & str[0] != '/') { + if (cwd != NULL && str[0] != '/') { char *fullpath=malloc(PATH_MAX); if (!fullpath) { fprintf(stderr, "Error: cannot allocate memory\n"); -- cgit v1.2.3-54-g00ecf