s3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS
commitc0ddfc126716457f3bfc19e4aa30a632abb21073
authorStefan Metzmacher <metze@samba.org>
Wed, 20 Aug 2014 11:58:38 +0000 (20 13:58 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Sep 2014 18:39:19 +0000 (2 20:39 +0200)
treef402372c157afac5400d1a9bfe939b04349bb9e2
parent04916e0d2ed573c6aa0838e3f28ff6fffab00166
s3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS

Sometimes Windows clients doesn't filter SECINFO_[UN]PROTECTED_[D|S]ACL flags
before sending the security_information to the server.

security_information = SECINFO_PROTECTED_DACL| SECINFO_DACL
results in a NULL dacl being returned from an GetSecurityDecriptor
request. This happens because posix_get_nt_acl_common()
has the following logic:

if ((security_info & SECINFO_DACL) && !(security_info & SECINFO_PROTECTED_DACL)) {
    ... create DACL ...
}

I'm not sure if the logic is correct or wrong in this place (I guess it's
wrong...).

But what I know is that the SMB server should filter the given
security_information flags before passing to the filesystem.

[MS-SMB2] 3.3.5.20.3 Handling SMB2_0_INFO_SECURITY
...
The server MUST ignore any flag value in the AdditionalInformation field that
is not specified in section 2.2.37.

Section 2.2.37 lists:
OWNER_SECURITY_INFORMATION
GROUP_SECURITY_INFORMATION
DACL_SECURITY_INFORMATION
SACL_SECURITY_INFORMATION
LABEL_SECURITY_INFORMATION
ATTRIBUTE_SECURITY_INFORMATION
SCOPE_SECURITY_INFORMATION
BACKUP_SECURITY_INFORMATION

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10773

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/smbd/nttrans.c
source3/smbd/posix_acls.c
source3/smbd/smb2_getinfo.c
source3/smbd/smb2_setinfo.c