From c902a858d7a79e7da947e9a91d110ee8668db913 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Thu, 7 Jul 2005 12:35:37 +0000 Subject: [PATCH] fix --- ChangeLog | 5 +++++ README | 10 ++++++---- lib/helper.c | 15 +++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c0b8679..f820dd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-07 Miklos Szeredi + + * lib: don't allow both 'allow_other' and 'allow_root' options to + be given + 2005-07-06 Miklos Szeredi * fusermount: check if mountpoint is empty (only '.' and '..' for diff --git a/README b/README index 7d8a746..5a6fb8a 100644 --- 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 diff --git a/lib/helper.c b/lib/helper.c index 0d6e5b2..13f3ca2 100644 --- a/lib/helper.c +++ b/lib/helper.c @@ -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; } -- 2.30.2