summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-11-22 10:28:52 -0800
committerJeremy Allison <jra@samba.org>2011-11-22 10:28:52 -0800
commit12514bf008044f836e62b46b8fea1ef3117d7632 (patch)
tree6cc5ce37ffd6b1902e63fb31db3e15783d458a11 /source3
parentd5d17f0f5745bc9c62f8a293f2d7059ad199fa1e (diff)
downloadsamba-12514bf008044f836e62b46b8fea1ef3117d7632.tar.gz
samba-12514bf008044f836e62b46b8fea1ef3117d7632.tar.bz2
samba-12514bf008044f836e62b46b8fea1ef3117d7632.zip
Move the add security descriptor code to *after* all the other meta-data is
updated. We may be adding an SD that restricts our own access.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/open.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 575503fa62..8be5e85270 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -3422,6 +3422,41 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
fsp->base_fsp = base_fsp;
+ if ((ea_list != NULL) &&
+ ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN))) {
+ status = set_ea(conn, fsp, fsp->fsp_name, ea_list);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto fail;
+ }
+ }
+
+ if (!fsp->is_directory && S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
+ status = NT_STATUS_ACCESS_DENIED;
+ goto fail;
+ }
+
+ /* Save the requested allocation size. */
+ if ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN)) {
+ if (allocation_size
+ && (allocation_size > fsp->fsp_name->st.st_ex_size)) {
+ fsp->initial_allocation_size = smb_roundup(
+ fsp->conn, allocation_size);
+ if (fsp->is_directory) {
+ /* Can't set allocation size on a directory. */
+ status = NT_STATUS_ACCESS_DENIED;
+ goto fail;
+ }
+ if (vfs_allocate_file_space(
+ fsp, fsp->initial_allocation_size) == -1) {
+ status = NT_STATUS_DISK_FULL;
+ goto fail;
+ }
+ } else {
+ fsp->initial_allocation_size = smb_roundup(
+ fsp->conn, (uint64_t)fsp->fsp_name->st.st_ex_size);
+ }
+ }
+
/*
* According to the MS documentation, the only time the security
* descriptor is applied to the opened file is iff we *created* the
@@ -3461,41 +3496,6 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
}
}
- if ((ea_list != NULL) &&
- ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN))) {
- status = set_ea(conn, fsp, fsp->fsp_name, ea_list);
- if (!NT_STATUS_IS_OK(status)) {
- goto fail;
- }
- }
-
- if (!fsp->is_directory && S_ISDIR(fsp->fsp_name->st.st_ex_mode)) {
- status = NT_STATUS_ACCESS_DENIED;
- goto fail;
- }
-
- /* Save the requested allocation size. */
- if ((info == FILE_WAS_CREATED) || (info == FILE_WAS_OVERWRITTEN)) {
- if (allocation_size
- && (allocation_size > fsp->fsp_name->st.st_ex_size)) {
- fsp->initial_allocation_size = smb_roundup(
- fsp->conn, allocation_size);
- if (fsp->is_directory) {
- /* Can't set allocation size on a directory. */
- status = NT_STATUS_ACCESS_DENIED;
- goto fail;
- }
- if (vfs_allocate_file_space(
- fsp, fsp->initial_allocation_size) == -1) {
- status = NT_STATUS_DISK_FULL;
- goto fail;
- }
- } else {
- fsp->initial_allocation_size = smb_roundup(
- fsp->conn, (uint64_t)fsp->fsp_name->st.st_ex_size);
- }
- }
-
DEBUG(10, ("create_file_unixpath: info=%d\n", info));
*result = fsp;