summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_streams_xattr.c
diff options
context:
space:
mode:
authorTim Prouty <tprouty@samba.org>2009-07-02 09:27:44 -0700
committerTim Prouty <tprouty@samba.org>2009-07-06 15:38:36 -0700
commit258952aa85f2a68e2d2362522f6114c6a439f1e3 (patch)
tree696d8f4425cb6d82c95c0923ba1b0405d39a1f5e /source3/modules/vfs_streams_xattr.c
parent133e915a81510f543f6458f377857d4f1b680970 (diff)
downloadsamba-258952aa85f2a68e2d2362522f6114c6a439f1e3.tar.gz
samba-258952aa85f2a68e2d2362522f6114c6a439f1e3.tar.bz2
samba-258952aa85f2a68e2d2362522f6114c6a439f1e3.zip
s3: Plumb smb_filename through SMB_VFS_UNLINK
Diffstat (limited to 'source3/modules/vfs_streams_xattr.c')
-rw-r--r--source3/modules/vfs_streams_xattr.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 49f11a22ac..6137d01159 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -533,36 +533,42 @@ static int streams_xattr_open(vfs_handle_struct *handle,
return -1;
}
-static int streams_xattr_unlink(vfs_handle_struct *handle, const char *fname)
+static int streams_xattr_unlink(vfs_handle_struct *handle,
+ const struct smb_filename *smb_fname)
{
NTSTATUS status;
- char *base = NULL;
- char *sname = NULL;
int ret = -1;
char *xattr_name;
- if (!is_ntfs_stream_name(fname)) {
- return SMB_VFS_NEXT_UNLINK(handle, fname);
+ if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
}
- status = split_ntfs_stream_name(talloc_tos(), fname, &base, &sname);
- if (!NT_STATUS_IS_OK(status)) {
- errno = EINVAL;
- goto fail;
- }
+ /* If the default stream is requested, just open the base file. */
+ if (is_ntfs_default_stream_smb_fname(smb_fname)) {
+ struct smb_filename *smb_fname_base = NULL;
+
+ status = copy_smb_filename(talloc_tos(), smb_fname,
+ &smb_fname_base);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
+ return -1;
+ }
+
+ ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname_base);
- if (sname == NULL){
- return SMB_VFS_NEXT_UNLINK(handle, base);
+ TALLOC_FREE(smb_fname_base);
+ return ret;
}
- xattr_name = talloc_asprintf(talloc_tos(), "%s%s",
- SAMBA_XATTR_DOSSTREAM_PREFIX, sname);
- if (xattr_name == NULL) {
- errno = ENOMEM;
+ status = streams_xattr_get_name(talloc_tos(), smb_fname->stream_name,
+ &xattr_name);
+ if (!NT_STATUS_IS_OK(status)) {
+ errno = map_errno_from_nt_status(status);
goto fail;
}
- ret = SMB_VFS_REMOVEXATTR(handle->conn, base, xattr_name);
+ ret = SMB_VFS_REMOVEXATTR(handle->conn, smb_fname->base_name, xattr_name);
if ((ret == -1) && (errno == ENOATTR)) {
errno = ENOENT;
@@ -572,8 +578,7 @@ static int streams_xattr_unlink(vfs_handle_struct *handle, const char *fname)
ret = 0;
fail:
- TALLOC_FREE(base);
- TALLOC_FREE(sname);
+ TALLOC_FREE(xattr_name);
return ret;
}