[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>
This commit is contained in:
Shirish Pargaonkar 2007-10-30 04:45:14 +00:00 committed by Steve French
parent b9c7a2bb1e
commit e01b640013
2 changed files with 24 additions and 8 deletions

View file

@ -12,7 +12,9 @@ leak that causes cifsd not to stop and rmmod to fail to cleanup
cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on cifs_request_buffers pool. Fix problem with POSIX Open/Mkdir on
bigendian architectures. Fix possible memory corruption when bigendian architectures. Fix possible memory corruption when
EAGAIN returned on kern_recvmsg. Return better error if server EAGAIN returned on kern_recvmsg. Return better error if server
requires packet signing but client has disabled it. requires packet signing but client has disabled it. When mounted
with cifsacl mount option - mode bits are approximated based
on the contents of the files ACL.
Version 1.50 Version 1.50
------------ ------------

View file

@ -43,8 +43,8 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
/* security id for everyone */ /* security id for everyone */
static const struct cifs_sid sid_everyone = static const struct cifs_sid sid_everyone = {
{1, 1, {0, 0, 0, 0, 0, 0}, {} }; 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
/* group users */ /* group users */
static const struct cifs_sid sid_user = static const struct cifs_sid sid_user =
{1, 2 , {0, 0, 0, 0, 0, 5}, {} }; {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
@ -138,8 +138,6 @@ static void access_flags_to_mode(__u32 ace_flags, umode_t *pmode,
umode_t bits_to_set) umode_t bits_to_set)
{ {
*pmode &= ~bits_to_set;
if (ace_flags & GENERIC_ALL) { if (ace_flags & GENERIC_ALL) {
*pmode |= (S_IRWXUGO & bits_to_set); *pmode |= (S_IRWXUGO & bits_to_set);
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
@ -147,11 +145,14 @@ static void access_flags_to_mode(__u32 ace_flags, umode_t *pmode,
#endif #endif
return; return;
} }
if ((ace_flags & GENERIC_WRITE) || (ace_flags & FILE_WRITE_RIGHTS)) if ((ace_flags & GENERIC_WRITE) ||
((ace_flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
*pmode |= (S_IWUGO & bits_to_set); *pmode |= (S_IWUGO & bits_to_set);
if ((ace_flags & GENERIC_READ) || (ace_flags & FILE_READ_RIGHTS)) if ((ace_flags & GENERIC_READ) ||
((ace_flags & FILE_READ_RIGHTS) == FILE_READ_RIGHTS))
*pmode |= (S_IRUGO & bits_to_set); *pmode |= (S_IRUGO & bits_to_set);
if ((ace_flags & GENERIC_EXECUTE) || (ace_flags & FILE_EXEC_RIGHTS)) if ((ace_flags & GENERIC_EXECUTE) ||
((ace_flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
*pmode |= (S_IXUGO & bits_to_set); *pmode |= (S_IXUGO & bits_to_set);
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
@ -234,11 +235,24 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
cifscred->aces = kmalloc(num_aces * cifscred->aces = kmalloc(num_aces *
sizeof(struct cifs_ace *), GFP_KERNEL);*/ sizeof(struct cifs_ace *), GFP_KERNEL);*/
/* reset rwx permissions for user/group/other */
inode->i_mode &= ~(S_IRWXUGO);
for (i = 0; i < num_aces; ++i) { for (i = 0; i < num_aces; ++i) {
ppace[i] = (struct cifs_ace *) (acl_base + acl_size); ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
parse_ace(ppace[i], end_of_acl); parse_ace(ppace[i], end_of_acl);
if (compare_sids(&(ppace[i]->sid), pownersid))
access_flags_to_mode(ppace[i]->access_req,
&(inode->i_mode), S_IRWXU);
if (compare_sids(&(ppace[i]->sid), pgrpsid))
access_flags_to_mode(ppace[i]->access_req,
&(inode->i_mode), S_IRWXG);
if (compare_sids(&(ppace[i]->sid), &sid_everyone))
access_flags_to_mode(ppace[i]->access_req,
&(inode->i_mode), S_IRWXO);
/* memcpy((void *)(&(cifscred->aces[i])), /* memcpy((void *)(&(cifscred->aces[i])),
(void *)ppace[i], (void *)ppace[i],
sizeof(struct cifs_ace)); */ sizeof(struct cifs_ace)); */