diff options
author | Jan Kara <jack@suse.cz> | 2009-06-17 19:26:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:03:45 -0400 |
commit | 5c4a656b7e51503c2b5e7e7310ec326ee38a8389 (patch) | |
tree | 4493bfbd8b4e786ddb4d7e2717eb87de4da08774 /fs/isofs | |
parent | 52b680c81238ea14693ab893d5d32a4d1c0a987d (diff) |
isofs: fix setting of uid and gid to 0
isofs allows setting of default uid and gid of files but value 0 was used
to indicate that user did not specify any uid/gid mount option. Since
this option also overrides uid/gid set in Rock Ridge extension, it makes
sense to allow forcing uid/gid 0. Fix option processing to allow this.
Cc: <Hans-Joachim.Baader@cjt.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/isofs')
-rw-r--r-- | fs/isofs/inode.c | 26 | ||||
-rw-r--r-- | fs/isofs/isofs.h | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 8e6fd41eec12..0f4f9ca77f8e 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -153,6 +153,8 @@ struct iso9660_options{ | |||
153 | unsigned int blocksize; | 153 | unsigned int blocksize; |
154 | mode_t fmode; | 154 | mode_t fmode; |
155 | mode_t dmode; | 155 | mode_t dmode; |
156 | char uid_set; | ||
157 | char gid_set; | ||
156 | gid_t gid; | 158 | gid_t gid; |
157 | uid_t uid; | 159 | uid_t uid; |
158 | char *iocharset; | 160 | char *iocharset; |
@@ -370,6 +372,8 @@ static int parse_options(char *options, struct iso9660_options *popt) | |||
370 | popt->nocompress = 0; | 372 | popt->nocompress = 0; |
371 | popt->blocksize = 1024; | 373 | popt->blocksize = 1024; |
372 | popt->fmode = popt->dmode = ISOFS_INVALID_MODE; | 374 | popt->fmode = popt->dmode = ISOFS_INVALID_MODE; |
375 | popt->uid_set = 0; | ||
376 | popt->gid_set = 0; | ||
373 | popt->gid = 0; | 377 | popt->gid = 0; |
374 | popt->uid = 0; | 378 | popt->uid = 0; |
375 | popt->iocharset = NULL; | 379 | popt->iocharset = NULL; |
@@ -448,11 +452,13 @@ static int parse_options(char *options, struct iso9660_options *popt) | |||
448 | if (match_int(&args[0], &option)) | 452 | if (match_int(&args[0], &option)) |
449 | return 0; | 453 | return 0; |
450 | popt->uid = option; | 454 | popt->uid = option; |
455 | popt->uid_set = 1; | ||
451 | break; | 456 | break; |
452 | case Opt_gid: | 457 | case Opt_gid: |
453 | if (match_int(&args[0], &option)) | 458 | if (match_int(&args[0], &option)) |
454 | return 0; | 459 | return 0; |
455 | popt->gid = option; | 460 | popt->gid = option; |
461 | popt->gid_set = 1; | ||
456 | break; | 462 | break; |
457 | case Opt_mode: | 463 | case Opt_mode: |
458 | if (match_int(&args[0], &option)) | 464 | if (match_int(&args[0], &option)) |
@@ -810,6 +816,8 @@ root_found: | |||
810 | sbi->s_showassoc = opt.showassoc; | 816 | sbi->s_showassoc = opt.showassoc; |
811 | sbi->s_uid = opt.uid; | 817 | sbi->s_uid = opt.uid; |
812 | sbi->s_gid = opt.gid; | 818 | sbi->s_gid = opt.gid; |
819 | sbi->s_uid_set = opt.uid_set; | ||
820 | sbi->s_gid_set = opt.gid_set; | ||
813 | sbi->s_utf8 = opt.utf8; | 821 | sbi->s_utf8 = opt.utf8; |
814 | sbi->s_nocompress = opt.nocompress; | 822 | sbi->s_nocompress = opt.nocompress; |
815 | sbi->s_overriderockperm = opt.overriderockperm; | 823 | sbi->s_overriderockperm = opt.overriderockperm; |
@@ -1103,18 +1111,6 @@ static const struct address_space_operations isofs_aops = { | |||
1103 | .bmap = _isofs_bmap | 1111 | .bmap = _isofs_bmap |
1104 | }; | 1112 | }; |
1105 | 1113 | ||
1106 | static inline void test_and_set_uid(uid_t *p, uid_t value) | ||
1107 | { | ||
1108 | if (value) | ||
1109 | *p = value; | ||
1110 | } | ||
1111 | |||
1112 | static inline void test_and_set_gid(gid_t *p, gid_t value) | ||
1113 | { | ||
1114 | if (value) | ||
1115 | *p = value; | ||
1116 | } | ||
1117 | |||
1118 | static int isofs_read_level3_size(struct inode *inode) | 1114 | static int isofs_read_level3_size(struct inode *inode) |
1119 | { | 1115 | { |
1120 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); | 1116 | unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); |
@@ -1365,8 +1361,10 @@ static int isofs_read_inode(struct inode *inode) | |||
1365 | if (!high_sierra) { | 1361 | if (!high_sierra) { |
1366 | parse_rock_ridge_inode(de, inode); | 1362 | parse_rock_ridge_inode(de, inode); |
1367 | /* if we want uid/gid set, override the rock ridge setting */ | 1363 | /* if we want uid/gid set, override the rock ridge setting */ |
1368 | test_and_set_uid(&inode->i_uid, sbi->s_uid); | 1364 | if (sbi->s_uid_set) |
1369 | test_and_set_gid(&inode->i_gid, sbi->s_gid); | 1365 | inode->i_uid = sbi->s_uid; |
1366 | if (sbi->s_gid_set) | ||
1367 | inode->i_gid = sbi->s_gid; | ||
1370 | } | 1368 | } |
1371 | /* Now set final access rights if overriding rock ridge setting */ | 1369 | /* Now set final access rights if overriding rock ridge setting */ |
1372 | if (S_ISDIR(inode->i_mode) && sbi->s_overriderockperm && | 1370 | if (S_ISDIR(inode->i_mode) && sbi->s_overriderockperm && |
diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 9679fbcbfc03..e2fc9704f14f 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h | |||
@@ -51,6 +51,8 @@ struct isofs_sb_info { | |||
51 | unsigned char s_hide; | 51 | unsigned char s_hide; |
52 | unsigned char s_showassoc; | 52 | unsigned char s_showassoc; |
53 | unsigned char s_overriderockperm; | 53 | unsigned char s_overriderockperm; |
54 | unsigned char s_uid_set; | ||
55 | unsigned char s_gid_set; | ||
54 | 56 | ||
55 | mode_t s_fmode; | 57 | mode_t s_fmode; |
56 | mode_t s_dmode; | 58 | mode_t s_dmode; |