From: Ralph Boehme Date: Mon, 23 Oct 2017 14:38:51 +0000 (+0200) Subject: vfs_nfs4acl_xattr: fsp->fh->fd can legally be -1 X-Git-Tag: tevent-0.9.34~38 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d4d7e38bf6fcde3ef1fde6c5f83c4f5e983818e1;p=thirdparty%2Fsamba.git 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 Reviewed-by: Jeremy Allison --- diff --git a/selftest/knownfail b/selftest/knownfail index 030520f7e58..f3c605ba582 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -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 diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index 2bc546150e0..b3b5e497061 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -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));