The Samba-Bugzilla – Attachment 12969 Details for
Bug 12591
vfs_streams_xattr: use fsp, not base_fsp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.6.next, 4.5.next, 4.4.next
0001-vfs_streams_xattr-use-fsp-not-base_fsp.patch (text/plain), 4.76 KB, created by
Jeremy Allison
on 2017-02-22 18:13:58 UTC
(
hide
)
Description:
git-am fix for 4.6.next, 4.5.next, 4.4.next
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2017-02-22 18:13:58 UTC
Size:
4.76 KB
patch
obsolete
>From 6b19c1fb74d5fd8f61a0ae435da20625e5aec02b Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Fri, 17 Feb 2017 08:10:53 +0100 >Subject: [PATCH] vfs_streams_xattr: use fsp, not base_fsp > >The base_fsp's fd is always -1 as it's closed after being openend in >create_file_unixpath(). > >Additionally in streams_xattr_open force using of SMB_VFS_FSETXATTR() by >sticking the just created fd into the fsp (and removing it afterwards). > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12591 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Jeremy Allison <jra@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Wed Feb 22 08:25:46 CET 2017 on sn-devel-144 > >(cherry picked from commit 021189e32ba507832b5e821e5cda8a2889225955) >--- > source3/modules/vfs_streams_xattr.c | 41 +++++++++++++++---------------------- > 1 file changed, 17 insertions(+), 24 deletions(-) > >diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c >index d3c988c9c5e..6a7f3e67341 100644 >--- a/source3/modules/vfs_streams_xattr.c >+++ b/source3/modules/vfs_streams_xattr.c >@@ -264,7 +264,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp, > return -1; > } > >- sbuf->st_ex_size = get_xattr_size(handle->conn, fsp->base_fsp, >+ sbuf->st_ex_size = get_xattr_size(handle->conn, fsp, > io->base, io->xattr_name); > if (sbuf->st_ex_size == -1) { > return -1; >@@ -399,6 +399,7 @@ static int streams_xattr_open(vfs_handle_struct *handle, > char *xattr_name = NULL; > int baseflags; > int hostfd = -1; >+ int ret; > > DEBUG(10, ("streams_xattr_open called for %s with flags 0x%x\n", > smb_fname_str_dbg(smb_fname), flags)); >@@ -410,7 +411,6 @@ static int streams_xattr_open(vfs_handle_struct *handle, > /* If the default stream is requested, just open the base file. */ > if (is_ntfs_default_stream_smb_fname(smb_fname)) { > char *tmp_stream_name; >- int ret; > > tmp_stream_name = smb_fname->stream_name; > smb_fname->stream_name = NULL; >@@ -500,20 +500,13 @@ static int streams_xattr_open(vfs_handle_struct *handle, > DEBUG(10, ("creating or truncating attribute %s on file %s\n", > xattr_name, smb_fname->base_name)); > >- if (fsp->base_fsp->fh->fd != -1) { >- if (SMB_VFS_FSETXATTR( >- fsp->base_fsp, xattr_name, >+ fsp->fh->fd = hostfd; >+ ret = SMB_VFS_FSETXATTR(fsp, xattr_name, > &null, sizeof(null), >- flags & O_EXCL ? XATTR_CREATE : 0) == -1) { >- goto fail; >- } >- } else { >- if (SMB_VFS_SETXATTR( >- handle->conn, smb_fname->base_name, >- xattr_name, &null, sizeof(null), >- flags & O_EXCL ? XATTR_CREATE : 0) == -1) { >- goto fail; >- } >+ flags & O_EXCL ? XATTR_CREATE : 0); >+ fsp->fh->fd = -1; >+ if (ret != 0) { >+ goto fail; > } > } > >@@ -968,7 +961,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, > return -1; > } > >- status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp, >+ status = get_ea_value(talloc_tos(), handle->conn, fsp, > sio->base, sio->xattr_name, &ea); > if (!NT_STATUS_IS_OK(status)) { > return -1; >@@ -992,13 +985,13 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, > > memcpy(ea.value.data + offset, data, n); > >- if (fsp->base_fsp->fh->fd != -1) { >- ret = SMB_VFS_FSETXATTR(fsp->base_fsp, >+ if (fsp->fh->fd != -1) { >+ ret = SMB_VFS_FSETXATTR(fsp, > sio->xattr_name, > ea.value.data, ea.value.length, 0); > } else { > ret = SMB_VFS_SETXATTR(fsp->conn, >- fsp->base_fsp->fsp_name->base_name, >+ fsp->fsp_name->base_name, > sio->xattr_name, > ea.value.data, ea.value.length, 0); > } >@@ -1032,7 +1025,7 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle, > return -1; > } > >- status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp, >+ status = get_ea_value(talloc_tos(), handle->conn, fsp, > sio->base, sio->xattr_name, &ea); > if (!NT_STATUS_IS_OK(status)) { > return -1; >@@ -1077,7 +1070,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle, > return -1; > } > >- status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp, >+ status = get_ea_value(talloc_tos(), handle->conn, fsp, > sio->base, sio->xattr_name, &ea); > if (!NT_STATUS_IS_OK(status)) { > return -1; >@@ -1102,13 +1095,13 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle, > ea.value.length = offset + 1; > ea.value.data[offset] = 0; > >- if (fsp->base_fsp->fh->fd != -1) { >- ret = SMB_VFS_FSETXATTR(fsp->base_fsp, >+ if (fsp->fh->fd != -1) { >+ ret = SMB_VFS_FSETXATTR(fsp, > sio->xattr_name, > ea.value.data, ea.value.length, 0); > } else { > ret = SMB_VFS_SETXATTR(fsp->conn, >- fsp->base_fsp->fsp_name->base_name, >+ fsp->fsp_name->base_name, > sio->xattr_name, > ea.value.data, ea.value.length, 0); > } >-- >2.11.0.483.g087da7b7c-goog >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review+
Actions:
View
Attachments on
bug 12591
:
12957
| 12969