summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2022-06-17 17:51:35 -0700
committerNoel Power <npower@samba.org>2022-06-20 14:24:20 +0000
commit808a7b8b76dbcaac1db0508fd410d0bcf702af7a (patch)
tree278641356911447280b52979b878c25e5b65a8ba
parent238b2cbb8f352375c448d86b462f13752640e16b (diff)
downloadsamba-808a7b8b76dbcaac1db0508fd410d0bcf702af7a.tar.gz
s3: VFS: streams_xattr: Add the same accommodation to streams_xattr_unlinkat() as used in streams_xattr_renameat().
vfs_fruit passes a synthetic filename here where smb_fname->fsp==NULL when configured to use "fruit:resource = stream" so we need to use synthetic_pathref() to get an fsp on the smb_fname->base_name in order to call SMB_VFS_FREMOVEXATTR(). This is the same change we already use in streams_xattr_renameat() and streams_xattr_stat(), the other pathname operations we implement here. Remove knownfail. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15099 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Noel Power <npower@samba.org> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Mon Jun 20 14:24:20 UTC 2022 on sn-devel-184
-rw-r--r--selftest/knownfail.d/fruit_resource_stream1
-rw-r--r--source3/modules/vfs_streams_xattr.c25
2 files changed, 22 insertions, 4 deletions
diff --git a/selftest/knownfail.d/fruit_resource_stream b/selftest/knownfail.d/fruit_resource_stream
deleted file mode 100644
index 081edb983ee..00000000000
--- a/selftest/knownfail.d/fruit_resource_stream
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.blackbox.fruit.resource_stream.resource_stream\(fileserver\)
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 324490354b0..3e39770bb37 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -479,6 +479,8 @@ static int streams_xattr_unlinkat(vfs_handle_struct *handle,
NTSTATUS status;
int ret = -1;
char *xattr_name = NULL;
+ struct smb_filename *pathref = NULL;
+ struct files_struct *fsp = smb_fname->fsp;
if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_UNLINKAT(handle,
@@ -497,10 +499,26 @@ static int streams_xattr_unlinkat(vfs_handle_struct *handle,
goto fail;
}
- SMB_ASSERT(smb_fname->fsp != NULL);
- SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp));
+ if (fsp == NULL) {
+ status = synthetic_pathref(talloc_tos(),
+ handle->conn->cwd_fsp,
+ smb_fname->base_name,
+ NULL,
+ NULL,
+ smb_fname->twrp,
+ smb_fname->flags,
+ &pathref);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = ENOENT;
+ goto fail;
+ }
+ fsp = pathref->fsp;
+ } else {
+ SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp));
+ fsp = fsp->base_fsp;
+ }
- ret = SMB_VFS_FREMOVEXATTR(smb_fname->fsp->base_fsp, xattr_name);
+ ret = SMB_VFS_FREMOVEXATTR(fsp, xattr_name);
if ((ret == -1) && (errno == ENOATTR)) {
errno = ENOENT;
@@ -511,6 +529,7 @@ static int streams_xattr_unlinkat(vfs_handle_struct *handle,
fail:
TALLOC_FREE(xattr_name);
+ TALLOC_FREE(pathref);
return ret;
}