diff options
author | Ralph Boehme <slow@samba.org> | 2021-07-28 17:16:27 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2021-08-17 09:08:36 +0000 |
commit | 8222ff1110c3ff506e3153b3294f2979206cdbfd (patch) | |
tree | 76fb3fdc59bc19b027d9342325efa8ad1b015779 | |
parent | 262d09c511a66562f397af099cfdef588813d1ab (diff) | |
download | samba-8222ff1110c3ff506e3153b3294f2979206cdbfd.tar.gz |
vfs_streams_xattr: ensure fstat calls NEXT fstat
This ensures fstat behaves the same as stat by calling the NEXT VFS stat
function. This is required for matching path and handle based inode
numbers.
This bug is currently only exposed in a special case: a VSS snapshot of a
stream.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14756
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/modules/vfs_streams_xattr.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 72032824b93..743cbd2e8b6 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -199,7 +199,6 @@ static int streams_xattr_stat_base(vfs_handle_struct *handle, static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, SMB_STRUCT_STAT *sbuf) { - struct smb_filename *smb_fname_base = NULL; int ret = -1; struct stream_io *io = (struct stream_io *) VFS_FETCH_FSP_EXTENSION(handle, fsp); @@ -214,30 +213,19 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, return -1; } - /* Create an smb_filename with stream_name == NULL. */ - smb_fname_base = synthetic_smb_fname(talloc_tos(), - io->base, - NULL, - NULL, - fsp->fsp_name->twrp, - fsp->fsp_name->flags); - if (smb_fname_base == NULL) { - errno = ENOMEM; - return -1; - } - - ret = vfs_stat(handle->conn, smb_fname_base); - *sbuf = smb_fname_base->st; - + ret = streams_xattr_stat_base( + handle, + fsp->fsp_name, + fsp->fsp_name->flags & SMB_FILENAME_POSIX_PATH); if (ret == -1) { - TALLOC_FREE(smb_fname_base); return -1; } + *sbuf = fsp->fsp_name->st; + sbuf->st_ex_size = get_xattr_size(handle->conn, - smb_fname_base, io->xattr_name); + fsp->fsp_name, io->xattr_name); if (sbuf->st_ex_size == -1) { - TALLOC_FREE(smb_fname_base); SET_STAT_INVALID(*sbuf); return -1; } @@ -250,7 +238,6 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, sbuf->st_ex_mode |= S_IFREG; sbuf->st_ex_blocks = sbuf->st_ex_size / STAT_ST_BLOCKSIZE + 1; - TALLOC_FREE(smb_fname_base); return 0; } |