[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Fri Feb 11 21:54:01 UTC 2022
The branch, master has been updated
via 18437fd6a73 smbd: Simplify smbd_dirptr_lanman2_mode_fn()
via c8eb75cca53 torture: Align integer types
via b066dba462f ndrdump: Small simplification
via 60a72933213 libsmb: Use fstrcpy where possible
via 929ccd3d1af smbd: Safeguards for getpwuid
via 862fdc7cb83 vfstest: Align two integer types
via 30bbff383e7 vfs: Simplify streams_xattr_unlinkat()
via aacb3618c10 smbd: Use fsp_is_alternate_stream() where an fsp is available
via ac58b0b942c smbd: Introduce metadata_fsp()
via 21b380ca133 smbd: Introduce fsp_is_alternate_stream()
from 29f11005f56 wafsamba: replace 'echo -n' with printf
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 18437fd6a7393642b5f035b016b349988c8b9d83
Author: Volker Lendecke <vl at samba.org>
Date: Sun Jan 2 19:26:06 2022 +0100
smbd: Simplify smbd_dirptr_lanman2_mode_fn()
Avoid an else, we return in the "true" branch
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Fri Feb 11 21:53:22 UTC 2022 on sn-devel-184
commit c8eb75cca53c8ea9ebbec99bab6b085401495e81
Author: Volker Lendecke <vl at samba.org>
Date: Mon Feb 7 15:19:35 2022 +0100
torture: Align integer types
finfo.stream_info.out.num_streams is declared as "unsigned int"
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b066dba462f95eedbdd5e7d7d5edb5acaf1ec051
Author: Volker Lendecke <vl at samba.org>
Date: Mon Feb 7 10:11:36 2022 +0100
ndrdump: Small simplification
Remove the talloc_steal(), we can allocate on mem_ctx directly
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 60a72933213168904a4d4fe17fdaf59f2d0b35cc
Author: Volker Lendecke <vl at samba.org>
Date: Sun Feb 6 21:59:05 2022 +0100
libsmb: Use fstrcpy where possible
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 929ccd3d1afb864ea715fa4d3d8af8f997e5d2aa
Author: Volker Lendecke <vl at samba.org>
Date: Thu Feb 3 13:20:11 2022 +0100
smbd: Safeguards for getpwuid
Attempt to fix
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14900
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 862fdc7cb836b9209679379c64ed39ab6fbc5857
Author: Volker Lendecke <vl at samba.org>
Date: Thu Feb 3 15:23:45 2022 +0100
vfstest: Align two integer types
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 30bbff383e7f084ef7da7b14ba8a35d73a5da2f2
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 11 10:20:54 2022 +0100
vfs: Simplify streams_xattr_unlinkat()
It would be a logic error to call rmdir on a stream. This simplifies
the logic a bit.
Signed-off-by: Volker Lendecke <vl at samba.org>
commit aacb3618c10ec65056011c1366c1b82cba29cc89
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 11 09:59:16 2022 +0100
smbd: Use fsp_is_alternate_stream() where an fsp is available
Make it clear that being an alternate data stream handle is much more
a fsp property than a file name property.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit ac58b0b942cd73210100ee346816a0cf23900716
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 11 09:45:30 2022 +0100
smbd: Introduce metadata_fsp()
Centralize the pattern
if (fsp->base_fsp != NULL) {
fsp = fsp->base_fsp;
}
with a descriptive name.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit 21b380ca133417df096e2b262a5da41faff186ea
Author: Volker Lendecke <vl at samba.org>
Date: Fri Feb 11 09:37:35 2022 +0100
smbd: Introduce fsp_is_alternate_stream()
To me this is more descriptive than "fsp->base_fsp != NULL". If this
turns out to be a performance problem, I would go and make this a
static inline in smbd/proto.h.
Signed-off-by: Volker Lendecke <vl at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
librpc/tools/ndrdump.c | 7 +++----
source3/lib/adouble.c | 8 +++-----
source3/libsmb/libsmb_xattr.c | 2 +-
source3/modules/vfs_catia.c | 12 ++++++------
source3/modules/vfs_default.c | 18 +++++-------------
source3/modules/vfs_fake_acls.c | 9 +--------
source3/modules/vfs_fruit.c | 6 +++---
source3/modules/vfs_gpfs.c | 2 +-
source3/modules/vfs_shadow_copy2.c | 4 ++--
source3/modules/vfs_streams_xattr.c | 31 +++++++------------------------
source3/modules/vfs_virusfilter.c | 2 +-
source3/passdb/pdb_interface.c | 14 ++++++++++++--
source3/smbd/aio.c | 11 ++++-------
source3/smbd/close.c | 4 ++--
source3/smbd/dir.c | 5 +----
source3/smbd/durable.c | 2 +-
source3/smbd/file_access.c | 2 +-
source3/smbd/files.c | 19 ++++++++++++++++---
source3/smbd/nttrans.c | 21 ++++-----------------
source3/smbd/open.c | 7 ++++---
source3/smbd/proto.h | 2 ++
source3/smbd/reply.c | 10 ++++++----
source3/smbd/smb2_read.c | 2 +-
source3/smbd/smb2_server.c | 2 +-
source3/smbd/smb2_write.c | 3 +--
source3/smbd/trans2.c | 18 +++++++++---------
source3/smbd/vfs.c | 2 +-
source3/torture/cmd_vfs.c | 6 ++++--
source4/torture/smb2/streams.c | 4 ++--
29 files changed, 105 insertions(+), 130 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/tools/ndrdump.c b/librpc/tools/ndrdump.c
index b5d7f4fa3f6..0d39ed3714b 100644
--- a/librpc/tools/ndrdump.c
+++ b/librpc/tools/ndrdump.c
@@ -553,10 +553,9 @@ static void ndr_print_dummy(struct ndr_print *ndr, const char *format, ...)
blob = hexdump_to_data_blob(mem_ctx, (const char *)data, size);
} else if (base64_input) {
/* Use talloc_strndup() to ensure null termination */
- blob = base64_decode_data_blob(talloc_strndup(mem_ctx,
- (const char *)data, size));
- /* base64_decode_data_blob() allocates on NULL */
- talloc_steal(mem_ctx, blob.data);
+ blob = base64_decode_data_blob_talloc(
+ mem_ctx,
+ talloc_strndup(mem_ctx, (const char *)data, size));
} else {
blob = data_blob_const(data, size);
}
diff --git a/source3/lib/adouble.c b/source3/lib/adouble.c
index aa78007dadd..dda7a5ec05f 100644
--- a/source3/lib/adouble.c
+++ b/source3/lib/adouble.c
@@ -2143,9 +2143,7 @@ static ssize_t ad_read_meta(vfs_handle_struct *handle,
DEBUG(10, ("reading meta xattr for %s\n", smb_fname->base_name));
- if (fsp->base_fsp != NULL) {
- fsp = fsp->base_fsp;
- }
+ fsp = metadata_fsp(fsp);
ealen = SMB_VFS_FGETXATTR(fsp,
AFPINFO_EA_NETATALK,
@@ -2290,7 +2288,7 @@ NTSTATUS adouble_open_from_base_fsp(const struct files_struct *dirfsp,
*_ad_fsp = NULL;
SMB_ASSERT(base_fsp != NULL);
- SMB_ASSERT(base_fsp->base_fsp == NULL);
+ SMB_ASSERT(!fsp_is_alternate_stream(base_fsp));
switch (type) {
case ADOUBLE_META:
@@ -2590,7 +2588,7 @@ static struct adouble *ad_get_internal(TALLOC_CTX *ctx,
int mode;
if (fsp != NULL) {
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
smb_fname = fsp->base_fsp->fsp_name;
} else {
smb_fname = fsp->fsp_name;
diff --git a/source3/libsmb/libsmb_xattr.c b/source3/libsmb/libsmb_xattr.c
index aed3b486a3d..e0e328a9a69 100644
--- a/source3/libsmb/libsmb_xattr.c
+++ b/source3/libsmb/libsmb_xattr.c
@@ -764,7 +764,7 @@ cacl_get(SMBCCTX *context,
}
/* Copy name so we can strip off exclusions (if any are specified) */
- strncpy(name_sandbox, attr_name, sizeof(name_sandbox) - 1);
+ fstrcpy(name_sandbox, attr_name);
/* Ensure name is null terminated */
name_sandbox[sizeof(name_sandbox) - 1] = '\0';
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index c4d0e4dd7d8..f40bec3b74c 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -286,7 +286,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
if ((cc->fname != fsp->fsp_name->base_name)
||
- ((fsp->base_fsp != NULL) &&
+ (fsp_is_alternate_stream(fsp) &&
(cc->base_fname != fsp->base_fsp->fsp_name->base_name)))
{
CATIA_DEBUG_CC(10, cc, fsp);
@@ -312,7 +312,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
if ((cc->orig_fname != fsp->fsp_name->base_name)
||
- ((fsp->base_fsp != NULL) &&
+ (fsp_is_alternate_stream(fsp) &&
(cc->orig_base_fname != fsp->base_fsp->fsp_name->base_name)))
{
/*
@@ -331,7 +331,7 @@ static struct catia_cache *catia_validate_and_apply_cc(
* names from the cache and mark the cc as busy.
*/
fsp->fsp_name->base_name = cc->fname;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
fsp->base_fsp->fsp_name->base_name = cc->base_fname;
}
@@ -407,7 +407,7 @@ static int catia_fetch_fsp_pre_next(TALLOC_CTX *mem_ctx,
}
talloc_steal(mem_ctx, cc->fname);
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
status = catia_string_replace_allocate(
handle->conn,
fsp->base_fsp->fsp_name->base_name,
@@ -424,7 +424,7 @@ static int catia_fetch_fsp_pre_next(TALLOC_CTX *mem_ctx,
cc->orig_fname = fsp->fsp_name->base_name;
fsp->fsp_name->base_name = cc->fname;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
cc->orig_base_fname = fsp->base_fsp->fsp_name->base_name;
fsp->base_fsp->fsp_name->base_name = cc->base_fname;
}
@@ -472,7 +472,7 @@ static void catia_fetch_fsp_post_next(struct catia_cache **_cc,
*_cc = NULL;
fsp->fsp_name->base_name = cc->orig_fname;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
fsp->base_fsp->fsp_name->base_name = cc->orig_base_fname;
}
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 80c15bf2b58..49a73ab97f6 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2234,8 +2234,8 @@ static NTSTATUS vfswrap_offload_copy_file_range(struct tevent_req *req)
return NT_STATUS_MORE_PROCESSING_REQUIRED;
}
- if (is_named_stream(state->src_fsp->fsp_name) ||
- is_named_stream(state->dst_fsp->fsp_name))
+ if (fsp_is_alternate_stream(state->src_fsp) ||
+ fsp_is_alternate_stream(state->dst_fsp))
{
return NT_STATUS_MORE_PROCESSING_REQUIRED;
}
@@ -2761,7 +2761,7 @@ static int vfswrap_fntimes(vfs_handle_struct *handle,
START_PROFILE(syscall_fntimes);
- if (is_named_stream(fsp->fsp_name)) {
+ if (fsp_is_alternate_stream(fsp)) {
errno = ENOENT;
goto out;
}
@@ -3622,11 +3622,7 @@ static void vfswrap_getxattrat_do_sync(struct tevent_req *req)
{
struct vfswrap_getxattrat_state *state = tevent_req_data(
req, struct vfswrap_getxattrat_state);
- struct files_struct *fsp = state->smb_fname->fsp;
-
- if (fsp->base_fsp != NULL) {
- fsp = fsp->base_fsp;
- }
+ struct files_struct *fsp = metadata_fsp(state->smb_fname->fsp);
state->xattr_size = vfswrap_fgetxattr(state->handle,
fsp,
@@ -3649,11 +3645,7 @@ static void vfswrap_getxattrat_do_async(void *private_data)
struct timespec start_time;
struct timespec end_time;
int ret;
- struct files_struct *fsp = state->smb_fname->fsp;
-
- if (fsp->base_fsp != NULL) {
- fsp = fsp->base_fsp;
- }
+ struct files_struct *fsp = metadata_fsp(state->smb_fname->fsp);
PROFILE_TIMESTAMP(&start_time);
SMBPROFILE_BYTES_ASYNC_SET_BUSY(state->profile_bytes);
diff --git a/source3/modules/vfs_fake_acls.c b/source3/modules/vfs_fake_acls.c
index 25dc12f2c4c..402ac593aae 100644
--- a/source3/modules/vfs_fake_acls.c
+++ b/source3/modules/vfs_fake_acls.c
@@ -94,14 +94,7 @@ static int fake_acls_stat(vfs_handle_struct *handle,
}
if (smb_fname->fsp != NULL) {
- fsp = smb_fname->fsp;
- if (fsp->base_fsp != NULL) {
- /*
- * This is a stream pathname. Use
- * the base_fsp to get the xattr.
- */
- fsp = fsp->base_fsp;
- }
+ fsp = metadata_fsp(smb_fname->fsp);
} else {
NTSTATUS status;
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 303df41258e..e84c4c98d37 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -1473,7 +1473,7 @@ static int fruit_open_meta_netatalk(vfs_handle_struct *handle,
* We know this is a stream open, so fsp->base_fsp must
* already be open.
*/
- SMB_ASSERT(fsp->base_fsp != NULL);
+ SMB_ASSERT(fsp_is_alternate_stream(fsp));
SMB_ASSERT(fsp->base_fsp->fsp_name->fsp == fsp->base_fsp);
ad = ad_get(talloc_tos(), handle, fsp->base_fsp->fsp_name, ADOUBLE_META);
@@ -1870,7 +1870,7 @@ static int fruit_close(vfs_handle_struct *handle,
DBG_DEBUG("Path [%s] fd [%d]\n", smb_fname_str_dbg(fsp->fsp_name), fd);
- if (!is_named_stream(fsp->fsp_name)) {
+ if (!fsp_is_alternate_stream(fsp)) {
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
@@ -1963,7 +1963,7 @@ static int fruit_unlink_meta_netatalk(vfs_handle_struct *handle,
const struct smb_filename *smb_fname)
{
SMB_ASSERT(smb_fname->fsp != NULL);
- SMB_ASSERT(smb_fname->fsp->base_fsp != NULL);
+ SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp));
return SMB_VFS_FREMOVEXATTR(smb_fname->fsp->base_fsp,
AFPINFO_EA_NETATALK);
}
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index f6f162b3b57..52517ee0084 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -178,7 +178,7 @@ static int vfs_gpfs_filesystem_sharemode(vfs_handle_struct *handle,
* fd, so lacking a distinct fd for the stream we have to skip
* set_gpfs_sharemode for stream.
*/
- if (is_named_stream(fsp->fsp_name)) {
+ if (fsp_is_alternate_stream(fsp)) {
DBG_NOTICE("Not requesting GPFS sharemode on stream: %s/%s\n",
fsp->conn->connectpath,
fsp_str_dbg(fsp));
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index d61b3eac4b9..acd42d4942f 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1382,7 +1382,7 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
orig_smb_fname = fsp->fsp_name;
fsp->fsp_name = &vss_smb_fname;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
vss_base_smb_fname = *fsp->base_fsp->fsp_name;
vss_base_smb_fname.base_name = vss_smb_fname.base_name;
orig_base_smb_fname = fsp->base_fsp->fsp_name;
@@ -1407,7 +1407,7 @@ static int shadow_copy2_fstat(vfs_handle_struct *handle, files_struct *fsp,
out:
fsp->fsp_name = orig_smb_fname;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
fsp->base_fsp->fsp_name = orig_base_smb_fname;
}
diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c
index 682d492fee3..48fc1cd134b 100644
--- a/source3/modules/vfs_streams_xattr.c
+++ b/source3/modules/vfs_streams_xattr.c
@@ -182,7 +182,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
struct stream_io *io = (struct stream_io *)
VFS_FETCH_FSP_EXTENSION(handle, fsp);
- if (io == NULL || fsp->base_fsp == NULL) {
+ if (io == NULL || !fsp_is_alternate_stream(fsp)) {
return SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
}
@@ -464,7 +464,7 @@ static int streams_xattr_close(vfs_handle_struct *handle,
DBG_DEBUG("streams_xattr_close called [%s] fd [%d]\n",
smb_fname_str_dbg(fsp->fsp_name), fd);
- if (!is_named_stream(fsp->fsp_name)) {
+ if (!fsp_is_alternate_stream(fsp)) {
return SMB_VFS_NEXT_CLOSE(handle, fsp);
}
@@ -474,7 +474,7 @@ static int streams_xattr_close(vfs_handle_struct *handle,
return ret;
}
-static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
+static int streams_xattr_unlinkat(vfs_handle_struct *handle,
struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
int flags)
@@ -490,6 +490,9 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
flags);
}
+ /* A stream can never be rmdir'ed */
+ SMB_ASSERT((flags & AT_REMOVEDIR) == 0);
+
status = streams_xattr_get_name(handle, talloc_tos(),
smb_fname->stream_name, &xattr_name);
if (!NT_STATUS_IS_OK(status)) {
@@ -498,7 +501,7 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
}
SMB_ASSERT(smb_fname->fsp != NULL);
- SMB_ASSERT(smb_fname->fsp->base_fsp != NULL);
+ SMB_ASSERT(fsp_is_alternate_stream(smb_fname->fsp));
ret = SMB_VFS_FREMOVEXATTR(smb_fname->fsp->base_fsp, xattr_name);
@@ -514,26 +517,6 @@ static int streams_xattr_unlink_internal(vfs_handle_struct *handle,
return ret;
}
-static int streams_xattr_unlinkat(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- const struct smb_filename *smb_fname,
- int flags)
-{
- int ret;
- if (flags & AT_REMOVEDIR) {
- ret = SMB_VFS_NEXT_UNLINKAT(handle,
- dirfsp,
- smb_fname,
- flags);
- } else {
- ret = streams_xattr_unlink_internal(handle,
- dirfsp,
- smb_fname,
- flags);
- }
- return ret;
-}
-
static int streams_xattr_renameat(vfs_handle_struct *handle,
files_struct *srcfsp,
const struct smb_filename *smb_fname_src,
diff --git a/source3/modules/vfs_virusfilter.c b/source3/modules/vfs_virusfilter.c
index d1554967ad1..cbb93161a8a 100644
--- a/source3/modules/vfs_virusfilter.c
+++ b/source3/modules/vfs_virusfilter.c
@@ -1459,7 +1459,7 @@ static int virusfilter_vfs_close(
return close_result;
}
- if (is_named_stream(fsp->fsp_name)) {
+ if (fsp_is_alternate_stream(fsp)) {
if (config->scan_on_open && fsp->fsp_flags.modified) {
if (config->cache) {
DBG_DEBUG("Removing cache entry (if existent)"
diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c
index 3c4499a4459..b83cef1de37 100644
--- a/source3/passdb/pdb_interface.c
+++ b/source3/passdb/pdb_interface.c
@@ -1402,6 +1402,7 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
{
struct samu *sampw = NULL;
struct passwd *unix_pw;
+ fstring pw_name = { 0 };
bool ret;
unix_pw = getpwuid( uid );
@@ -1412,14 +1413,23 @@ static bool pdb_default_uid_to_sid(struct pdb_methods *methods, uid_t uid,
return False;
}
+ if (unix_pw->pw_name == NULL) {
+ DBG_DEBUG("No pw_name for uid %d\n", (int)uid);
+ return false;
+ }
+
+ /*
+ * Make a copy, "unix_pw" might go away soon.
+ */
+ fstrcpy(pw_name, unix_pw->pw_name);
+
if ( !(sampw = samu_new( NULL )) ) {
DEBUG(0,("pdb_default_uid_to_sid: samu_new() failed!\n"));
return False;
}
become_root();
- ret = NT_STATUS_IS_OK(
- methods->getsampwnam(methods, sampw, unix_pw->pw_name ));
+ ret = NT_STATUS_IS_OK(methods->getsampwnam(methods, sampw, pw_name));
unbecome_root();
if (!ret) {
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 95f18217868..0aa2b2fdfcc 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -171,8 +171,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (fsp->base_fsp != NULL) {
- /* No AIO on streams yet */
+ if (fsp_is_alternate_stream(fsp)) {
DEBUG(10, ("AIO on streams not yet supported\n"));
return NT_STATUS_RETRY;
}
@@ -443,8 +442,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
struct tevent_req *req;
- if (fsp->base_fsp != NULL) {
- /* No AIO on streams yet */
+ if (fsp_is_alternate_stream(fsp)) {
DEBUG(10, ("AIO on streams not yet supported\n"));
return NT_STATUS_RETRY;
}
@@ -693,8 +691,7 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
return NT_STATUS_INVALID_PARAMETER;
}
- if (fsp->base_fsp != NULL) {
- /* No AIO on streams yet */
+ if (fsp_is_alternate_stream(fsp)) {
DEBUG(10, ("AIO on streams not yet supported\n"));
return NT_STATUS_RETRY;
}
@@ -833,7 +830,7 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
size_t min_aio_write_size = lp_aio_write_size(SNUM(conn));
struct tevent_req *req;
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
/* No AIO on streams yet */
DEBUG(10, ("AIO on streams not yet supported\n"));
return NT_STATUS_RETRY;
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 206515202e0..c13826567d5 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -1520,12 +1520,12 @@ NTSTATUS close_file_smb(struct smb_request *req,
status = close_normal_file(req, fsp, close_type);
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
/*
* fsp was a stream, its base_fsp can't be a stream
* as well
*/
- SMB_ASSERT(fsp->base_fsp->base_fsp == NULL);
+ SMB_ASSERT(!fsp_is_alternate_stream(fsp->base_fsp));
/*
* There's a 1:1 relationship between fsp and a base_fsp
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 581ce5202ed..3cf6cb285a4 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1373,10 +1373,7 @@ bool is_visible_fsp(struct files_struct *fsp)
return true;
}
- if (fsp->base_fsp != NULL) {
- /* Only operate on non-stream files. */
- fsp = fsp->base_fsp;
- }
+ fsp = metadata_fsp(fsp);
/* Get the last component of the base name. */
last_component = strrchr_m(fsp->fsp_name->base_name, '/');
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index a49bca6fd61..e5dc86a5a7d 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -79,7 +79,7 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
return NT_STATUS_NOT_SUPPORTED;
}
- if (is_ntfs_stream_smb_fname(fsp->fsp_name)) {
+ if (fsp_is_alternate_stream(fsp)) {
/*
* We do not support durable handles
* on streams for now.
diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c
index 9193c650316..e3c8a1e2b67 100644
--- a/source3/smbd/file_access.c
+++ b/source3/smbd/file_access.c
@@ -228,7 +228,7 @@ NTSTATUS can_set_delete_on_close(files_struct *fsp, uint32_t dosmode)
/* Don't allow delete on close for non-empty directories. */
if (fsp->fsp_flags.is_directory) {
- SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name));
+ SMB_ASSERT(!fsp_is_alternate_stream(fsp));
/* Or the root of a share. */
if (ISDOT(fsp->fsp_name->base_name)) {
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 3fc1992ce4d..32c9f00547a 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -368,7 +368,7 @@ static int smb_fname_fsp_destructor(struct smb_filename *smb_fname)
return 0;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
--
Samba Shared Repository
More information about the samba-cvs
mailing list