[PATCH] fuse: stricter mount option checking
Check for the presence of all mandatory mount options. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
87729a5514
commit
5a53368277
1 changed files with 11 additions and 2 deletions
|
@ -32,6 +32,10 @@ struct fuse_mount_data {
|
||||||
unsigned rootmode;
|
unsigned rootmode;
|
||||||
unsigned user_id;
|
unsigned user_id;
|
||||||
unsigned group_id;
|
unsigned group_id;
|
||||||
|
unsigned fd_present : 1;
|
||||||
|
unsigned rootmode_present : 1;
|
||||||
|
unsigned user_id_present : 1;
|
||||||
|
unsigned group_id_present : 1;
|
||||||
unsigned flags;
|
unsigned flags;
|
||||||
unsigned max_read;
|
unsigned max_read;
|
||||||
};
|
};
|
||||||
|
@ -274,7 +278,6 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
memset(d, 0, sizeof(struct fuse_mount_data));
|
memset(d, 0, sizeof(struct fuse_mount_data));
|
||||||
d->fd = -1;
|
|
||||||
d->max_read = ~0;
|
d->max_read = ~0;
|
||||||
|
|
||||||
while ((p = strsep(&opt, ",")) != NULL) {
|
while ((p = strsep(&opt, ",")) != NULL) {
|
||||||
|
@ -290,24 +293,28 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d)
|
||||||
if (match_int(&args[0], &value))
|
if (match_int(&args[0], &value))
|
||||||
return 0;
|
return 0;
|
||||||
d->fd = value;
|
d->fd = value;
|
||||||
|
d->fd_present = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_ROOTMODE:
|
case OPT_ROOTMODE:
|
||||||
if (match_octal(&args[0], &value))
|
if (match_octal(&args[0], &value))
|
||||||
return 0;
|
return 0;
|
||||||
d->rootmode = value;
|
d->rootmode = value;
|
||||||
|
d->rootmode_present = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_USER_ID:
|
case OPT_USER_ID:
|
||||||
if (match_int(&args[0], &value))
|
if (match_int(&args[0], &value))
|
||||||
return 0;
|
return 0;
|
||||||
d->user_id = value;
|
d->user_id = value;
|
||||||
|
d->user_id_present = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_GROUP_ID:
|
case OPT_GROUP_ID:
|
||||||
if (match_int(&args[0], &value))
|
if (match_int(&args[0], &value))
|
||||||
return 0;
|
return 0;
|
||||||
d->group_id = value;
|
d->group_id = value;
|
||||||
|
d->group_id_present = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OPT_DEFAULT_PERMISSIONS:
|
case OPT_DEFAULT_PERMISSIONS:
|
||||||
|
@ -332,7 +339,9 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (d->fd == -1)
|
|
||||||
|
if (!d->fd_present || !d->rootmode_present ||
|
||||||
|
!d->user_id_present || !d->group_id_present)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue