]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: nfs4acl_xattr: Ensure remove smb_fname argument from nfs4acl_get_blob().
authorJeremy Allison <jra@samba.org>
Thu, 1 Apr 2021 20:22:15 +0000 (13:22 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 7 Apr 2021 16:26:28 +0000 (16:26 +0000)
Now we know we always have a valid fsp, use it.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_nfs4acl_xattr.c

index d17d40cbd5cb800959fbc1a345b1d85578064201..3c32c25c07096fa5d8bb5c64eafed690c79f1154 100644 (file)
@@ -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)) {