diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2005-09-09 16:10:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-09 17:03:46 -0400 |
commit | 5a53368277efa2d80dd2206dddc1f4b19ef0c32a (patch) | |
tree | decdf01b0019bf3d0f04d3426b8d6e2d18641eb3 /fs/fuse | |
parent | 87729a5514e855ce2c71e3e33833a106b8caf2ae (diff) |
[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>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/inode.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index c8e54c0658f1..298c1d4c1534 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -32,6 +32,10 @@ struct fuse_mount_data { | |||
32 | unsigned rootmode; | 32 | unsigned rootmode; |
33 | unsigned user_id; | 33 | unsigned user_id; |
34 | unsigned group_id; | 34 | unsigned group_id; |
35 | unsigned fd_present : 1; | ||
36 | unsigned rootmode_present : 1; | ||
37 | unsigned user_id_present : 1; | ||
38 | unsigned group_id_present : 1; | ||
35 | unsigned flags; | 39 | unsigned flags; |
36 | unsigned max_read; | 40 | unsigned max_read; |
37 | }; | 41 | }; |
@@ -274,7 +278,6 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
274 | { | 278 | { |
275 | char *p; | 279 | char *p; |
276 | memset(d, 0, sizeof(struct fuse_mount_data)); | 280 | memset(d, 0, sizeof(struct fuse_mount_data)); |
277 | d->fd = -1; | ||
278 | d->max_read = ~0; | 281 | d->max_read = ~0; |
279 | 282 | ||
280 | while ((p = strsep(&opt, ",")) != NULL) { | 283 | while ((p = strsep(&opt, ",")) != NULL) { |
@@ -290,24 +293,28 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
290 | if (match_int(&args[0], &value)) | 293 | if (match_int(&args[0], &value)) |
291 | return 0; | 294 | return 0; |
292 | d->fd = value; | 295 | d->fd = value; |
296 | d->fd_present = 1; | ||
293 | break; | 297 | break; |
294 | 298 | ||
295 | case OPT_ROOTMODE: | 299 | case OPT_ROOTMODE: |
296 | if (match_octal(&args[0], &value)) | 300 | if (match_octal(&args[0], &value)) |
297 | return 0; | 301 | return 0; |
298 | d->rootmode = value; | 302 | d->rootmode = value; |
303 | d->rootmode_present = 1; | ||
299 | break; | 304 | break; |
300 | 305 | ||
301 | case OPT_USER_ID: | 306 | case OPT_USER_ID: |
302 | if (match_int(&args[0], &value)) | 307 | if (match_int(&args[0], &value)) |
303 | return 0; | 308 | return 0; |
304 | d->user_id = value; | 309 | d->user_id = value; |
310 | d->user_id_present = 1; | ||
305 | break; | 311 | break; |
306 | 312 | ||
307 | case OPT_GROUP_ID: | 313 | case OPT_GROUP_ID: |
308 | if (match_int(&args[0], &value)) | 314 | if (match_int(&args[0], &value)) |
309 | return 0; | 315 | return 0; |
310 | d->group_id = value; | 316 | d->group_id = value; |
317 | d->group_id_present = 1; | ||
311 | break; | 318 | break; |
312 | 319 | ||
313 | case OPT_DEFAULT_PERMISSIONS: | 320 | case OPT_DEFAULT_PERMISSIONS: |
@@ -332,7 +339,9 @@ static int parse_fuse_opt(char *opt, struct fuse_mount_data *d) | |||
332 | return 0; | 339 | return 0; |
333 | } | 340 | } |
334 | } | 341 | } |
335 | if (d->fd == -1) | 342 | |
343 | if (!d->fd_present || !d->rootmode_present || | ||
344 | !d->user_id_present || !d->group_id_present) | ||
336 | return 0; | 345 | return 0; |
337 | 346 | ||
338 | return 1; | 347 | return 1; |