Skip to content

Commit 0c6f4eb

Browse files
Ronnie Sahlbergsmfrench
authored andcommitted
cifs: modefromsids must add an ACE for authenticated users
When we create a file with modefromsids we set an ACL that has one ACE for the magic modefromsid as well as a second ACE that grants full access to all authenticated users. When later we chante the mode on the file we strip away this, and other, ACE for authenticated users in set_chmod_dacl() and then just add back/update the modefromsid ACE. Thus leaving the file with a single ACE that is for the mode and no ACE to grant any user any rights to access the file. Fix this by always adding back also the modefromsid ACE so that we do not drop the rights to access the file. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 3d6cc98 commit 0c6f4eb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/cifs/cifsacl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ static void populate_new_aces(char *nacl_base,
949949
pnntace = (struct cifs_ace *) (nacl_base + nsize);
950950
nsize += setup_special_mode_ACE(pnntace, nmode);
951951
num_aces++;
952+
pnntace = (struct cifs_ace *) (nacl_base + nsize);
953+
nsize += setup_authusers_ACE(pnntace);
954+
num_aces++;
952955
goto set_size;
953956
}
954957

@@ -1613,7 +1616,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16131616
nsecdesclen = secdesclen;
16141617
if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
16151618
if (mode_from_sid)
1616-
nsecdesclen += sizeof(struct cifs_ace);
1619+
nsecdesclen += 2 * sizeof(struct cifs_ace);
16171620
else /* cifsacl */
16181621
nsecdesclen += 5 * sizeof(struct cifs_ace);
16191622
} else { /* chown */

0 commit comments

Comments
 (0)