From e8e5c17f2e5c09dff5b2acaaab9a9659b9242c6f Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 24 Dec 2006 16:37:22 +0000 Subject: r20344: Move the calls to inherit_access_acls and change_owner_to_parent together. Jeremy, I'm 100% sure you watch me closely here, I count on you :-) Volker (This used to be commit 02f85265f21607c950639da33bc8fe5d5ffd3cf9) --- source3/smbd/open.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index c3df5acde3..59cd8030af 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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; } -- cgit