struct timespec *out_change_ts,
uint16_t *out_flags,
uint64_t *out_allocation_size,
- uint64_t *out_end_of_file,
- uint32_t *out_file_attributes)
+ uint64_t *out_end_of_file)
{
- NTSTATUS status;
-
- status = openat_pathref_fsp(conn->cwd_fsp, smb_fname);
- if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND) &&
- (smb_fname->flags & SMB_FILENAME_POSIX_PATH) &&
- S_ISLNK(smb_fname->st.st_ex_mode))
- {
- status = NT_STATUS_OK;
- }
- if (!NT_STATUS_IS_OK(status)) {
- return;
- }
-
*out_flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION;
- *out_file_attributes = fdos_mode(smb_fname->fsp);
*out_last_write_ts = smb_fname->st.st_ex_mtime;
*out_last_access_ts = smb_fname->st.st_ex_atime;
*out_creation_ts = get_create_timespec(conn, NULL, smb_fname);
dos_filetime_timespec(out_last_access_ts);
dos_filetime_timespec(out_change_ts);
}
- if (!(*out_file_attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ if (!S_ISDIR(smb_fname->st.st_ex_mode)) {
*out_end_of_file = get_file_size_stat(&smb_fname->st);
}
connection_struct *conn = req->tcon->compat;
struct files_struct *fsp = *_fsp;
struct smb_filename *smb_fname = NULL;
- uint64_t allocation_size = 0;
- uint64_t file_size = 0;
- uint32_t dos_attrs = 0;
- uint16_t flags = 0;
*out_creation_ts = (struct timespec){0, SAMBA_UTIME_OMIT};
*out_last_access_ts = (struct timespec){0, SAMBA_UTIME_OMIT};
return NT_STATUS_NO_MEMORY;
}
- smb_fname = cp_smb_filename(talloc_tos(), fsp->fsp_name);
- if (smb_fname == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- if ((in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) &&
- (fsp->fsp_flags.initial_delete_on_close ||
- fsp->fsp_flags.delete_on_close))
- {
- /*
- * We might be deleting the file. Ensure we
- * return valid data from before the file got
- * removed.
- */
- setup_close_full_information(conn,
- smb_fname,
- out_creation_ts,
- out_last_access_ts,
- out_last_write_ts,
- out_change_ts,
- &flags,
- &allocation_size,
- &file_size,
- &dos_attrs);
+ if (in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) {
+ *out_file_attributes = fdos_mode(fsp);
+ fsp->fsp_flags.fstat_before_close = true;
}
- status = close_file_free(smbreq, &fsp, NORMAL_CLOSE);
+ status = close_file_smb(smbreq, fsp, NORMAL_CLOSE);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(5,("smbd_smb2_close: close_file[%s]: %s\n",
smb_fname_str_dbg(smb_fname), nt_errstr(status)));
if (in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) {
setup_close_full_information(conn,
- smb_fname,
+ fsp->fsp_name,
out_creation_ts,
out_last_access_ts,
out_last_write_ts,
out_change_ts,
- &flags,
- &allocation_size,
- &file_size,
- &dos_attrs);
+ out_flags,
+ out_allocation_size,
+ out_end_of_file);
}
- *out_flags = flags;
- *out_allocation_size = allocation_size;
- *out_end_of_file = file_size;
- *out_file_attributes = dos_attrs;
-
+ file_free(smbreq, fsp);
+ *_fsp = fsp = NULL;
return NT_STATUS_OK;
}