diff options
author | Jeff Layton <jlayton@redhat.com> | 2008-05-22 09:33:34 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-05-23 14:25:17 -0400 |
commit | 4ca691a892e8ab4f79583de1394f17a7dcfa2b57 (patch) | |
tree | 7c049eb1898ad1668f8d148b2d68d36213ce0841 /fs | |
parent | 4e94a105ed0df78e25b20ff8ed6761f5937662b1 (diff) |
silently ignore ownership changes unless unix extensions are enabled or we're faking uid changes
CIFS currently allows you to change the ownership of a file, but unless
unix extensions are enabled this change is not passed off to the server.
Have CIFS silently ignore ownership changes that can't be persistently
stored on the server unless the "setuids" option is explicitly
specified.
We could return an error here (-EOPNOTSUPP or something), but this is
how most disk-based windows filesystems on behave on Linux (e.g. VFAT,
NTFS, etc). With cifsacl support and proper Windows to Unix idmapping
support, we may be able to do this more properly in the future.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/inode.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index ae6b725b3665..fe752fdb26c3 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1546,13 +1546,26 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) | |||
1546 | } else | 1546 | } else |
1547 | goto cifs_setattr_exit; | 1547 | goto cifs_setattr_exit; |
1548 | } | 1548 | } |
1549 | if (attrs->ia_valid & ATTR_UID) { | 1549 | |
1550 | cFYI(1, ("UID changed to %d", attrs->ia_uid)); | 1550 | /* |
1551 | uid = attrs->ia_uid; | 1551 | * Without unix extensions we can't send ownership changes to the |
1552 | } | 1552 | * server, so silently ignore them. This is consistent with how |
1553 | if (attrs->ia_valid & ATTR_GID) { | 1553 | * local DOS/Windows filesystems behave (VFAT, NTFS, etc). With |
1554 | cFYI(1, ("GID changed to %d", attrs->ia_gid)); | 1554 | * CIFSACL support + proper Windows to Unix idmapping, we may be |
1555 | gid = attrs->ia_gid; | 1555 | * able to support this in the future. |
1556 | */ | ||
1557 | if (!pTcon->unix_ext && | ||
1558 | !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) { | ||
1559 | attrs->ia_valid &= ~(ATTR_UID | ATTR_GID); | ||
1560 | } else { | ||
1561 | if (attrs->ia_valid & ATTR_UID) { | ||
1562 | cFYI(1, ("UID changed to %d", attrs->ia_uid)); | ||
1563 | uid = attrs->ia_uid; | ||
1564 | } | ||
1565 | if (attrs->ia_valid & ATTR_GID) { | ||
1566 | cFYI(1, ("GID changed to %d", attrs->ia_gid)); | ||
1567 | gid = attrs->ia_gid; | ||
1568 | } | ||
1556 | } | 1569 | } |
1557 | 1570 | ||
1558 | time_buf.Attributes = 0; | 1571 | time_buf.Attributes = 0; |