r20344: Move the calls to inherit_access_acls and change_owner_to_parent together.
authorVolker Lendecke <vlendec@samba.org>
Sun, 24 Dec 2006 16:37:22 +0000 (16:37 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:43 +0000 (12:16 -0500)
Jeremy, I'm 100% sure you watch me closely here, I count on you :-)

Volker

source/smbd/open.c

index c3df5acde3df9dddd4463cd7c7b311653158138d..59cd8030af64dccc4ae1bcbcab815beb1cf30935 100644 (file)
@@ -293,11 +293,17 @@ static NTSTATUS open_file(files_struct *fsp,
                        return map_nt_error_from_unix(errno);
                }
 
-               /* Inherit the ACL if the file was created. */
-               if ((local_flags & O_CREAT)
-                   && !file_existed
-                   && lp_inherit_perms(SNUM(conn))) {
-                       inherit_access_acl(conn, fname, unx_mode);
+               if ((local_flags & O_CREAT) && !file_existed) {
+
+                       /* Inherit the ACL if required */
+                       if (lp_inherit_perms(SNUM(conn))) {
+                               inherit_access_acl(conn, fname, unx_mode);
+                       }
+
+                       /* Change the owner if required. */
+                       if (lp_inherit_owner(SNUM(conn))) {
+                               change_fd_owner_to_parent(conn, fsp);
+                       }
                }
 
        } else {
@@ -1702,10 +1708,6 @@ NTSTATUS open_file_ntcreate(connection_struct *conn,
                }
        } else {
                info = FILE_WAS_CREATED;
-               /* Change the owner if required. */
-               if (lp_inherit_owner(SNUM(conn))) {
-                       change_fd_owner_to_parent(conn, fsp);
-               }
        }
 
        if (pinfo) {
@@ -1913,6 +1915,11 @@ static NTSTATUS mkdir_internal(connection_struct *conn, const char *name,
                              psbuf->st_mode | (mode & ~psbuf->st_mode));
        }
 
+       /* Change the owner if required. */
+       if (lp_inherit_owner(SNUM(conn))) {
+               change_owner_to_parent(conn, name, psbuf);
+       }
+
        return NT_STATUS_OK;
 }
 
@@ -2086,11 +2093,6 @@ NTSTATUS open_directory(connection_struct *conn,
 
        TALLOC_FREE(lck);
 
-       /* Change the owner if required. */
-       if ((info == FILE_WAS_CREATED) && lp_inherit_owner(SNUM(conn))) {
-               change_owner_to_parent(conn, fsp->fsp_name, psbuf);
-       }
-
        if (pinfo) {
                *pinfo = info;
        }