diff options
Diffstat (limited to 'source3/modules')
-rw-r--r-- | source3/modules/onefs_streams.c | 48 | ||||
-rw-r--r-- | source3/modules/vfs_streams_xattr.c | 21 |
2 files changed, 12 insertions, 57 deletions
diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c index d33d9f30a2..ded7dc672d 100644 --- a/source3/modules/onefs_streams.c +++ b/source3/modules/onefs_streams.c @@ -25,35 +25,6 @@ #include <sys/isi_enc.h> -/* - * OneFS stores streams without the explicit :$DATA at the end, so this strips - * it off. All onefs_stream functions must call through this instead of - * split_ntfs_stream_name directly. - */ -NTSTATUS onefs_split_ntfs_stream_name(TALLOC_CTX *mem_ctx, const char *fname, - char **pbase, char **pstream) -{ - NTSTATUS status; - char *stream; - - status = split_ntfs_stream_name(mem_ctx, fname, pbase, pstream); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - /* Default $DATA stream. */ - if (pstream == NULL || *pstream == NULL) { - return NT_STATUS_OK; - } - - /* Strip off the $DATA. */ - stream = strrchr_m(*pstream, ':'); - SMB_ASSERT(stream); - stream[0] = '\0'; - - return NT_STATUS_OK; -} - NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx, const struct smb_filename *smb_fname_in, struct smb_filename **smb_fname_out) @@ -100,25 +71,6 @@ NTSTATUS onefs_stream_prep_smb_fname(TALLOC_CTX *ctx, return status; } -int onefs_is_stream(const char *path, char **pbase, char **pstream, - bool *is_stream) -{ - (*is_stream) = is_ntfs_stream_name(path); - - if (!(*is_stream)) { - return 0; - } - - if (!NT_STATUS_IS_OK(onefs_split_ntfs_stream_name(talloc_tos(), path, - pbase, pstream))) { - DEBUG(10, ("onefs_split_ntfs_stream_name failed\n")); - errno = ENOMEM; - return -1; - } - - return 0; -} - int onefs_close(vfs_handle_struct *handle, struct files_struct *fsp) { int ret2, ret = 0; diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 74b14ff93f..eccc2379c9 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -128,29 +128,29 @@ static NTSTATUS streams_xattr_get_name(TALLOC_CTX *ctx, static bool streams_xattr_recheck(struct stream_io *sio) { NTSTATUS status; - char *base = NULL; - char *sname = NULL; + struct smb_filename *smb_fname = NULL; char *xattr_name = NULL; if (sio->fsp->fsp_name == sio->fsp_name_ptr) { return true; } - status = split_ntfs_stream_name(talloc_tos(), sio->fsp->fsp_name, - &base, &sname); + status = create_synthetic_smb_fname_split(talloc_tos(), + sio->fsp->fsp_name, NULL, + &smb_fname); if (!NT_STATUS_IS_OK(status)) { return false; } - if (sname == NULL) { + if (smb_fname->stream_name == NULL) { /* how can this happen */ errno = EINVAL; return false; } - xattr_name = talloc_asprintf(talloc_tos(), "%s%s", - SAMBA_XATTR_DOSSTREAM_PREFIX, sname); - if (xattr_name == NULL) { + status = streams_xattr_get_name(talloc_tos(), smb_fname->stream_name, + &xattr_name); + if (!NT_STATUS_IS_OK(status)) { return false; } @@ -159,9 +159,12 @@ static bool streams_xattr_recheck(struct stream_io *sio) sio->xattr_name = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp), xattr_name); sio->base = talloc_strdup(VFS_MEMCTX_FSP_EXTENSION(sio->handle, sio->fsp), - base); + smb_fname->base_name); sio->fsp_name_ptr = sio->fsp->fsp_name; + TALLOC_FREE(smb_fname); + TALLOC_FREE(xattr_name); + if ((sio->xattr_name == NULL) || (sio->base == NULL)) { return false; } |