1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

vfs_nfs4acl_xattr: fsp->fh->fd can legally be -1

We only open the underlying file if the open access mode contains

FILE_READ_DATA|FILE_WRITE_DATA|FILE_APPEND_DATA|FILE_EXECUTE

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2017-10-23 16:38:51 +02:00 committed by Jeremy Allison
parent 2fb6b0c2da
commit d4d7e38bf6
2 changed files with 8 additions and 4 deletions

View File

@ -25,12 +25,10 @@
^samba3.raw.acls nfs4acl_xattr-simple.create_owner_file\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-simple.create_owner_dir\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-simple.nulldacl\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-simple.generic\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.INHERITFLAGS\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.create_owner_file\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.create_owner_dir\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.nulldacl\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.generic\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.inherit_creator_owner\(nt4_dc\)
^samba3.raw.acls nfs4acl_xattr-special.inherit_creator_group\(nt4_dc\)
^samba3.base.delete.deltest16a

View File

@ -463,8 +463,14 @@ static bool nfs4acl_smb4acl_set_fn(vfs_handle_struct *handle,
return false;
}
ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, config->xattr_name,
blob.data, blob.length, 0);
if (fsp->fh->fd != -1) {
ret = SMB_VFS_NEXT_FSETXATTR(handle, fsp, config->xattr_name,
blob.data, blob.length, 0);
} else {
ret = SMB_VFS_NEXT_SETXATTR(handle, fsp->fsp_name,
config->xattr_name,
blob.data, blob.length, 0);
}
data_blob_free(&blob);
if (ret != 0) {
DBG_ERR("can't store acl in xattr: %s\n", strerror(errno));