Part 2 of bugfix for #8211 - "inherit owner = yes" doesn't interact correctly with...
authorJeremy Allison <jra@samba.org>
Wed, 8 Jun 2011 17:17:42 +0000 (10:17 -0700)
committerKarolin Seeger <kseeger@samba.org>
Tue, 14 Jun 2011 10:59:06 +0000 (12:59 +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 59e77811b7774ad76e082ee9fd840a277df75c4c)

source3/smbd/open.c

index e8d1a1bd4073f13cdd07abc7cef7c0d813531d1a..aaae9673d1a48e5d8e9cfd0ad8edec985755f35f 100644 (file)
@@ -232,12 +232,15 @@ 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);
 }