vfs_streams_xattr: invalidate stat info if xattr was not found
authorRalph Boehme <slow@samba.org>
Thu, 11 May 2017 05:59:20 +0000 (07:59 +0200)
committerVolker Lendecke <vl@samba.org>
Wed, 9 Aug 2017 16:41:05 +0000 (18:41 +0200)
We stat the basefile so we leave valid stat info from the base file
behind, even though the xattr for the stream was not there.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12791

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/modules/vfs_streams_xattr.c

index 5114c094035e4c9bd95bec5ee8aa915ff4555c12..fc79935788d4ec1d2ca550342aca0ec13f852718 100644 (file)
@@ -269,6 +269,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
                                        smb_fname_base, io->xattr_name);
        if (sbuf->st_ex_size == -1) {
                TALLOC_FREE(smb_fname_base);
+               SET_STAT_INVALID(*sbuf);
                return -1;
        }
 
@@ -322,6 +323,7 @@ static int streams_xattr_stat(vfs_handle_struct *handle,
                                                  smb_fname,
                                                  xattr_name);
        if (smb_fname->st.st_ex_size == -1) {
+               SET_STAT_INVALID(smb_fname->st);
                errno = ENOENT;
                result = -1;
                goto fail;
@@ -373,6 +375,7 @@ static int streams_xattr_lstat(vfs_handle_struct *handle,
                                                  smb_fname,
                                                  xattr_name);
        if (smb_fname->st.st_ex_size == -1) {
+               SET_STAT_INVALID(smb_fname->st);
                errno = ENOENT;
                result = -1;
                goto fail;