fix 'dev' and 'suid' option handling and make them default for root mounts
like other file systems do. They are always denied for setuid-root and unprivileged mounts (Bernhard Kaindl, Szabolcs Szakacsits)master
parent
e11c9971a6
commit
376bd8dfc8
|
@ -276,7 +276,7 @@ static int find_mount_flag(const char *s, unsigned len, int *on, int *flag)
|
|||
*flag = mount_flags[i].flag;
|
||||
if (!mount_flags[i].safe && getuid() != 0) {
|
||||
*flag = 0;
|
||||
fprintf(stderr, "%s: unsafe option %s ignored\n",
|
||||
fprintf(stderr, "%s: unsafe option '%s' ignored\n",
|
||||
progname, opt);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
@ -214,7 +214,8 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
|
|||
char *mnt_opts = NULL;
|
||||
|
||||
memset(&mo, 0, sizeof(mo));
|
||||
mo.flags = MS_NOSUID | MS_NODEV;
|
||||
if (getuid())
|
||||
mo.flags = MS_NOSUID | MS_NODEV;
|
||||
|
||||
if (args &&
|
||||
fuse_opt_parse(args, &mo, fuse_mount_opts, fuse_mount_opt_proc) == -1)
|
||||
|
@ -231,6 +232,10 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
|
|||
res = -1;
|
||||
if (get_mnt_flag_opts(&mnt_opts, mo.flags) == -1)
|
||||
goto out;
|
||||
if (!(mo.flags & MS_NODEV) && fuse_opt_add_opt(&mnt_opts, "dev") == -1)
|
||||
goto out;
|
||||
if (!(mo.flags & MS_NOSUID) && fuse_opt_add_opt(&mnt_opts, "suid") == -1)
|
||||
goto out;
|
||||
if (mo.kernel_opts && fuse_opt_add_opt(&mnt_opts, mo.kernel_opts) == -1)
|
||||
goto out;
|
||||
if (mo.mtab_opts && fuse_opt_add_opt(&mnt_opts, mo.mtab_opts) == -1)
|
||||
|
|
Loading…
Reference in New Issue