From: Jean-Pierre A. <jp...@us...> - 2009-07-04 19:14:58
|
Update of /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7821/ntfs-3g/libntfs-3g Modified Files: Tag: PERMISSION_HANDLING_BRANCH security.c acls.c Log Message: Fixed permissions of created files when parent directory has a default ACL Index: security.c =================================================================== RCS file: /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g/security.c,v retrieving revision 1.2.2.117 retrieving revision 1.2.2.118 diff -u -d -r1.2.2.117 -r1.2.2.118 --- security.c 1 Jul 2009 19:45:59 -0000 1.2.2.117 +++ security.c 4 Jul 2009 19:14:56 -0000 1.2.2.118 @@ -2438,7 +2438,8 @@ gid = cached->gid; pxdesc = cached->pxdesc; if (pxdesc) { - pydesc = ntfs_build_inherited_posix(pxdesc,mode,isdir); + pydesc = ntfs_build_inherited_posix(pxdesc,mode, + scx->umask,isdir); } } else { securattr = getsecurityattr(scx->vol, dir_path, dir_ni); @@ -2482,7 +2483,8 @@ enter_cache(scx, dir_ni, uid, gid, pxdesc); } - pydesc = ntfs_build_inherited_posix(pxdesc, mode, isdir); + pydesc = ntfs_build_inherited_posix(pxdesc, + mode, scx->umask, isdir); free(pxdesc); } free(securattr); Index: acls.c =================================================================== RCS file: /cvsroot/ntfs-3g/ntfs-3g/libntfs-3g/Attic/acls.c,v retrieving revision 1.1.2.24 retrieving revision 1.1.2.25 diff -u -d -r1.1.2.24 -r1.1.2.25 --- acls.c 17 Jun 2009 08:05:09 -0000 1.1.2.24 +++ acls.c 4 Jul 2009 19:14:56 -0000 1.1.2.25 @@ -1120,7 +1120,8 @@ */ struct POSIX_SECURITY *ntfs_build_inherited_posix( - const struct POSIX_SECURITY *pxdesc, mode_t mode, BOOL isdir) + const struct POSIX_SECURITY *pxdesc, mode_t mode, + mode_t mask, BOOL isdir) { struct POSIX_SECURITY *pydesc; struct POSIX_ACE *pyace; @@ -1142,6 +1143,8 @@ if (pydesc) { /* * Copy inherited tags and adapt perms + * Use requested mode, ignoring umask + * (not possible with older versions of fuse) */ tagsset = 0; defcnt = (pxdesc ? pxdesc->defcnt : 0); @@ -1171,6 +1174,7 @@ /* * If some standard tags were missing, append them from mode * and sort the list + * Here we have to use the umask'ed mode */ if (~tagsset & (POSIX_ACL_USER_OBJ | POSIX_ACL_GROUP_OBJ | POSIX_ACL_OTHER)) { @@ -1180,7 +1184,7 @@ pyace = &pydesc->acl.ace[i]; pyace->tag = POSIX_ACL_USER_OBJ; pyace->id = -1; - pyace->perms = (mode >> 6) & 7; + pyace->perms = ((mode & ~mask) >> 6) & 7; tagsset |= POSIX_ACL_USER_OBJ; i++; } @@ -1189,7 +1193,7 @@ pyace = &pydesc->acl.ace[i]; pyace->tag = POSIX_ACL_GROUP_OBJ; pyace->id = -1; - pyace->perms = (mode >> 3) & 7; + pyace->perms = ((mode & ~mask) >> 3) & 7; tagsset |= POSIX_ACL_GROUP_OBJ; i++; } @@ -1198,7 +1202,7 @@ pyace = &pydesc->acl.ace[i]; pyace->tag = POSIX_ACL_OTHER; pyace->id = -1; - pyace->perms = mode & 7; + pyace->perms = mode & ~mask & 7; tagsset |= POSIX_ACL_OTHER; i++; } |