aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShirish Pargaonkar <shirishp@us.ibm.com>2007-10-30 00:45:14 -0400
committerSteve French <sfrench@us.ibm.com>2007-10-30 00:45:14 -0400
commite01b64001359034d04c695388870936ed3d1b56b (patch)
tree1c6c3e0267e7bd902d0c8c9293ceb844a6993bd2
parentb9c7a2bb1e57f571d3b0763bdce1ce15510a7b78 (diff)
[CIFS] enable get mode from ACL when cifsacl mount option specified
Part 9 of ACL patch series. getting mode from ACL now works in some cases (and requires CIFS_EXPERIMENTAL config option). Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/CHANGES4
-rw-r--r--fs/cifs/cifsacl.c28
2 files changed, 24 insertions, 8 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 3d419163c3d3..c65c9da863f3 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -12,7 +12,9 @@ leak that causes cifsd not to stop and rmmod to fail to cleanup
12cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on 12cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on
13bigendian architectures. Fix possible memory corruption when 13bigendian architectures. Fix possible memory corruption when
14EAGAIN returned on kern_recvmsg. Return better error if server 14EAGAIN returned on kern_recvmsg. Return better error if server
15requires packet signing but client has disabled it. 15requires packet signing but client has disabled it. When mounted
16with cifsacl mount option - mode bits are approximated based
17on the contents of the files ACL.
16 18
17Version 1.50 19Version 1.50
18------------ 20------------
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
index cad2da3a447d..629b96c21639 100644
--- a/fs/cifs/cifsacl.c
+++ b/fs/cifs/cifsacl.c
@@ -43,8 +43,8 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
43 43
44 44
45/* security id for everyone */ 45/* security id for everyone */
46static const struct cifs_sid sid_everyone = 46static const struct cifs_sid sid_everyone = {
47 {1, 1, {0, 0, 0, 0, 0, 0}, {} }; 47 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
48/* group users */ 48/* group users */
49static const struct cifs_sid sid_user = 49static const struct cifs_sid sid_user =
50 {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; 50 {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
@@ -138,8 +138,6 @@ static void access_flags_to_mode(__u32 ace_flags, umode_t *pmode,
138 umode_t bits_to_set) 138 umode_t bits_to_set)
139{ 139{
140 140
141 *pmode &= ~bits_to_set;
142
143 if (ace_flags & GENERIC_ALL) { 141 if (ace_flags & GENERIC_ALL) {
144 *pmode |= (S_IRWXUGO & bits_to_set); 142 *pmode |= (S_IRWXUGO & bits_to_set);
145#ifdef CONFIG_CIFS_DEBUG2 143#ifdef CONFIG_CIFS_DEBUG2
@@ -147,11 +145,14 @@ static void access_flags_to_mode(__u32 ace_flags, umode_t *pmode,
147#endif 145#endif
148 return; 146 return;
149 } 147 }
150 if ((ace_flags & GENERIC_WRITE) || (ace_flags & FILE_WRITE_RIGHTS)) 148 if ((ace_flags & GENERIC_WRITE) ||
149 ((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
151 *pmode |= (S_IWUGO & bits_to_set); 150 *pmode |= (S_IWUGO & bits_to_set);
152 if ((ace_flags & GENERIC_READ) || (ace_flags & FILE_READ_RIGHTS)) 151 if ((ace_flags & GENERIC_READ) ||
152 ((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
153 *pmode |= (S_IRUGO & bits_to_set); 153 *pmode |= (S_IRUGO & bits_to_set);
154 if ((ace_flags & GENERIC_EXECUTE) || (ace_flags & FILE_EXEC_RIGHTS)) 154 if ((ace_flags & GENERIC_EXECUTE) ||
155 ((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
155 *pmode |= (S_IXUGO & bits_to_set); 156 *pmode |= (S_IXUGO & bits_to_set);
156 157
157#ifdef CONFIG_CIFS_DEBUG2 158#ifdef CONFIG_CIFS_DEBUG2
@@ -234,11 +235,24 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
234 cifscred->aces = kmalloc(num_aces * 235 cifscred->aces = kmalloc(num_aces *
235 sizeof(struct cifs_ace *), GFP_KERNEL);*/ 236 sizeof(struct cifs_ace *), GFP_KERNEL);*/
236 237
238 /* reset rwx permissions for user/group/other */
239 inode->i_mode &= ~(S_IRWXUGO);
240
237 for (i = 0; i < num_aces; ++i) { 241 for (i = 0; i < num_aces; ++i) {
238 ppace[i] = (struct cifs_ace *) (acl_base + acl_size); 242 ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
239 243
240 parse_ace(ppace[i], end_of_acl); 244 parse_ace(ppace[i], end_of_acl);
241 245
246 if (compare_sids(&(ppace[i]->sid), pownersid))
247 access_flags_to_mode(ppace[i]->access_req,
248 &(inode->i_mode), S_IRWXU);
249 if (compare_sids(&(ppace[i]->sid), pgrpsid))
250 access_flags_to_mode(ppace[i]->access_req,
251 &(inode->i_mode), S_IRWXG);
252 if (compare_sids(&(ppace[i]->sid), &sid_everyone))
253 access_flags_to_mode(ppace[i]->access_req,
254 &(inode->i_mode), S_IRWXO);
255
242/* memcpy((void *)(&(cifscred->aces[i])), 256/* memcpy((void *)(&(cifscred->aces[i])),
243 (void *)ppace[i], 257 (void *)ppace[i],
244 sizeof(struct cifs_ace)); */ 258 sizeof(struct cifs_ace)); */