fix
authorMiklos Szeredi <miklos@szeredi.hu>
Thu, 7 Jul 2005 12:35:37 +0000 (12:35 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 7 Jul 2005 12:35:37 +0000 (12:35 +0000)
ChangeLog
README
lib/helper.c

index c0b8679ec6cd92afa8b9ce97b42507434254fd96..f820dd407f6d044e70833928f8075bd5e5dff35b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-07-07  Miklos Szeredi <miklos@szeredi.hu>
+
+       * lib: don't allow both 'allow_other' and 'allow_root' options to
+       be given
+
 2005-07-06  Miklos Szeredi <miklos@szeredi.hu>
 
        * fusermount: check if mountpoint is empty (only '.' and '..' for
diff --git a/README b/README
index 7d8a7462bd9636ecedea781eebb5073dc80f6fa8..5a6fb8adcdf744089951ad8172e664553cad2151 100644 (file)
--- a/README
+++ b/README
@@ -114,14 +114,16 @@ default_permissions
 allow_other
 
   This option overrides the security measure restricting file access
-  to the user mounting the filesystem.  This option is by default only
-  allowed to root, but this restriction can be removed with a
-  configuration option described in the previous section.
+  to the user mounting the filesystem.  So all users (including root)
+  can access the files.  This option is by default only allowed to
+  root, but this restriction can be removed with a configuration
+  option described in the previous section.
 
 allow_root
 
   This option is similar to 'allow_other' but file access is limited
-  to the user mounting the filesystem and root.
+  to the user mounting the filesystem and root.  This option and
+  'allow_other' are mutually exclusive.
 
 kernel_cache
 
index 0d6e5b20d52c17d204e37a3d7a61eb3125f85272..13f3ca26f72efb40cda726f121900d3259d8d266 100644 (file)
@@ -136,6 +136,8 @@ static int add_options(char **lib_optp, char **kernel_optp, const char *opts)
     char *xopts = strdup(opts);
     char *s = xopts;
     char *opt;
+    int has_allow_other = 0;
+    int has_allow_root = 0;
 
     if (xopts == NULL) {
         fprintf(stderr, "fuse: memory allocation failed\n");
@@ -147,16 +149,25 @@ static int add_options(char **lib_optp, char **kernel_optp, const char *opts)
         if (fuse_is_lib_option(opt)) {
             res = add_option_to(opt, lib_optp);
             /* Compatibility hack */
-            if (strcmp(opt, "allow_root") == 0 && res != -1)
+            if (strcmp(opt, "allow_root") == 0 && res != -1) {
+                has_allow_root = 1;
                 res = add_option_to("allow_other", kernel_optp);
+            }
         }
-        else
+        else {
             res = add_option_to(opt, kernel_optp);
+            if (strcmp(opt, "allow_other") == 0)
+                has_allow_other = 1;
+        }
         if (res == -1) {
             fprintf(stderr, "fuse: memory allocation failed\n");
             return -1;
         }
     }
+    if (has_allow_other && has_allow_root) {
+        fprintf(stderr, "fuse: 'allow_other' and 'allow_root' options are mutually exclusive\n");
+        return -1;
+    }
     free(xopts);
     return 0;
 }