Part 2 of bugfix for #8211 - "inherit owner = yes" doesn't interact correctly with...
authorJeremy Allison <jra@samba.org>
Wed, 8 Jun 2011 19:54:33 +0000 (12:54 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 26 Jul 2011 19:43:54 +0000 (21:43 +0200)
When changing ownership on a new file make sure we
also change the returned stat struct to have the correct uid.
(cherry picked from commit 282b09692d23253dd6c3808e1a96de84073ba4e2)

source3/smbd/open.c

index aea25fefd1fe8b1de4de32f55eea75d6910b063b..be39c23964df6704c3080b43ad47d15d8814d45a 100644 (file)
@@ -237,11 +237,13 @@ void change_file_owner_to_parent(connection_struct *conn,
                         "was %s\n", fsp_str_dbg(fsp),
                         (unsigned int)smb_fname_parent->st.st_ex_uid,
                         strerror(errno) ));
-       }
-
-       DEBUG(10,("change_file_owner_to_parent: changed new file %s to "
+       } else {
+               DEBUG(10,("change_file_owner_to_parent: changed new file %s to "
                  "parent directory uid %u.\n", fsp_str_dbg(fsp),
                  (unsigned int)smb_fname_parent->st.st_ex_uid));
+               /* Ensure the uid entry is updated. */
+               fsp->fsp_name->st.st_ex_uid = smb_fname_parent->st.st_ex_uid;
+       }
 
        TALLOC_FREE(smb_fname_parent);
 }