Commit Graph

21 Commits

Author SHA1 Message Date
Yaakov Selkowitz 7503575f1d cygwin: accept SIGIOT as alias of SIGABRT
winsup/cygwin/
	* include/cygwin/signal.h (SIGIOT): Define SIGIOT in terms of SIGABRT.
	* strsig.cc (struct sigdesc): Ditto.

	winsup/doc/
	* utils.xml (kill): Document SIGIOT.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-02-18 08:20:03 -06:00
Corinna Vinschen ddb7e770dd setfacl(1): Rewrite support for mask recomputation
* setfacl.cc (modacl): Move recomputing mask into new function.
        (check_got_mask): New function checking if mask is in input.
        (recompute_mask): New function to recompute mask.
        (addmissing): Align mask computation to Linux setfacl.
        (setfacl): Call check_got_mask and recompute_mask on Set, Delete and
        Modify actions.
        (usage): Rename --substitute to --set.
        (longopts): Add --set option.

        * utils.xml (setfacl): Rename --substitute to --set.
        * new-features.xml (ov-new2.4): Rephrase setfacl changes.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-21 13:05:41 +01:00
Corinna Vinschen 5aa8817e3a Allow cygwin_conv_path(3) and cygpath(1) to emit /proc/cygdrive prefixed path
* include/sys/cygwin.h (CCP_PROC_CYGDRIVE): New flag.
        * mount.cc (mount_info::cygdrive_posix_path): Take flag values rather
        than just a trailing_slash_p bool.  Emit /proc/cygdrive path if
        CCP_PROC_CYGDRIVE flag is given.
        (mount_info::conv_to_posix_path): Take flag values rather than just
        a keep_rel_p bool.  Rename _p variables.  Print flag value as hex in
        debug_printf.  Call cygdrive_posix_path with flag values.
        * mount.h (mount_info::cygdrive_posix_path): Accommodate above change
        in declaration.
        (mount_info::conv_to_posix_path): Ditto.
        * fhandler_process.cc (format_process_exename): Accommodate change to
        mount_info::conv_to_posix_path.
        * path.cc (cygwin_conv_path): Ditto.

        * cygpath.cc (absolute_flag): Initialize to CCP_RELATIVE to simplify
        expressions.
        (cygdrive_flag): New global flag.
        (long_options): Add --proc-cygdrive option.
        (options): Add -U option.
        (usage): Add description for -U option.
        (do_sysfolders): Or cygdrive_flag to cygwin_conv_path call.
        (do_pathconv): Simply or absolute_flag to conv_func.  Or
        cygdrive_flag to conv_func.
        (do_options): Initalize absolute_flag to CCP_RELATIVE.  Initialize new
        cygdrive_flag.  Set absolute_flag to CCP_ABSOLUTE on -a.  Set
        cygdrive_flag to CCP_PROC_CYGDRIVE on -U.

        * new-features.xml (ov-new2.4): Document cygpath -U option.
        * utils.xml (cygpath): Ditto.
        * path.xml (func-cygwin-path): Add CCP_PROC_CYGDRIVE description.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-06 17:25:48 +01:00
Corinna Vinschen 4dc3deea89 setfacl: Allow to combine -b and -k options
* setfacl.c (action_t): Rename DeleteAll to DeleteExt.  Add
	DeleteAll.  Rearrange for bit-wise testing later in the code.
	(delallacl): Handle -b -k combination.
	(setfacl): Handle DeleteExt/DeleteAll.
	(usage): Fix -b/-k output.  Rearrange output to better fill 80
	columns.
	(main): Allow to combine -b and -k.

	* utils.xml (setfacl): Accommodate -b/-k change.
	* new-features.xml (ov-new2.3): Add setfacl -b/-k change.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-11-18 22:41:11 +01:00
Corinna Vinschen bc444e5aa4 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>
2015-11-18 22:27:54 +01:00
Jon TURNEY 8d720d6ac7 winsup/doc: Remove 'Usage' prefix from synopses
Remove redundant 'Usage' prefix from synopses.

2015-06-22  Jon Turney  <jon.turney@dronecode.org.uk>

	* utils.xml: Remove 'Usage' prefix from synopses.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-23 12:07:36 +01:00
Jon TURNEY 646745cbf3 winsup/doc: Convert utils.xml to using refentry elements
Convert utils.xml from using a sect2 element to using a refentry element for
each utility program.  This makes it possible to generate manpage-style output
for those elements.

Note that the chunked html now generates a page for each utility, rather than
one containing all utilities.

A small customization to TOC generation for HTML and PDF is needed to ensure
that it appears as before, containing an entry for each utility command.

Future work: synopsis and options sections could use more detailed markup than
just wrapping the whole thing in <screen>

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* utils.xml : Convert from using a sect2 element to using a
	refentry element for each utility program.
	* cygwin.xsl: Customize autotoc to include refentries.
	* fo.xsl: Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 18:28:40 +01:00
Jon TURNEY 7177456cf0 winsup/doc: Some preparatory XML fixes
Remove the inconsistent .exe suffix in strace and umount usage lines.

Tidy up some trailing whitespace.

Tabs inside <screen> are not consistently formatted by all formatters, replace
with spaces.

Remove pointlesss and incorrect date

2015-06-12  Jon Turney  <jon.turney@dronecode.org.uk>

	* cygwin-ug-net.xml: Remove incorrect unused date.
	* utils.xml : Remove .exe suffix inconsistently added in a few
	places.  Tidy up some trailing whitespace.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-16 10:20:06 +01:00
Jon TURNEY 5c4129d937 Improve strace to log most Windows debug events
Not sure if this is wanted, but on a couple of occasions recently I have been
presented with strace output which contains an exception at an address in an
unknown module (i.e. not in the cygwin DLL or the main executable), so here is a
patch which adds some more information, including DLL load addresses, to help
interpret such straces.

v2:
Use NtQueryObject() for HANDLE -> filename conversion
Add new '-e' option to toggle this additional logging

2015-06-07  Jon Turney  <jon.turney@dronecode.org.uk>

	* strace.cc (proc_child): Log process and thread create and exit,
	and DLL load and unload.
	(GetFileNameFromHandle): New function.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2015-06-11 12:00:51 +01:00
Corinna Vinschen 583d56ee20 * utils.xml (getfacl): Adjust options to option nmame change. 2015-02-28 13:15:53 +00:00
Corinna Vinschen 7656f3f4d7 * utils.xml (regtool): Clarify save action. Add description for
restore action.
	* new-features.xml (ov-new1.7.34): Add regtool restore.
2015-02-03 15:23:37 +00:00
Corinna Vinschen db9a8c9983 * Throughout, replace http with https as far as cygwin.com and
sourceware.org URLs are concerned.
	* Throughout, simplify ulink expressions if the visible text is the
	URL anyway.
	* faq-programming.xml (faq.programming.dll-relocatable): Remove.
	* faq-setup.xml (faq.setup.name-with-space): Change for 1.7.34.
	(faq.setup.home): Ditto.
	* faq-using.xml (faq.using.printing): Clarify old links and availability
	of a2ps and file.
	(faq.using.xemacs): Drop outdated version info and pointers to native
	XEmacs.
	(faq.using.ntemacs): Remove.
	* faq-what.xml (faq.what.what): Rephrase to reflect reality.
	(faq.what.supported): Ditto.
	(faq.what.who): Rephrase slightly.
	* legal.xml: Bump copyright.
	* setup-net.xml (internet-setup): Fix references to setup executables.
2015-02-03 13:48:43 +00:00
Corinna Vinschen b3d0030d3c * new-features.xml (ov-new1.7.34): Add setfacl -k option.
* utils.xml (setfacl): Ditto.
2014-12-15 20:30:15 +00:00
Corinna Vinschen 72f4ea45e6 * utils.xml (passwd): Align to latest changes. 2014-11-24 11:21:22 +00:00
Corinna Vinschen 58d35b961e * utils.xml (mkgroup): Align to changed usage.
(mkpasswd): Ditto.
2014-11-12 14:50:56 +00:00
Corinna Vinschen 9b41831e4c * utils.xml (mkpasswd): Change /etc/group to /etc/passwd. 2014-11-07 13:53:25 +00:00
Corinna Vinschen f1271e19c3 * highlights.xml: Rearrange itemizedlist markup slightly.
* new-features.xml (ov-new1.7.33): Add setfacl -b option.
	* utils.xml (setfacl): Ditto.
2014-10-27 10:34:17 +00:00
Corinna Vinschen 3e61dde3f1 * utils.xml (setfacl): Align documentation to help text in setfacl. 2014-09-03 09:34:10 +00:00
Corinna Vinschen f3b0b4cb51 * utils.xml (setfacl): Drop outdated note that default ACEs are not
taken into account.
2014-08-31 19:20:10 +00:00
Corinna Vinschen e7ee42f33d * utils.xml (getfacl): Document additional suid/sgid/vtx flag printing. 2014-08-31 13:47:32 +00:00
Corinna Vinschen 6b31215816 * Makefile.in: Throughout use parenthesis instead of braces where
appropriate.
	(DBXDIRS): Remove.
	(XSLTPROC): Define for symmetry.  Use throughout.
	(clean): Drop removing cygwin-api.xml and doctool.*.
	(cygwin-api.xml): Drop rule.
	(doctool): Drop rule.
	(Makefile.dep): Add dependency to cygwin-api.xml.
	* cygwin-api.in.xml: Rename to cygwin-api.xml.  Convert includes to
	XML XInclude style.
	* doctool.c: Remove.
	* doctool.txt: Remove.
	* faq-programming.xml: Drop reference to local utils.xml file.
	* path.xml: Moved from ../cygwin and converted to XML.
	* posix.xml: Ditto.
	* using.xml: Drop relative path from utils.xml include.
	* utils.xml: Moved from ../utils.
2014-08-14 19:44:29 +00:00