DBG_DEBUG("Path [%s]\n", smb_fname_str_dbg(smb_fname));
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
}
DBG_DEBUG("Path [%s] fd [%d]\n", smb_fname_str_dbg(fsp->fsp_name), fd);
- if (!is_ntfs_stream_smb_fname(fsp->fsp_name)) {
+ if (!is_named_stream(fsp->fsp_name)) {
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
dirfsp,
smb_fname,
false);
- } else if (is_ntfs_stream_smb_fname(smb_fname)) {
+ } else if (is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_UNLINKAT(handle,
dirfsp,
smb_fname,
DEBUG(10, ("fruit_stat called for %s\n",
smb_fname_str_dbg(smb_fname)));
- if (!is_ntfs_stream_smb_fname(smb_fname)
- || is_ntfs_default_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
rc = SMB_VFS_NEXT_STAT(handle, smb_fname);
if (rc == 0) {
update_btime(handle, smb_fname);
DEBUG(10, ("fruit_lstat called for %s\n",
smb_fname_str_dbg(smb_fname)));
- if (!is_ntfs_stream_smb_fname(smb_fname)
- || is_ntfs_default_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
rc = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
if (rc == 0) {
update_btime(handle, smb_fname);
if (global_fruit_config.nego_aapl &&
create_disposition == FILE_OPEN &&
smb_fname->st.st_ex_size == 0 &&
- is_ntfs_stream_smb_fname(smb_fname) &&
- !(is_ntfs_default_stream_smb_fname(smb_fname)))
+ is_named_stream(smb_fname))
{
status = NT_STATUS_OBJECT_NAME_NOT_FOUND;
goto fail;
fio->created = true;
}
- if (is_ntfs_stream_smb_fname(smb_fname)
+ if (is_named_stream(smb_fname)
|| fsp->is_directory) {
return status;
}
* fd, so lacking a distinct fd for the stream we have to skip
* kernel_flock and set_gpfs_sharemode for stream.
*/
- if (is_ntfs_stream_smb_fname(fsp->fsp_name) &&
- !is_ntfs_default_stream_smb_fname(fsp->fsp_name)) {
+ if (is_named_stream(fsp->fsp_name)) {
DEBUG(2,("%s: kernel_flock on stream\n", fsp_str_dbg(fsp)));
return 0;
}
return NT_STATUS_OK;
}
-/**
- * Helper to stat/lstat the base file of an smb_fname. This will actually
- * fills in the stat struct in smb_filename.
- */
-static int streams_depot_stat_base(vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- bool follow_links)
-{
- char *tmp_stream_name;
- int result;
-
- tmp_stream_name = smb_fname->stream_name;
- smb_fname->stream_name = NULL;
- if (follow_links) {
- result = SMB_VFS_NEXT_STAT(handle, smb_fname);
- } else {
- result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
- }
- smb_fname->stream_name = tmp_stream_name;
- return result;
-}
-
static int streams_depot_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
DEBUG(10, ("streams_depot_stat called for [%s]\n",
smb_fname_str_dbg(smb_fname)));
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_STAT(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_depot_stat_base(handle, smb_fname, true);
- }
-
/* Stat the actual stream now. */
status = stream_smb_fname(handle, smb_fname, &smb_fname_stream,
false);
DEBUG(10, ("streams_depot_lstat called for [%s]\n",
smb_fname_str_dbg(smb_fname)));
- 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_depot_stat_base(handle, smb_fname, false);
- }
-
/* Stat the actual stream now. */
status = stream_smb_fname(handle, smb_fname, &smb_fname_stream,
false);
NTSTATUS status;
int ret = -1;
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(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;
- }
-
/* Ensure the base file still exists. */
smb_fname_base = synthetic_smb_fname(talloc_tos(),
smb_fname->base_name,
smb_fname_str_dbg(smb_fname)));
/* If there is a valid stream, just unlink the stream and return. */
- if (is_ntfs_stream_smb_fname(smb_fname) &&
- !is_ntfs_default_stream_smb_fname(smb_fname)) {
+ if (is_named_stream(smb_fname)) {
struct smb_filename *smb_fname_stream = NULL;
NTSTATUS status;
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;
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)) {
+ if (!is_named_stream(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;
- }
-
status = streams_xattr_get_name(handle, talloc_tos(),
smb_fname->stream_name, &xattr_name);
if (!NT_STATUS_IS_OK(status)) {
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);
}
int ret = -1;
char *xattr_name = NULL;
- if (!is_ntfs_stream_smb_fname(smb_fname)) {
+ if (!is_named_stream(smb_fname)) {
return SMB_VFS_NEXT_UNLINKAT(handle,
dirfsp,
smb_fname,
flags);
}
- /* 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_UNLINKAT(handle,
- dirfsp,
- smb_fname_base,
- flags);
-
- TALLOC_FREE(smb_fname_base);
- return ret;
- }
-
status = streams_xattr_get_name(handle, talloc_tos(),
smb_fname->stream_name, &xattr_name);
if (!NT_STATUS_IS_OK(status)) {
size_t test_suffix;
int rename_trap_count = 0;
int ret;
- bool ok1, ok2;
+ bool ok1;
char *sret = NULL;
SMB_VFS_HANDLE_GET_DATA(handle, config,
rename_trap_count++;
}
- ok1 = is_ntfs_stream_smb_fname(smb_fname);
- ok2 = is_ntfs_default_stream_smb_fname(smb_fname);
- if (ok1 && !ok2) {
+ if (is_named_stream(smb_fname)) {
DBG_INFO("Not scanned: only file backed streams can be scanned:"
" %s/%s\n", cwd_fname, fname);
goto virusfilter_vfs_open_next;
int close_errno = 0;
virusfilter_result scan_result;
int scan_errno = 0;
- bool ok1, ok2;
SMB_VFS_HANDLE_GET_DATA(handle, config,
struct virusfilter_config, return -1);
return close_result;
}
- ok1 = is_ntfs_stream_smb_fname(fsp->fsp_name);
- ok2 = is_ntfs_default_stream_smb_fname(fsp->fsp_name);
- if (ok1 && !ok2) {
+ if (is_named_stream(fsp->fsp_name)) {
if (config->scan_on_open && fsp->modified) {
if (config->cache) {
DBG_DEBUG("Removing cache entry (if existent)"
* BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
*/
- if (is_ntfs_stream_smb_fname(smb_fname)) {
+ if (is_named_stream(smb_fname)) {
/* is_ntfs_stream_smb_fname() returns false for a POSIX path. */
- if (!is_ntfs_default_stream_smb_fname(smb_fname)) {
- /*
- * Non-default stream name, not a posix path.
- */
- dosmode &= ~(FILE_ATTRIBUTE_DIRECTORY);
- }
+ dosmode &= ~(FILE_ATTRIBUTE_DIRECTORY);
}
if (conn->fs_capabilities & FILE_FILE_COMPRESSION) {