From 19213b83d6cd5a7deeb6fab8d9fde304290a447c Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 8 Jun 2011 14:36:12 -0700 Subject: Ensure when creating a directory, if we make any changes due to inheritance parameters, we update the stat returned. Autobuild-User: Jeremy Allison Autobuild-Date: Thu Jun 9 00:46:39 CEST 2011 on sn-devel-104 --- source3/smbd/open.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source3/smbd') 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, -- cgit