From: Ralph Boehme Date: Thu, 2 Apr 2020 16:21:11 +0000 (+0200) Subject: smbd: move files_struct.is_directory to a bitfield X-Git-Tag: ldb-2.2.0~990 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb996cd5a3570e1cd6bf92776acd7c8cd22ebbfd;p=thirdparty%2Fsamba.git smbd: move files_struct.is_directory to a bitfield Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/include/vfs.h b/source3/include/vfs.h index 74d9aa17e43..a09e189cede 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -366,6 +366,7 @@ typedef struct files_struct { bool can_read : 1; bool can_write : 1; bool modified : 1; + bool is_directory : 1; } fsp_flags; struct tevent_timer *update_write_time_event; @@ -386,7 +387,6 @@ typedef struct files_struct { struct lock_struct last_lock_failure; int current_lock_count; /* Count the number of outstanding locks and pending locks. */ - bool is_directory; bool aio_write_behind; bool initial_delete_on_close; /* Only set at NTCreateX if file was created. */ bool delete_on_close; diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 7d71e436f4a..c2ccd669c71 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -179,7 +179,9 @@ NTSTATUS query_lock(files_struct *fsp, struct byte_range_lock *br_lck = NULL; if (!fsp->fsp_flags.can_lock) { - return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE; + return fsp->fsp_flags.is_directory ? + NT_STATUS_INVALID_DEVICE_REQUEST : + NT_STATUS_INVALID_HANDLE; } if (!lp_locking(fsp->conn->params)) { @@ -307,7 +309,7 @@ NTSTATUS do_lock(files_struct *fsp, } if (!fsp->fsp_flags.can_lock) { - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { return NT_STATUS_INVALID_DEVICE_REQUEST; } return NT_STATUS_INVALID_HANDLE; @@ -363,7 +365,9 @@ NTSTATUS do_unlock(files_struct *fsp, struct byte_range_lock *br_lck = NULL; if (!fsp->fsp_flags.can_lock) { - return fsp->is_directory ? NT_STATUS_INVALID_DEVICE_REQUEST : NT_STATUS_INVALID_HANDLE; + return fsp->fsp_flags.is_directory ? + NT_STATUS_INVALID_DEVICE_REQUEST : + NT_STATUS_INVALID_HANDLE; } if (!lp_locking(fsp->conn->params)) { @@ -929,7 +933,7 @@ bool set_delete_on_close(files_struct *fsp, bool delete_on_close, reset_delete_on_close_lck(fsp, lck); } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name)); send_stat_cache_delete_message(fsp->conn->sconn->msg_ctx, fsp->fsp_name->base_name); diff --git a/source3/modules/offload_token.c b/source3/modules/offload_token.c index c562f1bab0b..a5975811f5d 100644 --- a/source3/modules/offload_token.c +++ b/source3/modules/offload_token.c @@ -280,13 +280,13 @@ NTSTATUS vfs_offload_token_check_handles(uint32_t fsctl, return NT_STATUS_ACCESS_DENIED; } - if (src_fsp->is_directory) { + if (src_fsp->fsp_flags.is_directory) { DBG_INFO("copy chunk no read on src directory handle (%s).\n", smb_fname_str_dbg(src_fsp->fsp_name)); return NT_STATUS_ACCESS_DENIED; } - if (dst_fsp->is_directory) { + if (dst_fsp->fsp_flags.is_directory) { DBG_INFO("copy chunk no read on dst directory handle (%s).\n", smb_fname_str_dbg(dst_fsp->fsp_name)); return NT_STATUS_ACCESS_DENIED; diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 40071c85431..e4b99fdcf93 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -930,7 +930,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, return NT_STATUS_NO_MEMORY; } - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { /* We need to get the name of the directory containing the * file, this is where the AFS acls live */ char *p = strrchr(name, '/'); @@ -951,7 +951,7 @@ static NTSTATUS afs_set_nt_acl(vfs_handle_struct *handle, files_struct *fsp, split_afs_acl(&old_afs_acl, &dir_acl, &file_acl); - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { if (!strequal(fileacls, "yes")) { /* Throw away file acls, we depend on the diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 7af9ff655c1..2b625843187 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -380,7 +380,7 @@ static int ceph_snap_get_shadow_copy_data(struct vfs_handle_struct *handle, goto err_out; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { parent_dir = fsp->fsp_name->base_name; } else { ret = ceph_snap_get_parent_path(handle->conn->connectpath, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index ca1f000143a..42964c98499 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2987,7 +2987,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, struct stream_struct *tmp_streams = NULL; int ret; - if ((fsp != NULL) && (fsp->is_directory)) { + if ((fsp != NULL) && (fsp->fsp_flags.is_directory)) { /* * No default streams on directories */ diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c index 1d82b47045c..86870f8f9cf 100644 --- a/source3/modules/vfs_fruit.c +++ b/source3/modules/vfs_fruit.c @@ -3946,7 +3946,7 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle, fsp = *result; if (global_fruit_config.nego_aapl) { - if (config->posix_rename && fsp->is_directory) { + if (config->posix_rename && fsp->fsp_flags.is_directory) { /* * Enable POSIX directory rename behaviour */ @@ -3975,8 +3975,7 @@ static NTSTATUS fruit_create_file(vfs_handle_struct *handle, fio->created = true; } - if (is_named_stream(smb_fname) - || fsp->is_directory) { + if (is_named_stream(smb_fname) || fsp->fsp_flags.is_directory) { return status; } diff --git a/source3/modules/vfs_virusfilter.c b/source3/modules/vfs_virusfilter.c index 9dbe9b6348b..256bf420eb1 100644 --- a/source3/modules/vfs_virusfilter.c +++ b/source3/modules/vfs_virusfilter.c @@ -1158,7 +1158,7 @@ static int virusfilter_vfs_open( SMB_VFS_HANDLE_GET_DATA(handle, config, struct virusfilter_config, return -1); - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { DBG_INFO("Not scanned: Directory: %s/\n", cwd_fname); goto virusfilter_vfs_open_next; } @@ -1344,7 +1344,7 @@ static int virusfilter_vfs_close( goto virusfilter_vfs_close_fail; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { DBG_INFO("Not scanned: Directory: %s/\n", cwd_fname); return close_result; } diff --git a/source3/printing/printspoolss.c b/source3/printing/printspoolss.c index c397902592c..8943452c9d4 100644 --- a/source3/printing/printspoolss.c +++ b/source3/printing/printspoolss.c @@ -235,7 +235,7 @@ NTSTATUS print_spool_open(files_struct *fsp, fsp->fsp_flags.modified = false; fsp->oplock_type = NO_OPLOCK; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = false; + fsp->fsp_flags.is_directory = false; fsp->print_file = pf; diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 9a29bec4e7c..05ee03d2484 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -1243,7 +1243,7 @@ NTSTATUS close_file(struct smb_request *req, files_struct *fsp, NTSTATUS status; struct files_struct *base_fsp = fsp->base_fsp; - if(fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { status = close_directory(req, fsp, close_type); } else if (fsp->fake_file_handle != NULL) { status = close_fake_file(req, fsp); diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index d5cc5213da0..b080aeb18f8 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1376,7 +1376,7 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, goto fail; } - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { errno = EBADF; goto fail; } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index 148de405462..b9dbbbf58d6 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1152,7 +1152,7 @@ NTSTATUS file_set_sparse(connection_struct *conn, return NT_STATUS_ACCESS_DENIED; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { DEBUG(9, ("invalid attempt to %s sparse flag on dir %s\n", (sparse ? "set" : "clear"), smb_fname_str_dbg(fsp->fsp_name))); diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index d6e05c6245a..26537567e8e 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -70,7 +70,7 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp, return NT_STATUS_NOT_SUPPORTED; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { return NT_STATUS_NOT_SUPPORTED; } @@ -695,7 +695,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, /* * no durables for directories */ - fsp->is_directory = false; + fsp->fsp_flags.is_directory = false; /* * For normal files, can_lock == !is_directory */ diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index 66c9ed3add7..cc939325e62 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -231,7 +231,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->is_directory) { + if (fsp->fsp_flags.is_directory) { SMB_ASSERT(!is_ntfs_stream_smb_fname(fsp->fsp_name)); /* Or the root of a share. */ diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 5a0b5622096..7e2d12b8794 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -208,7 +208,7 @@ NTSTATUS create_internal_dirfsp_at(connection_struct *conn, fsp->file_id = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); fsp->access_mask = FILE_LIST_DIRECTORY; - fsp->is_directory = true; + fsp->fsp_flags.is_directory = true; *_fsp = fsp; return NT_STATUS_OK; @@ -794,7 +794,7 @@ NTSTATUS dup_file_fsp( CAN_WRITE(from->conn) && ((access_mask & (FILE_WRITE_DATA | FILE_APPEND_DATA)) != 0); to->fsp_flags.modified = from->fsp_flags.modified; - to->is_directory = from->is_directory; + to->fsp_flags.is_directory = from->fsp_flags.is_directory; to->aio_write_behind = from->aio_write_behind; return fsp_set_smb_fname(to, from->fsp_name); diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 38493d58c02..affedf5f527 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -719,12 +719,12 @@ void reply_ntcreate_and_X(struct smb_request *req) SSVAL(p,2,file_status); } p += 4; - SCVAL(p,0,fsp->is_directory ? 1 : 0); + SCVAL(p,0,fsp->fsp_flags.is_directory ? 1 : 0); if (flags & EXTENDED_RESPONSE_REQUIRED) { uint32_t perms = 0; p += 25; - if (fsp->is_directory || + if (fsp->fsp_flags.is_directory || fsp->fsp_flags.can_write || can_write_to_file(conn, smb_fname)) { perms = FILE_GENERIC_ALL; @@ -1374,12 +1374,12 @@ static void call_nt_transact_create(connection_struct *conn, SSVAL(p,2,file_status); } p += 4; - SCVAL(p,0,fsp->is_directory ? 1 : 0); + SCVAL(p,0,fsp->fsp_flags.is_directory ? 1 : 0); if (flags & EXTENDED_RESPONSE_REQUIRED) { uint32_t perms = 0; p += 25; - if (fsp->is_directory || + if (fsp->fsp_flags.is_directory || fsp->fsp_flags.can_write || can_write_to_file(conn, smb_fname)) { perms = FILE_GENERIC_ALL; @@ -1837,7 +1837,7 @@ static void call_nt_transact_notify_change(connection_struct *conn, TALLOC_FREE(filter_string); } - if((!fsp->is_directory) || (conn != fsp->conn)) { + if((!fsp->fsp_flags.is_directory) || (conn != fsp->conn)) { reply_nterror(req, NT_STATUS_INVALID_PARAMETER); return; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ffb3ea5f9d1..63018759dfb 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -614,7 +614,7 @@ static int non_widelink_open(struct connection_struct *conn, const char *final_component = NULL; bool ok; - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { parent_dir = talloc_strdup(talloc_tos(), smb_fname->base_name); if (parent_dir == NULL) { saved_errno = errno; @@ -1437,7 +1437,7 @@ static NTSTATUS open_file(files_struct *fsp, fsp->print_file = NULL; fsp->fsp_flags.modified = false; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = False; + fsp->fsp_flags.is_directory = false; if (conn->aio_write_behind_list && is_in_path(smb_fname->base_name, conn->aio_write_behind_list, conn->case_sensitive)) { @@ -4405,7 +4405,7 @@ static NTSTATUS open_directory(connection_struct *conn, fsp->fsp_flags.modified = false; fsp->oplock_type = NO_OPLOCK; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = True; + fsp->fsp_flags.is_directory = true; if (file_attributes & FILE_FLAG_POSIX_SEMANTICS) { fsp->posix_flags |= FSP_POSIX_FLAGS_ALL; } @@ -4863,7 +4863,7 @@ static NTSTATUS inherit_new_acl(files_struct *fsp) } inheritable_components = sd_has_inheritable_components(parent_desc, - fsp->is_directory); + fsp->fsp_flags.is_directory); if (!inheritable_components && !inherit_owner) { TALLOC_FREE(frame); @@ -4984,7 +4984,7 @@ static NTSTATUS inherit_new_acl(files_struct *fsp) parent_desc, owner_sid, group_sid, - fsp->is_directory); + fsp->fsp_flags.is_directory); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(frame); return status; @@ -5637,7 +5637,9 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } } - if (!fsp->is_directory && S_ISDIR(fsp->fsp_name->st.st_ex_mode)) { + if (!fsp->fsp_flags.is_directory && + S_ISDIR(fsp->fsp_name->st.st_ex_mode)) + { status = NT_STATUS_ACCESS_DENIED; goto fail; } @@ -5645,7 +5647,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, /* Save the requested allocation size. */ if ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN)) { if ((allocation_size > (uint64_t)fsp->fsp_name->st.st_ex_size) - && !(fsp->is_directory)) + && !(fsp->fsp_flags.is_directory)) { fsp->initial_allocation_size = smb_roundup( fsp->conn, allocation_size); @@ -5782,7 +5784,7 @@ static NTSTATUS get_relative_fid_filename( goto out; } - if (!dir_fsp->is_directory) { + if (!dir_fsp->fsp_flags.is_directory) { /* * Check to see if this is a mac fork of some kind. diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c index e5ea3057486..7e64965d85e 100644 --- a/source3/smbd/posix_acls.c +++ b/source3/smbd/posix_acls.c @@ -1707,7 +1707,7 @@ static bool add_current_ace_to_acl(files_struct *fsp, struct security_ace *psa, * DLIST_ADD_END) as NT ACLs are order dependent. */ - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { /* * We can only add to the default POSIX ACE list if the ACE is @@ -1870,7 +1870,7 @@ static bool create_canon_ace_lists(files_struct *fsp, canon_ace **ppdir_ace, const struct security_acl *dacl) { - bool all_aces_are_inherit_only = (fsp->is_directory ? True : False); + bool all_aces_are_inherit_only = (fsp->fsp_flags.is_directory); canon_ace *file_ace = NULL; canon_ace *dir_ace = NULL; canon_ace *current_ace = NULL; @@ -2131,7 +2131,7 @@ static bool create_canon_ace_lists(files_struct *fsp, } } - if (fsp->is_directory && all_aces_are_inherit_only) { + if (fsp->fsp_flags.is_directory && all_aces_are_inherit_only) { /* * Windows 2000 is doing one of these weird 'inherit acl' * traverses to conserve NTFS ACL resources. Just pretend @@ -2558,7 +2558,7 @@ static bool unpack_canon_ace(files_struct *fsp, &file_ace, false, fsp->conn->params, - fsp->is_directory, + fsp->fsp_flags.is_directory, pfile_owner_sid, pfile_grp_sid, pst); @@ -2576,7 +2576,7 @@ static bool unpack_canon_ace(files_struct *fsp, &dir_ace, true, fsp->conn->params, - fsp->is_directory, + fsp->fsp_flags.is_directory, pfile_owner_sid, pfile_grp_sid, pst); @@ -3026,7 +3026,7 @@ static bool set_canon_ace_list(files_struct *fsp, * Finally apply it to the file or directory. */ - if(default_ace || fsp->is_directory || fsp->fh->fd == -1) { + if (default_ace || fsp->fsp_flags.is_directory || fsp->fh->fd == -1) { if (SMB_VFS_SYS_ACL_SET_FILE(conn, fsp->fsp_name, the_acl_type, the_acl) == -1) { /* @@ -3215,7 +3215,7 @@ static bool convert_canon_ace_to_posix_perms( files_struct *fsp, canon_ace *file /* The owner must have at least read access. */ *posix_perms |= S_IRUSR; - if (fsp->is_directory) + if (fsp->fsp_flags.is_directory) *posix_perms |= (S_IWUSR|S_IXUSR); DEBUG(10,("convert_canon_ace_to_posix_perms: converted u=%o,g=%o,w=%o " @@ -3490,7 +3490,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info, fsp_str_dbg(fsp))); /* can it happen that fsp_name == NULL ? */ - if (fsp->is_directory || fsp->fh->fd == -1) { + if (fsp->fsp_flags.is_directory || fsp->fh->fd == -1) { status = posix_get_nt_acl(fsp->conn, fsp->fsp_name, security_info, mem_ctx, ppdesc); TALLOC_FREE(frame); @@ -3878,7 +3878,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct } } - if (acl_perms && acl_set_support && fsp->is_directory) { + if (acl_perms && acl_set_support && fsp->fsp_flags.is_directory) { if (dir_ace_list) { if (set_acl_as_root) { become_root(); @@ -4380,7 +4380,7 @@ NTSTATUS set_unix_posix_default_acl(connection_struct *conn, NTSTATUS status; int ret; - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { return NT_STATUS_INVALID_HANDLE; } @@ -4781,7 +4781,7 @@ int posix_sys_acl_blob_get_fd(vfs_handle_struct *handle, int ret; /* This ensures that we also consider the default ACL */ - if (fsp->is_directory || fsp->fh->fd == -1) { + if (fsp->fsp_flags.is_directory || fsp->fh->fd == -1) { return posix_sys_acl_blob_get_file(handle, fsp->fsp_name, mem_ctx, diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index d9d4a6143cc..d3a701dcc32 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -199,7 +199,7 @@ static NTSTATUS init_files_struct(TALLOC_CTX *mem_ctx, fsp->print_file = NULL; fsp->fsp_flags.modified = false; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = S_ISDIR(smb_fname->st.st_ex_mode); + fsp->fsp_flags.is_directory = S_ISDIR(smb_fname->st.st_ex_mode); *_fsp = fsp; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 7c9900d763c..a2d621db1c3 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -500,7 +500,7 @@ bool check_fsp(connection_struct *conn, struct smb_request *req, if (!check_fsp_open(conn, req, fsp)) { return False; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { reply_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST); return False; } @@ -524,7 +524,7 @@ bool check_fsp_ntquota_handle(connection_struct *conn, struct smb_request *req, return false; } - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { return false; } @@ -4003,7 +4003,7 @@ void reply_readbraw(struct smb_request *req) conn == NULL || conn != fsp->conn || req->vuid != fsp->vuid || - fsp->is_directory || + fsp->fsp_flags.is_directory || fsp->fh->fd == -1) { /* @@ -6032,11 +6032,12 @@ void reply_close(struct smb_request *smb1req) } DBG_NOTICE("Close %s fd=%d %s (numopen=%d)\n", - fsp->is_directory ? "directory" : "file", + fsp->fsp_flags.is_directory ? + "directory" : "file", fsp->fh->fd, fsp_fnum_dbg(fsp), conn->num_files_open); - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { time_t t; /* @@ -7830,7 +7831,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, "%s -> %s\n", smb_fname_str_dbg(fsp->fsp_name), smb_fname_str_dbg(smb_fname_dst))); - if (!fsp->is_directory && + if (!fsp->fsp_flags.is_directory && !(fsp->posix_flags & FSP_POSIX_FLAGS_PATHNAMES) && (lp_map_archive(SNUM(conn)) || lp_store_dos_attributes(SNUM(conn)))) { @@ -7848,7 +7849,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn, } notify_rename(conn, - fsp->is_directory, + fsp->fsp_flags.is_directory, fsp->fsp_name, smb_fname_dst); diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c index 677877ca62f..14eb3750e36 100644 --- a/source3/smbd/smb2_flush.c +++ b/source3/smbd/smb2_flush.c @@ -152,7 +152,7 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx, bool allow_dir_flush = false; uint32_t flush_access = FILE_ADD_FILE | FILE_ADD_SUBDIRECTORY; - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { tevent_req_nterror(req, NT_STATUS_ACCESS_DENIED); return tevent_req_post(req, ev); } diff --git a/source3/smbd/smb2_notify.c b/source3/smbd/smb2_notify.c index 68429b7b766..200a6e85d9a 100644 --- a/source3/smbd/smb2_notify.c +++ b/source3/smbd/smb2_notify.c @@ -255,7 +255,7 @@ static struct tevent_req *smbd_smb2_notify_send(TALLOC_CTX *mem_ctx, TALLOC_FREE(filter_string); } - if ((!fsp->is_directory) || (conn != fsp->conn)) { + if ((!fsp->fsp_flags.is_directory) || (conn != fsp->conn)) { tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); return tevent_req_post(req, ev); } diff --git a/source3/smbd/smb2_query_directory.c b/source3/smbd/smb2_query_directory.c index 1c7d4e91c97..28c4b51fbf9 100644 --- a/source3/smbd/smb2_query_directory.c +++ b/source3/smbd/smb2_query_directory.c @@ -293,7 +293,7 @@ static struct tevent_req *smbd_smb2_query_directory_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { tevent_req_nterror(req, NT_STATUS_NOT_SUPPORTED); return tevent_req_post(req, ev); } diff --git a/source3/smbd/smb2_read.c b/source3/smbd/smb2_read.c index e84584349ab..3441ac27c0c 100644 --- a/source3/smbd/smb2_read.c +++ b/source3/smbd/smb2_read.c @@ -475,7 +475,7 @@ static struct tevent_req *smbd_smb2_read_send(TALLOC_CTX *mem_ctx, } state->smbreq = smbreq; - if (fsp->is_directory) { + if (fsp->fsp_flags.is_directory) { tevent_req_nterror(req, NT_STATUS_INVALID_DEVICE_REQUEST); return tevent_req_post(req, ev); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 380b276e759..19706d32bd5 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -5003,7 +5003,7 @@ static NTSTATUS smb_query_posix_acl(connection_struct *conn, * We can only have default POSIX ACLs on * directories. */ - if (!fsp->is_directory) { + if (!fsp->fsp_flags.is_directory) { DBG_INFO("Non-directory open %s\n", fsp_str_dbg(fsp)); status = NT_STATUS_INVALID_HANDLE; @@ -7598,7 +7598,7 @@ static NTSTATUS smb_set_posix_acl(connection_struct *conn, } /* If we have a default acl, this *must* be a directory. */ - if (valid_def_acls && !fsp->is_directory) { + if (valid_def_acls && !fsp->fsp_flags.is_directory) { DBG_INFO("Can't set default acls on " "non-directory %s\n", fsp_str_dbg(fsp)); diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index e66f5d44d96..263f4da2660 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -428,7 +428,7 @@ static NTSTATUS cmd_open(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c fsp->print_file = NULL; fsp->fsp_flags.modified = false; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = False; + fsp->fsp_flags.is_directory = false; vfs->files[fsp->fh->fd] = fsp; printf("open: fd=%d\n", fsp->fh->fd); @@ -1656,8 +1656,7 @@ static NTSTATUS cmd_set_nt_acl(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int a fsp->print_file = NULL; fsp->fsp_flags.modified = false; fsp->sent_oplock_break = NO_BREAK_SENT; - fsp->is_directory = S_ISDIR(smb_fname->st.st_ex_mode); - + fsp->fsp_flags.is_directory = S_ISDIR(smb_fname->st.st_ex_mode); sd = sddl_decode(talloc_tos(), argv[2], get_global_sam_sid()); if (!sd) {