*_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:
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;
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);
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)))
{
/*
* 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;
}
}
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,
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;
}
*_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;
}
* 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);
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);
}
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;
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;
}
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);
}
}
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);
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;
}
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;
}
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;
}
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;
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
return 0;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
struct files_struct *tmp_base_fsp = fsp->base_fsp;
fsp_set_base_fsp(fsp, NULL);
if (fsp == NULL) {
return status;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
struct files_struct *tmp_base_fsp = fsp->base_fsp;
fsp_set_base_fsp(fsp, NULL);
static bool close_file_in_loop(struct files_struct *fsp)
{
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
/*
* This is a stream, it can't be a base
*/
fsp->base_fsp->stream_fsp = fsp;
}
}
+
+bool fsp_is_alternate_stream(const struct files_struct *fsp)
+{
+ return (fsp->base_fsp != NULL);
+}
goto fail;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
struct files_struct *tmp_base_fsp = fsp->base_fsp;
fsp_set_base_fsp(fsp, NULL);
fsp->initial_allocation_size = 0;
}
- if ((info == FILE_WAS_CREATED) && lp_nt_acl_support(SNUM(conn)) &&
- fsp->base_fsp == NULL) {
+ if ((info == FILE_WAS_CREATED) &&
+ lp_nt_acl_support(SNUM(conn)) &&
+ !fsp_is_alternate_stream(fsp)) {
if (sd != NULL) {
/*
* According to the MS documentation, the only time the security
const struct smb_filename *smb_fname_in);
size_t fsp_fullbasepath(struct files_struct *fsp, char *buf, size_t buflen);
void fsp_set_base_fsp(struct files_struct *fsp, struct files_struct *base_fsp);
+bool fsp_is_alternate_stream(const struct files_struct *fsp);
NTSTATUS create_internal_fsp(connection_struct *conn,
const struct smb_filename *smb_fname,
* reply_readbraw has already checked the length.
*/
- if ( !req_is_in_chain(req) && (nread > 0) && (fsp->base_fsp == NULL) &&
- lp_use_sendfile(SNUM(conn), xconn->smb1.signing_state) ) {
+ if ( !req_is_in_chain(req) &&
+ (nread > 0) &&
+ !fsp_is_alternate_stream(fsp) &&
+ lp_use_sendfile(SNUM(conn), xconn->smb1.signing_state) ) {
ssize_t sendfile_read = -1;
char header[4];
DATA_BLOB header_blob;
if (!req_is_in_chain(req) &&
!req->encrypted &&
- (fsp->base_fsp == NULL) &&
+ !fsp_is_alternate_stream(fsp) &&
lp_use_sendfile(SNUM(conn), xconn->smb1.signing_state) ) {
uint8_t headerbuf[smb_size + 12 * 2 + 1 /* padding byte */];
DATA_BLOB header;
DEBUG(10,("is_valid_writeX_buffer: printing tid\n"));
return false;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
DEBUG(10,("is_valid_writeX_buffer: stream fsp\n"));
return false;
}
smb2req->do_signing ||
smb2req->do_encryption ||
smbd_smb2_is_compound(smb2req) ||
- (fsp->base_fsp != NULL) ||
+ fsp_is_alternate_stream(fsp) ||
(!S_ISREG(fsp->fsp_name->st.st_ex_mode)) ||
(state->in_offset >= fsp->fsp_name->st.st_ex_size) ||
(fsp->fsp_name->st.st_ex_size < state->in_offset + state->in_length))
if (IS_PRINT(fsp->conn)) {
return false;
}
- if (fsp->base_fsp != NULL) {
+ if (fsp_is_alternate_stream(fsp)) {
return false;
}
num_to_write = len - fsp->fsp_name->st.st_ex_size;
/* Only do this on non-stream file handles. */
- if (fsp->base_fsp == NULL) {
+ if (!fsp_is_alternate_stream(fsp)) {
/* for allocation try fallocate first. This can fail on some
* platforms e.g. when the filesystem doesn't support it and no
* emulation is being done by the libc (like on AIX with JFS1). In that