r20228: Bring the calling conventions of inherit_access_acl and change_owner_to_parent
authorVolker Lendecke <vlendec@samba.org>
Sun, 17 Dec 2006 18:30:44 +0000 (18:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:16:34 +0000 (12:16 -0500)
a bit closer together: Move the lp_inherit_perms() check into the callers.

Volker
(This used to be commit 0874093e5fff480d8ec442072318525079add633)

source3/smbd/open.c
source3/smbd/posix_acls.c
source3/smbd/trans2.c
source3/smbd/vfs.c

index 3d5dd849b694bed51367b5cda7a1a6578b2c5c09..d916609769430a12e6e8274aa18d9f0a3ca4bdcd 100644 (file)
@@ -283,7 +283,9 @@ static NTSTATUS open_file(files_struct *fsp,
                }
 
                /* Inherit the ACL if the file was created. */
-               if ((local_flags & O_CREAT) && !file_existed) {
+               if ((local_flags & O_CREAT)
+                   && !file_existed
+                   && lp_inherit_perms(SNUM(conn))) {
                        inherit_access_acl(conn, fname, unx_mode);
                }
 
index f17594c0796de2cf3213798ce3db160f16e9de74..75605ace8a67c9cddf0946b9d00dcda35f66f56c 100644 (file)
@@ -3457,8 +3457,8 @@ int chmod_acl(connection_struct *conn, const char *name, mode_t mode)
 }
 
 /****************************************************************************
- If "inherit permissions" is set and the parent directory has no default
ACL but it does have an Access ACL, inherit this Access ACL to file name.
+ If the parent directory has no default ACL but it does have an Access ACL,
+ inherit this Access ACL to file name.
 ****************************************************************************/
 
 int inherit_access_acl(connection_struct *conn, const char *name, mode_t mode)
@@ -3466,7 +3466,7 @@ int inherit_access_acl(connection_struct *conn, const char *name, mode_t mode)
        pstring dirname;
        pstrcpy(dirname, parent_dirname(name));
 
-       if (!lp_inherit_perms(SNUM(conn)) || directory_has_default_acl(conn, dirname))
+       if (directory_has_default_acl(conn, dirname))
                return 0;
 
        return copy_access_acl(conn, dirname, name, mode);
index 2f4bcb414fde7b94c17fe5ae78118e6051f82886..d15ca6d3274f5bacab8afd347eef79d83be04820 100644 (file)
@@ -4307,7 +4307,10 @@ size = %.0f, uid = %u, gid = %u, raw perms = 0%o\n",
                                if (SMB_VFS_MKNOD(conn,fname, unixmode, dev) != 0)
                                        return(UNIXERROR(ERRDOS,ERRnoaccess));
 
-                               inherit_access_acl(conn, fname, unixmode);
+                               if (lp_inherit_perms(SNUM(conn))) {
+                                       inherit_access_acl(conn, fname,
+                                                          unixmode);
+                               }
 
                                SSVAL(params,0,0);
                                send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0, max_data_bytes);
index ab9ddef9fff869e39c6f75372b25fb70b319a7e9..b6a7d477bd98bdd049068fd24a49acf452696fc8 100644 (file)
@@ -319,7 +319,9 @@ int vfs_MkDir(connection_struct *conn, const char *name, mode_t mode)
                return ret;
        }
 
-       inherit_access_acl(conn, name, mode);
+       if (lp_inherit_perms(SNUM(conn))) {
+               inherit_access_acl(conn, name, mode);
+       }
 
        /*
         * Check if high bits should have been set,