cifs: Retain old ACEs when converting between mode bits and ACL.
authorShyam Prasad N <sprasad@microsoft.com>
Fri, 12 Feb 2021 12:38:43 +0000 (04:38 -0800)
committerSteve French <stfrench@microsoft.com>
Tue, 23 Feb 2021 03:20:44 +0000 (21:20 -0600)
commitf5065508897a922327f32223082325d10b069ebc
tree315505ce37cca97c250aeef938fd03be1ae99f6e
parentc12ead71e86f47f4715f61e6dee7b7120532bedb
cifs: Retain old ACEs when converting between mode bits and ACL.

When cifsacl mount option is used, retain the ACEs which
should not be modified during chmod. Following is the approach taken:

1. Retain all explicit (non-inherited) ACEs, unless the SID is one
of owner/group/everyone/authenticated-users. We're going to set new
ACEs for these SIDs anyways.
2. At the end of the list of explicit ACEs, place the new list of
ACEs obtained by necessary conversion/encoding.
3. Once the converted/encoded ACEs are set, copy all the remaining
ACEs (inherited) into the new ACL.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/cifsacl.c