From b094144abbce1ba154454ec1e7877f57a08f2377 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 1 Apr 2021 13:22:15 -0700 Subject: [PATCH] VFS: nfs4acl_xattr: Ensure remove smb_fname argument from nfs4acl_get_blob(). Now we know we always have a valid fsp, use it. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/modules/vfs_nfs4acl_xattr.c | 35 ++++++----------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c index d17d40cbd5c..3c32c25c070 100644 --- a/source3/modules/vfs_nfs4acl_xattr.c +++ b/source3/modules/vfs_nfs4acl_xattr.c @@ -93,12 +93,11 @@ static bool nfs4acl_validate_blob(vfs_handle_struct *handle, static NTSTATUS nfs4acl_get_blob(struct vfs_handle_struct *handle, files_struct *fsp, - const struct smb_filename *smb_fname_in, TALLOC_CTX *mem_ctx, DATA_BLOB *blob) { struct nfs4acl_config *config = NULL; - const struct smb_filename *smb_fname = NULL; + const struct smb_filename *smb_fname = fsp->fsp_name; size_t allocsize = 256; ssize_t length; bool ok; @@ -109,17 +108,6 @@ static NTSTATUS nfs4acl_get_blob(struct vfs_handle_struct *handle, *blob = data_blob_null; - if (fsp == NULL && smb_fname_in == NULL) { - return NT_STATUS_INTERNAL_ERROR; - } - smb_fname = smb_fname_in; - if (smb_fname == NULL) { - smb_fname = fsp->fsp_name; - } - if (smb_fname == NULL) { - return NT_STATUS_INTERNAL_ERROR; - } - ok = nfs4acl_validate_blob(handle, smb_fname); if (!ok) { return NT_STATUS_INTERNAL_ERROR; @@ -133,19 +121,11 @@ static NTSTATUS nfs4acl_get_blob(struct vfs_handle_struct *handle, return NT_STATUS_NO_MEMORY; } - if (fsp != NULL && fsp_get_pathref_fd(fsp) != -1) { - length = SMB_VFS_NEXT_FGETXATTR(handle, - fsp, - config->xattr_name, - blob->data, - blob->length); - } else { - length = SMB_VFS_NEXT_GETXATTR(handle, - smb_fname, - config->xattr_name, - blob->data, - blob->length); - } + length = SMB_VFS_NEXT_FGETXATTR(handle, + fsp, + config->xattr_name, + blob->data, + blob->length); } while (length == -1 && errno == ERANGE && allocsize <= 65536); if (length == -1) { @@ -239,7 +219,7 @@ static NTSTATUS nfs4acl_xattr_fget_nt_acl(struct vfs_handle_struct *handle, DATA_BLOB blob; NTSTATUS status; - status = nfs4acl_get_blob(handle, fsp, NULL, frame, &blob); + status = nfs4acl_get_blob(handle, fsp, frame, &blob); if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { TALLOC_FREE(frame); return nfs4acl_xattr_default_sd( @@ -331,7 +311,6 @@ static NTSTATUS nfs4acl_xattr_get_nt_acl_at(struct vfs_handle_struct *handle, status = nfs4acl_get_blob(handle, smb_fname->fsp, - smb_fname, frame, &blob); if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { -- 2.47.3