X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fd_fusemount.c;h=5c43cf4f74d6534afb3cd3c2310b1586071000b6;hb=69d5a20268ec0fbdcaf209addc48efa2758ae322;hp=63e2b96949a2d520a3d0707af4db39560e771e0d;hpb=57ec702077391433ce1ae89bd1e2293bca03bb47;p=vsys-scripts.git diff --git a/fd_fusemount.c b/fd_fusemount.c index 63e2b96..5c43cf4 100644 --- a/fd_fusemount.c +++ b/fd_fusemount.c @@ -4,6 +4,7 @@ #include #include #include +#include #include "fdpass.h" unsigned int rcvbuf = 16*1024*1024; @@ -40,6 +41,28 @@ int get_magic_fd (char *data) { return -1; } +void check_source(char *source) { + source[arg_length-1]='\0'; + if (strchr(source,'/') || strstr(source,"..")) { + printf("Tried mounting with source = %s\n", source); + exit(1); + } +} + +void check_target(char *target) { + target[arg_length-1]='\0'; + if (strstr(target,"..")) { + printf("Tried mounting with target = %s\n", target); + exit(1); + } +} + +void check_fstype(char *filesystemtype) { + if (strncmp(filesystemtype,"fuse",4)) { + printf("Tried mounting filesystem type %s\n", filesystemtype); + } +} + int main(int argc, char *argv[]) { int control_channel_fd, magic_fd, mount_fd; char source[128],target[128],filesystemtype[128],data[128],slice_target[256]; @@ -88,5 +111,10 @@ int main(int argc, char *argv[]) { if (!mount(source, slice_target, filesystemtype, mountflags, data)) { send_fd(control_channel_fd, magic_fd); } + else { + printf ("Error executing mount\n"); + exit(1); + } + return 0; }