Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-06-24 12:52:29 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-11-19 00:27:54 +0300
commitbc444e5aa4ca097b7425f0012967201ef10032a7 (patch)
tree1121e57ab9f6586e46c247aea398d791c414bb1d /winsup/doc/utils.xml
parent049eeecba71a904a9c58060b90392163c7ba85a2 (diff)
Reapply POSIX ACL changes.
- New, unified implementation of POSIX permission and ACL handling. The new ACLs now store the POSIX ACL MASK/CLASS_OBJ permission mask, and they allow to inherit the S_ISGID bit. ACL inheritance now really works as desired, in a limited, but theoretically equivalent fashion even for non-Cygwin processes. To accommodate Windows default ACLs, the new code ignores SYSTEM and Administrators group permissions when computing the MASK/CLASS_OBJ permission mask on old ACLs, and it doesn't deny access to SYSTEM and Administrators group based on the value of MASK/CLASS_OBJ when creating the new ACLs. The new code now handles the S_ISGID bit on directories as on Linux: Setting S_ISGID on a directory causes new files and subdirs created within to inherit its group, rather than the primary group of the user who created the file. This only works for files and directories created by Cygwin processes. 2015-05-29 Corinna Vinschen <corinna@vinschen.de> Reapply POSIX ACL changes. * utils.xml (setfacl): Show new option output. (getfacl): Show new option output. * sec_acl.cc (get_posix_access): Check for Cygwin "standard" ACL. Apply umask, if so. Align comments. * security.cc (set_created_file_access): Fix permission masking by incoming requested file mode. * sec_acl.cc (set_posix_access): Apply mask only in terms of execute bit for SYSTEM and Admins group. * sec_acl.cc (set_posix_access): Don't create DENY ACEs for USER and GROUP entries if they are the same as USER_OBJ or GROUP_OBJ. * fhandler.h (fhandler_pty_slave::facl): Add prototype. * fhandler_tty.cc (fhandler_pty_slave::facl): New method. (fhandler_pty_slave::fchown): Fix uid/gid handling. * sec_acl.cc (set_posix_access): Drop superfluous class_idx variable. Simplify and move around code in a few places. To improve ACL readability, add r/w permissions to Admins ACE appended to pty ACL. Add comment to explain Windows ACE Mask filtering being in the way of creating a real CLASS_OBJ. (get_posix_access): Fake CLASS_OBJ for ptys. Explain why. * security.cc (get_object_attribute): Add S_IFCHR flag to attributes when calling get_posix_access. * sec_acl.cc (set_posix_access): Move merging group perms into owner perms in case of owner == group after mask has been computed. Take mask into account when doing so to avoid unnecessary ACCESS_DENIED_ACE. * sec_acl.cc (get_posix_access): Only set saw_group_obj flag if we saw the ACCESS_ALLOWED_ACE. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Deliberatly set GROUP_OBJ and CLASS_OBJ perms to new group perms. Add comment to explain why. * security.cc (set_created_file_access): Ditto. * sec_acl.cc (set_posix_access): Replace previous patch. Return EINVAL if uid and/or guid is invalid and not backed by an actual Windows account. * sec_acl.cc (set_posix_access): Workaround owner/group SIDs being NULL. * sec_acl.cc (set_posix_access): Handle files with owner == group. Rephrase switch statement checking against unfiltered a_type value. (get_posix_access): Handle files with owner == group. * sec_acl.cc (get_posix_access): Don't use GROUP_OBJ access to fix up CLASS_OBJ mask on old-style ACLs. Fix a comment. * sec_acl.cc (set_posix_access): Always make sure Admins have WRITE_DAC and WRITE_OWNER permissions. * security.h (create_object_sd_from_attribute): Drop handle parameter from prototype. * security.cc (create_object_sd_from_attribute): Drop handle parameter. Just create the standard POSIXy security descriptor. (set_object_attribute): Accommodate dropped paramter in call to create_object_sd_from_attribute. * fhandler_tty.cc: Ditto, throughout. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Fix typo in mask computation. * fhandler.cc (fhandler_base::open_with_arch): Call open with mode not umasked. (fhandler_base::open): Explicitely umask mode on NFS here. Call new set_created_file_access rather than set_file_attribute. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Reimplement setting permissions on filesystems supporting ACLs using the new set_posix_access call. (fhandler_disk_file::fchown): Ditto. (fhandler_disk_file::mkdir): Call new set_created_file_access rather than set_file_attribute. * fhandler_socket.cc (fhandler_socket::bind): Don't umask here. Add WRITE_OWNER access to allow writing group in case of SGID bit set. Call new set_created_file_access rather than set_file_attribute. * path.cc (symlink_worker): Call new set_created_file_access rather than set_file_attribute. * sec_acl.cc (searchace): Un-staticize. (set_posix_access): New, complementary functionality to get_posix_access. (setacl): Implement in terms of get_posix_access/set_posix_access. (get_posix_access): Add handling for just created files requiring their first Cygwin ACL. Fix new_style recognition. Handle SGID bit. For old-style ACLs, ignore SYSTEM and Administrators when computing the {DEF_}CLASS_OBJ perms. * security.cc (get_file_sd): Revamp comment. Change and (hopefully) speed up inheritance processing for just created files. (alloc_sd): Remove. (set_security_attribute): Call set_posix_access instead of alloc_sd. (get_object_attribute): Fix return value. (create_object_sd_from_attribute): Call set_posix_access instead of alloc_sd. (set_file_attribute): Remove. (set_created_file_access): New function implemented in terms of get_posix_access/set_posix_access. * security.h (set_file_attribute): Remove prototype. (set_created_file_access): Add prototype. (searchace): Ditto. (set_posix_access): Ditto. * syscalls.cc (open): Call open_with_arch with mode not umasked. * sec_acl.cc: Change preceeding comment explaining new-style ACLs. Describe how to generate deny ACEs in more detail. Accommodate the fact that a NULL deny ACE is used for {DEF_}CLASS_OBJ, rather than a special Cygwin ACE. Improve further comments. (CYG_ACE_NEW_STYLE): Define. (get_posix_access): Change from Cygwin ACE to NULL deny ACE. Fix CLASS_OBJ handling to generate CLASS_OBJ and DEF_CLASS_OBJ from a single NULL deny ACE if the inheritance flags say so. * sec_helper.cc (well_known_cygwin_sid): Remove. * security.h (well_known_cygwin_sid): Drop declaration. * sec_acl.cc (CYG_ACE_ISBITS_TO_WIN): Fix typo. (get_posix_access): Rename index variable from i to idx. Define only once at top level. * security.cc (add_access_allowed_ace): Drop unused parameter "offset". Accommodate throughout. (add_access_denied_ace): Ditto. * sec_acl.cc: Accommodate above change throughout. * security.h (add_access_allowed_ace): Adjust prototype to above change. (add_access_denied_ace): Ditto. * sec_acl.cc (get_posix_access): Handle multiple ACEs for the owner and primary group of the file. Handle the default primary group ACE as DEF_GROUP_OBJ entry if the directory has the S_ISGID bit set. Add comments. Minor code rearrangements. Preliminary read side implementation of new permission handling. * acl.h (MAX_ACL_ENTRIES): Raise to 2730. Add comment to explain. * sec_acl.cc: Add leading comment to explain new ACL style. Add definitions and macros to use for bits in new Cygwin ACL. (DENY_RWX): New mask value for all temporary deny bits. (getace): Add bool parameter to decide when leaving all bits intact, rather than filtering them per the already set bits. (get_posix_access): New function, taking over functionality to read POSIX ACL from SECURITY_DESCRIPTOR. (getacl): Just call get_posix_access. * sec_helper.cc (well_known_cygwin_sid): Define. * security.cc (get_attribute_from_acl): Remove. (get_info_from_sd): Remove. (get_reg_sd): Call get_posix_access instead of get_info_from_sd. (get_file_attribute): Ditto. (get_object_attribute): Ditto. * security.h (well_known_cygwin_sid): Declare. (get_posix_access): Add prototype. * Throughout, use simpler ACE macros from Windows' accctrl.h. * getfacl.c (main): Special-case SYSTEM and Admins group. Add comments. * setfacl.c: Align more to Linux tool. (delacl): New function to delete acl entries only. (modacl): Drop delete functionality. Add handling of recomputing the mask and default mask values. (delallacl): Rename from delacl. (setfacl): Call delacl in Delete case. Call delallacl in DeleteAll and DeleteDef case. (usage): Accommodate new options. Rearrange and rephrase slightly. (longopts): Emit 'x' in --delete case. Add --no-mask and --mask options. (opts): Add -x and -n options. (main): Handle -d and -x the same. Handle -n and --mask options. Drop handling for -r option. * getfacl.c (usage): Align more closely to Linux version. Add new options -c, -e, -E. Change formatting to accommodate longer options. (longopts): Rename --noname to --numeric. Keep --noname for backward compatibility. Add --omit-header, --all-effective and --no-effective options. (opts): Add -c, -e and -E option. (main): Handle new -c, -e, and -E options. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'winsup/doc/utils.xml')
-rw-r--r--winsup/doc/utils.xml108
1 files changed, 60 insertions, 48 deletions
diff --git a/winsup/doc/utils.xml b/winsup/doc/utils.xml
index 5d3df69b1..7c2740dea 100644
--- a/winsup/doc/utils.xml
+++ b/winsup/doc/utils.xml
@@ -590,18 +590,21 @@ Other options:
<refsynopsisdiv>
<screen>
-getfacl [-adn] FILE [FILE2...]
+getfacl [-adceEn] FILE [FILE2...]
</screen>
</refsynopsisdiv>
<refsect1>
<title>Options</title>
<screen>
- -a, --access display the file access control list
- -d, --default display the default access control list
- -h, --help print help explaining the command line options
- -n, --noname display user and group IDs instead of names
- -V, --version output version information and exit
+ -a, --access display the file access control list only
+ -d, --default display the default access control list only
+ -c, --omit-header do not display the comment header
+ -e, --all-effective print all effective rights
+ -E, --no-effective print no effective rights
+ -n, --numeric print numeric user/group identifiers
+ -V, --version print version and exit
+ -h, --help this help text
When multiple files are specified on the command line, a blank
line separates the ACLs for each file.
@@ -1965,29 +1968,27 @@ Example: regtool get '\user\software\Microsoft\Clock\iFormat'
<refsynopsisdiv>
<screen>
-setfacl [-r] {-f ACL_FILE | -s acl_entries} FILE...
-setfacl [-r] {-b|[-d acl_entries] [-m acl_entries]} FILE...
+setfacl [-n] {-f ACL_FILE | -s acl_entries} FILE...
+setfacl [-n] {-b|-k|[-x acl_entries] [-m acl_entries]} FILE...
</screen>
</refsynopsisdiv>
<refsect1>
<title>Options</title>
<screen>
- -b, --remove-all remove all extended ACL entries
- -d, --delete delete one or more specified ACL entries
- -f, --file set ACL entries for FILE to ACL entries read
- from a ACL_FILE
- -k, --remove-default
- remove all default ACL entries
- -m, --modify modify one or more specified ACL entries
- -r, --replace replace mask entry with maximum permissions
- needed for the file group class
- -s, --substitute substitute specified ACL entries for the
- ACL of FILE
- -h, --help output usage information and exit
- -V, --version output version information and exit
-
-At least one of (-b, -d, -f, -k, -m, -s) must be specified
+ -b, --remove-all remove all extended ACL entries\n"
+ -x, --delete delete one or more specified ACL entries\n"
+ -f, --file set ACL entries for FILE to ACL entries read\n"
+ from ACL_FILE\n"
+ -k, --remove-default remove all default ACL entries\n"
+ -m, --modify modify one or more specified ACL entries\n"
+ -n, --no-mask don't recalculate the effective rights mask\n"
+ --mask do recalculate the effective rights mask\n"
+ -s, --substitute substitute specified ACL entries on FILE\n"
+ -V, --version print version and exit\n"
+ -h, --help this help text\n"
+
+At least one of (-b, -x, -f, -k, -m, -s) must be specified\n"
</screen>
</refsect1>
@@ -1996,8 +1997,8 @@ At least one of (-b, -d, -f, -k, -m, -s) must be specified
<para> For each file given as parameter, <command>setfacl</command> will
either replace its complete ACL (<literal>-s</literal>,
<literal>-f</literal>), or it will add, modify, or delete ACL entries.
- For more information on Cygwin and Windows ACLs, see see <xref
- linkend="ntsec"/> in the Cygwin User's Guide. </para>
+ For more information on Cygwin and Windows ACLs, see
+ <xref linkend="ntsec"/> in the Cygwin User's Guide. </para>
<para> Acl_entries are one or more comma-separated ACL entries from the
following list:
@@ -2024,13 +2025,14 @@ At least one of (-b, -d, -f, -k, -m, -s) must be specified
<para> The following options are supported: </para>
- <para> <literal>-b</literal> Remove all extended ACL entries. The base
- ACL entries of the owner, group and others are retained.</para>
+ <para> <literal>-b</literal>,<literal>--remove-all</literal> Remove all
+ extended ACL entries. The base ACL entries of the owner, group and
+ others are retained.</para>
- <para> <literal>-d</literal> Delete one or more specified entries from the
- file's ACL. The owner, group and others entries must not be deleted.
- Acl_entries to be deleted should be specified without permissions, as in
- the following list:
+ <para> <literal>-x</literal>,<literal>--delete</literal> Delete one or
+ more specified entries from the file's ACL. The owner, group and others
+ entries must not be deleted. Acl_entries to be deleted should be
+ specified without permissions, as in the following list:
<screen>
u[ser]:uid[:]
g[roup]:gid[:]
@@ -2041,11 +2043,12 @@ At least one of (-b, -d, -f, -k, -m, -s) must be specified
d[efault]:o[ther][:]
</screen> </para>
- <para> <literal>-f</literal> Take the Acl_entries from ACL_FILE one per
- line. Whitespace characters are ignored, and the character "#" may be
- used to start a comment. The special filename "-" indicates reading from
- stdin. Note that you can use this with <command>getfacl</command> and
- <command>setfacl</command> to copy ACLs from one file to another:
+ <para> <literal>-f</literal>,<literal>--file</literal> Take the Acl_entries
+ from ACL_FILE one per line. Whitespace characters are ignored, and the
+ character "#" may be used to start a comment. The special filename "-"
+ indicates reading from stdin. Note that you can use this with
+ <command>getfacl</command> and <command>setfacl</command> to copy ACLs
+ from one file to another:
<screen>
$ getfacl source_file | setfacl -f - target_file
</screen> </para>
@@ -2061,22 +2064,31 @@ $ getfacl source_file | setfacl -f - target_file
file, one default group entry for the group of the file, one default mask
entry for the file group class, and one default other entry. </para>
- <para> <literal>-k</literal> Remove all default ACL entries. If no default
- ACL entries exist, no warnings are issued. </para>
+ <para> <literal>-k</literal>,<literal>--remove-default</literal> Remove all
+ default ACL entries. If no default ACL entries exist, no warnings are
+ issued. </para>
- <para> <literal>-m</literal> Add or modify one or more specified ACL
- entries. Acl_entries is a comma-separated list of entries from the same
- list as above. </para>
+ <para> <literal>-m</literal>,<literal>--modify</literal> Add or modify one
+ or more specified ACL entries. Acl_entries is a comma-separated list of
+ entries from the same list as above. </para>
- <para> <literal>-r</literal> Causes the permissions specified in the mask
- entry to be ignored and replaced by the maximum permissions needed for
- the file group class. </para>
+ <para> <literal>-n</literal>,<literal>--no-mask</literal> Valid in
+ conjunction with -m. Do not recalculate the effective rights mask.
+ The default behavior of setfacl is to recalculate the ACL mask entry,
+ unless a mask entry was explicitly given. The mask entry is set to
+ the union of all permissions of the owning group, and all named user
+ and group entries. (These are exactly the entries affected by the
+ mask entry). </para>
- <para> <literal>-s</literal> Like <literal>-f</literal>, but substitute the
- file's ACL with Acl_entries specified in a comma-separated list on the
- command line. </para>
+ <para> <literal>--mask</literal> Valid in conjunction with -m. Do
+ recalculate the effective rights mask, even if an ACL mask entry was
+ explicitly given. (See the -n option.) </para>
- <para> While the <literal>-d</literal> and <literal>-m</literal> options
+ <para> <literal>-s</literal>,<literal>--substitute</literal> Like
+ <literal>-f</literal>, but substitute the file's ACL with Acl_entries
+ specified in a comma-separated list on the command line. </para>
+
+ <para> While the <literal>-x</literal> and <literal>-m</literal> options
may be used in the same command, the <literal>-f</literal> and
<literal>-s</literal> options may be used only exclusively. </para>