io->base,
NULL,
NULL,
+ fsp->fsp_name->twrp,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
errno = ENOMEM;
int result = -1;
char *xattr_name = NULL;
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_STAT(handle, smb_fname);
}
/* Note if lp_posix_paths() is true, we can never
- * get here as is_ntfs_stream_smb_fname() is
+ * get here as is_named_stream() is
* always false. So we never need worry about
* not following links here. */
- /* If the default stream is requested, just stat the base file. */
- if (is_ntfs_default_stream_smb_fname(smb_fname)) {
- return streams_xattr_stat_base(handle, smb_fname, true);
- }
-
/* Populate the stat struct with info from the base file. */
if (streams_xattr_stat_base(handle, smb_fname, true) == -1) {
return -1;
int result = -1;
char *xattr_name = NULL;
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_LSTAT(handle, smb_fname);
}
- /* If the default stream is requested, just stat the base file. */
- if (is_ntfs_default_stream_smb_fname(smb_fname)) {
- return streams_xattr_stat_base(handle, smb_fname, false);
- }
-
/* Populate the stat struct with info from the base file. */
if (streams_xattr_stat_base(handle, smb_fname, false) == -1) {
return -1;
return result;
}
-static int streams_xattr_open(vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- files_struct *fsp, int flags, mode_t mode)
+static int streams_xattr_openat(struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ files_struct *fsp,
+ int flags,
+ mode_t mode)
{
NTSTATUS status;
struct streams_xattr_config *config = NULL;
bool set_empty_xattr = false;
int ret;
+ /*
+ * For now assert this, so the below SMB_VFS_SETXATTR() works.
+ */
+ SMB_ASSERT(dirfsp->fh->fd == AT_FDCWD);
+
SMB_VFS_HANDLE_GET_DATA(handle, config, struct streams_xattr_config,
return -1);
DEBUG(10, ("streams_xattr_open called for %s with flags 0x%x\n",
smb_fname_str_dbg(smb_fname), flags));
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
- return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
- }
-
- /* If the default stream is requested, just open the base file. */
- if (is_ntfs_default_stream_smb_fname(smb_fname)) {
- char *tmp_stream_name;
-
- tmp_stream_name = smb_fname->stream_name;
- smb_fname->stream_name = NULL;
-
- ret = SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
-
- smb_fname->stream_name = tmp_stream_name;
-
- return ret;
+ if (!is_named_stream(smb_fname)) {
+ return SMB_VFS_NEXT_OPENAT(handle,
+ dirfsp,
+ smb_fname,
+ fsp,
+ flags,
+ mode);
}
status = streams_xattr_get_name(handle, talloc_tos(),
DBG_DEBUG("streams_xattr_close called [%s] fd [%d]\n",
smb_fname_str_dbg(fsp->fsp_name), fd);
- if (!is_ntfs_stream_smb_fname(fsp->fsp_name)) {
- return SMB_VFS_NEXT_CLOSE(handle, fsp);
- }
-
- if (is_ntfs_default_stream_smb_fname(fsp->fsp_name)) {
+ if (!is_named_stream(fsp->fsp_name)) {
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
return ret;
}
-static int streams_xattr_unlink(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
+ struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ int flags)
{
NTSTATUS status;
int ret = -1;
char *xattr_name = NULL;
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
- return SMB_VFS_NEXT_UNLINK(handle, smb_fname);
- }
-
- /* 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;
-
- smb_fname_base = cp_smb_filename(talloc_tos(), smb_fname);
- if (smb_fname_base == NULL) {
- errno = ENOMEM;
- return -1;
- }
-
- ret = SMB_VFS_NEXT_UNLINK(handle, smb_fname_base);
-
- TALLOC_FREE(smb_fname_base);
- return ret;
+ if (!is_named_stream(smb_fname)) {
+ return SMB_VFS_NEXT_UNLINKAT(handle,
+ dirfsp,
+ smb_fname,
+ flags);
}
status = streams_xattr_get_name(handle, talloc_tos(),
smb_fname,
flags);
} else {
- ret = streams_xattr_unlink(handle,
- smb_fname);
+ ret = streams_xattr_unlink_internal(handle,
+ dirfsp,
+ smb_fname,
+ flags);
}
return ret;
}
sio->base,
NULL,
NULL,
+ fsp->fsp_name->twrp,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
errno = ENOMEM;
sio->base,
NULL,
NULL,
+ fsp->fsp_name->twrp,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
errno = ENOMEM;
sio->base,
NULL,
NULL,
+ fsp->fsp_name->twrp,
fsp->fsp_name->flags);
if (smb_fname_base == NULL) {
errno = ENOMEM;
mem_ctx, ppdesc);
}
- return SMB_VFS_NEXT_GET_NT_ACL(handle, fsp->base_fsp->fsp_name,
- security_info, mem_ctx, ppdesc);
+ return SMB_VFS_NEXT_GET_NT_ACL_AT(handle,
+ handle->conn->cwd_fsp,
+ fsp->base_fsp->fsp_name,
+ security_info,
+ mem_ctx,
+ ppdesc);
}
static NTSTATUS streams_xattr_fset_nt_acl(vfs_handle_struct *handle,
static int streams_xattr_kernel_flock(vfs_handle_struct *handle,
files_struct *fsp,
- uint32_t share_mode,
+ uint32_t share_access,
uint32_t access_mask)
{
struct stream_io *sio =
if (sio == NULL) {
return SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp,
- share_mode, access_mask);
+ share_access, access_mask);
}
return 0;
static struct vfs_fn_pointers vfs_streams_xattr_fns = {
.fs_capabilities_fn = streams_xattr_fs_capabilities,
.connect_fn = streams_xattr_connect,
- .open_fn = streams_xattr_open,
+ .openat_fn = streams_xattr_openat,
.close_fn = streams_xattr_close,
.stat_fn = streams_xattr_stat,
.fstat_fn = streams_xattr_fstat,
.pread_recv_fn = streams_xattr_pread_recv,
.pwrite_send_fn = streams_xattr_pwrite_send,
.pwrite_recv_fn = streams_xattr_pwrite_recv,
- .unlink_fn = streams_xattr_unlink,
.unlinkat_fn = streams_xattr_unlinkat,
.renameat_fn = streams_xattr_renameat,
.ftruncate_fn = streams_xattr_ftruncate,