(no commit message)
authorSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 24 Mar 2009 22:01:28 +0000 (22:01 +0000)
committerSapan Bhatia <sapanb@cs.princeton.edu>
Tue, 24 Mar 2009 22:01:28 +0000 (22:01 +0000)
fd_fusemount.c

index 63e2b96..de05b55 100644 (file)
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #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) {
+    source[arg_length-1]='\0';
+    if (strstr(source,"..")) {
+        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];