Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ca691a8 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French
Browse files

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: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 4e94a105
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -1546,6 +1546,18 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
		} else
			goto cifs_setattr_exit;
	}

	/*
	 * Without unix extensions we can't send ownership changes to the
	 * server, so silently ignore them. This is consistent with how
	 * local DOS/Windows filesystems behave (VFAT, NTFS, etc). With
	 * CIFSACL support + proper Windows to Unix idmapping, we may be
	 * able to support this in the future.
	 */
	if (!pTcon->unix_ext &&
	    !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) {
		attrs->ia_valid &= ~(ATTR_UID | ATTR_GID);
	} else {
		if (attrs->ia_valid & ATTR_UID) {
			cFYI(1, ("UID changed to %d", attrs->ia_uid));
			uid = attrs->ia_uid;
@@ -1554,6 +1566,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
			cFYI(1, ("GID changed to %d", attrs->ia_gid));
			gid = attrs->ia_gid;
		}
	}

	time_buf.Attributes = 0;