[CIFS] [PATCH 1/3] Remove XATTR improvements: Improved Linux XATTR support, support POSIX XATTR CAP
The Linux cifs client has long had the ability to set xattrs to Samba
and Windows servers, but two problems have caused compatibility
problems:
1) setting an empty (zero length) EA, which Samba and Windows
interpret as removing the attribute, rather than having an attribute
with an empty value (which can break Linux apps)
2) setting EAs for namespaces other than "user." (equivalently "os2.")
or ACLs (POSIX ACLs and CIFS ACL are supported) such as for SELinux
(helpful for security)
There was a posix xattr capability flag (unused) and posix xattr
setinfo level reserved for this in the CIFS Unix/Linux Extensions, so
this patch implements support for them for the kernel client (will
work on the server side with JRA next):
1) checks CIFS_UNIX_XATTR_CAP (0x00000004) on the POSIX Share Flags
and if the server supports this flag, will use the
SMB_QUERY_XATTR/SMB_SET_XATTR (infolevel 0x205)
2) SetEA for level 205 looks identical to SET_FILE_EA infolevel (level
2, long supported by Samba, Windows, OS/2 and most or all NAS) except
for two required changes:
- the full name including namespace of the EA is sent (ie
"user.myattribute" rather than "myattribute"). Note that EA names are
sent as is, not codepage connverted, to match Windows behavior.
- removing an attribute is specified by setting EA flag
FEA_DELETEEA (0x40). When FEA_DELETEEA is set EA Length must be zero
(Continue reading)