summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-06-08 14:36:12 -0700
committerJeremy Allison <jra@samba.org>2011-06-09 00:46:38 +0200
commit19213b83d6cd5a7deeb6fab8d9fde304290a447c (patch)
tree12890e55bcd710a42b8e7d9e5352d79f22e4762b
parentc6bc1eeb7b93fde84dae5d81eedd0610aef1726e (diff)
downloadsamba-19213b83d6cd5a7deeb6fab8d9fde304290a447c.tar.gz
samba-19213b83d6cd5a7deeb6fab8d9fde304290a447c.tar.bz2
samba-19213b83d6cd5a7deeb6fab8d9fde304290a447c.zip
Ensure when creating a directory, if we make any changes due to inheritance parameters, we update the stat returned.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Thu Jun 9 00:46:39 CEST 2011 on sn-devel-104
-rw-r--r--source3/smbd/open.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index b7e5276a8a..06de8ab432 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2568,6 +2568,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
char *parent_dir;
NTSTATUS status;
bool posix_open = false;
+ bool need_re_stat = false;
if(!CAN_WRITE(conn)) {
DEBUG(5,("mkdir_internal: failing create on read-only share "
@@ -2622,6 +2623,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
if (lp_inherit_perms(SNUM(conn))) {
inherit_access_posix_acl(conn, parent_dir,
smb_dname->base_name, mode);
+ need_re_stat = true;
}
if (!posix_open) {
@@ -2636,6 +2638,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
SMB_VFS_CHMOD(conn, smb_dname->base_name,
(smb_dname->st.st_ex_mode |
(mode & ~smb_dname->st.st_ex_mode)));
+ need_re_stat = true;
}
}
@@ -2644,6 +2647,15 @@ static NTSTATUS mkdir_internal(connection_struct *conn,
change_dir_owner_to_parent(conn, parent_dir,
smb_dname->base_name,
&smb_dname->st);
+ need_re_stat = true;
+ }
+
+ if (need_re_stat) {
+ if (SMB_VFS_LSTAT(conn, smb_dname) == -1) {
+ DEBUG(2, ("Could not stat directory '%s' just created: %s\n",
+ smb_fname_str_dbg(smb_dname), strerror(errno)));
+ return map_nt_error_from_unix(errno);
+ }
}
notify_fname(conn, NOTIFY_ACTION_ADDED, FILE_NOTIFY_CHANGE_DIR_NAME,