The branch, v3-5-test has been updated
       via  06fd08d Part 3 of bugfix for bug #7509 - smb_acl_to_posix: ACL is 
invalid for set (Invalid argument)
       via  36f60ce Part 2 of bugfix for bug #7509 - smb_acl_to_posix: ACL is 
invalid for set (Invalid argument)
       via  cd5d9a5 Part 1 of bugfix for bug #7509 - smb_acl_to_posix: ACL is 
invalid for set (Invalid argument)
      from  4b26ffd Fix bug #8458 - IE9 on Windows 7 cannot download files to 
samba 3.5.11 share

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 06fd08dea1dde4b86546a8f87574d68dcac0e840
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Sep 2 15:08:42 2011 -0700

    Part 3 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set 
(Invalid argument)
    
    Don't call check_owning_objs() to convert ACL_USER->ACL_USER_OBJ and
    AC_GROUP->ACL_GROUP_OBJ for default (directory) ACLs, we do this separately
    inside ensure_canon_entry_valid().

commit 36f60cef6d6ac5625a88a73ce53bdb2b0fe0f000
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Sep 2 15:07:48 2011 -0700

    Part 2 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set 
(Invalid argument)
    
    Only map CREATOR_OWNER/CREATOR_GROUP to ACL_USER_OBJ/ACL_GROUP_OBJ in
    a default(directory) ACL set.

commit cd5d9a5c8fb0660835d60479fb783e4f7cae743f
Author: Jeremy Allison <j...@samba.org>
Date:   Fri Sep 2 14:59:31 2011 -0700

    Part 1 of bugfix for bug #7509 - smb_acl_to_posix: ACL is invalid for set 
(Invalid argument)
    
    Remove the code I added for bug "6878 - Cannot change ACL's inherit flag". 
It is incorrect
    and causes the POSIX ACL ACL_USER_OBJ duplication.

-----------------------------------------------------------------------

Summary of changes:
 source3/smbd/posix_acls.c |  123 ++++++++++++++++-----------------------------
 1 files changed, 44 insertions(+), 79 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index 714a4d3..17860bd 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -1484,6 +1484,7 @@ static bool ensure_canon_entry_valid(canon_ace **pp_ace,
  Check if a POSIX ACL has the required SMB_ACL_USER_OBJ and SMB_ACL_GROUP_OBJ 
entries.
  If it does not have them, check if there are any entries where the trustee is 
the
  file owner or the owning group, and map these to SMB_ACL_USER_OBJ and 
SMB_ACL_GROUP_OBJ.
+ Note we must not do this to default directory ACLs.
 ****************************************************************************/
 
 static void check_owning_objs(canon_ace *ace, DOM_SID *pfile_owner_sid, 
DOM_SID *pfile_grp_sid)
@@ -1526,50 +1527,6 @@ static void check_owning_objs(canon_ace *ace, DOM_SID 
*pfile_owner_sid, DOM_SID
 }
 
 /****************************************************************************
- If an ACE entry is SMB_ACL_USER_OBJ and not CREATOR_OWNER, map to 
SMB_ACL_USER.
- If an ACE entry is SMB_ACL_GROUP_OBJ and not CREATOR_GROUP, map to 
SMB_ACL_GROUP
-****************************************************************************/
-
-static bool dup_owning_ace(canon_ace *dir_ace, canon_ace *ace)
-{
-       /* dir ace must be followings.
-          SMB_ACL_USER_OBJ : trustee(CREATOR_OWNER) -> Posix ACL d:u::perm
-          SMB_ACL_USER     : not trustee    -> Posix ACL u:user:perm
-          SMB_ACL_USER_OBJ : trustee -> convert to SMB_ACL_USER : trustee
-          Posix ACL u:trustee:perm
-
-          SMB_ACL_GROUP_OBJ: trustee(CREATOR_GROUP) -> Posix ACL d:g::perm
-          SMB_ACL_GROUP    : not trustee   -> Posix ACL g:group:perm
-          SMB_ACL_GROUP_OBJ: trustee -> convert to SMB_ACL_GROUP : trustee
-          Posix ACL g:trustee:perm
-       */
-
-       if (ace->type == SMB_ACL_USER_OBJ &&
-                       !(sid_equal(&ace->trustee, &global_sid_Creator_Owner))) 
{
-               canon_ace *dup_ace = dup_canon_ace(ace);
-
-               if (dup_ace == NULL) {
-                       return false;
-               }
-               dup_ace->type = SMB_ACL_USER;
-               DLIST_ADD_END(dir_ace, dup_ace, canon_ace *);
-       }
-
-       if (ace->type == SMB_ACL_GROUP_OBJ &&
-                       !(sid_equal(&ace->trustee, &global_sid_Creator_Group))) 
{
-               canon_ace *dup_ace = dup_canon_ace(ace);
-
-               if (dup_ace == NULL) {
-                       return false;
-               }
-               dup_ace->type = SMB_ACL_GROUP;
-               DLIST_ADD_END(dir_ace, dup_ace, canon_ace *);
-       }
-
-       return true;
-}
-
-/****************************************************************************
  Unpack a SEC_DESC into two canonical ace lists.
 ****************************************************************************/
 
@@ -1792,6 +1749,7 @@ static bool create_canon_ace_lists(files_struct *fsp,
                        if ((psa->flags & 
(SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT)) ==
                                
(SEC_ACE_FLAG_OBJECT_INHERIT|SEC_ACE_FLAG_CONTAINER_INHERIT)) {
 
+                               canon_ace *current_dir_ace = current_ace;
                                DLIST_ADD_END(dir_ace, current_ace, canon_ace 
*);
 
                                /*
@@ -1820,34 +1778,6 @@ static bool create_canon_ace_lists(files_struct *fsp,
                                }
 
                                /*
-                                * We have a lossy mapping: directory ACE 
entries
-                                * CREATOR_OWNER ------\
-                                *     (map to)         +---> SMB_ACL_USER_OBJ
-                                * owning sid    ------/
-                                *
-                                * CREATOR_GROUP ------\
-                                *     (map to)         +---> SMB_ACL_GROUP_OBJ
-                                * primary group sid --/
-                                *
-                                * on set. And on read of a directory ACL
-                                *
-                                * SMB_ACL_USER_OBJ ----> CREATOR_OWNER
-                                * SMB_ACL_GROUP_OBJ ---> CREATOR_GROUP.
-                                *
-                                * Deal with this on set by duplicating
-                                * owning sid and primary group sid ACE
-                                * entries into the directory ACL.
-                                * Fix from Tsukasa Hamano 
<ham...@osstech.co.jp>.
-                                */
-
-                               if (!dup_owning_ace(dir_ace, current_ace)) {
-                                       DEBUG(0,("create_canon_ace_lists: 
malloc fail !\n"));
-                                       free_canon_ace_list(file_ace);
-                                       free_canon_ace_list(dir_ace);
-                                       return false;
-                               }
-
-                               /*
                                 * If this is not an inherit only ACE we need 
to add a duplicate
                                 * to the file acl.
                                 */
@@ -1881,6 +1811,43 @@ static bool create_canon_ace_lists(files_struct *fsp,
                                         */
                                        current_ace = NULL;
                                }
+
+                               /*
+                                * current_ace is now either owned by file_ace
+                                * or is NULL. We can safely operate on 
current_dir_ace
+                                * to treat mapping for default acl entries 
differently
+                                * than access acl entries.
+                                */
+
+                               if (current_dir_ace->owner_type == UID_ACE) {
+                                       /*
+                                        * We already decided above this is a 
uid,
+                                        * for default acls ace's only 
CREATOR_OWNER
+                                        * maps to ACL_USER_OBJ. All other uid
+                                        * ace's are ACL_USER.
+                                        */
+                                       if (sid_equal(&current_dir_ace->trustee,
+                                                       
&global_sid_Creator_Owner)) {
+                                               current_dir_ace->type = 
SMB_ACL_USER_OBJ;
+                                       } else {
+                                               current_dir_ace->type = 
SMB_ACL_USER;
+                                       }
+                               }
+
+                               if (current_dir_ace->owner_type == GID_ACE) {
+                                       /*
+                                        * We already decided above this is a 
gid,
+                                        * for default acls ace's only 
CREATOR_GROUP
+                                        * maps to ACL_GROUP_OBJ. All other uid
+                                        * ace's are ACL_GROUP.
+                                        */
+                                       if (sid_equal(&current_dir_ace->trustee,
+                                                       
&global_sid_Creator_Group)) {
+                                               current_dir_ace->type = 
SMB_ACL_GROUP_OBJ;
+                                       } else {
+                                               current_dir_ace->type = 
SMB_ACL_GROUP;
+                                       }
+                               }
                        }
                }
 
@@ -1942,17 +1909,15 @@ static bool create_canon_ace_lists(files_struct *fsp,
                dir_ace = NULL;
        } else {
                /*
-                * Check if we have SMB_ACL_USER_OBJ and SMB_ACL_GROUP_OBJ 
entries in each
-                * ACL. If we don't have them, check if any 
SMB_ACL_USER/SMB_ACL_GROUP
-                * entries can be converted to *_OBJ. Usually we will already 
have these
-                * entries in the Default ACL, and the Access ACL will not have 
them.
+                * Check if we have SMB_ACL_USER_OBJ and SMB_ACL_GROUP_OBJ 
entries in
+                * the file ACL. If we don't have them, check if any 
SMB_ACL_USER/SMB_ACL_GROUP
+                * entries can be converted to *_OBJ. Don't do this for the 
default
+                * ACL, we will create them separately for this if needed inside
+                * ensure_canon_entry_valid().
                 */
                if (file_ace) {
                        check_owning_objs(file_ace, pfile_owner_sid, 
pfile_grp_sid);
                }
-               if (dir_ace) {
-                       check_owning_objs(dir_ace, pfile_owner_sid, 
pfile_grp_sid);
-               }
        }
 
        *ppfile_ace = file_ace;


-- 
Samba Shared Repository

Reply via email to