Commit Graph

799 Commits

Author SHA1 Message Date
Corinna Vinschen c1023ee353 Cygwin: path_conv: decouple path_types from mount types
- Remove another unfortunate amalgamation: Mount flags (MOUNT_xxx)
  are converted to path_types (PATH_xxx) and mixed with non-mount
  path_types flags in the same storage, leading to a tangled,
  pell-mell usage of mount flags and path flags in path_conv and
  symlink_info.

- There's also the case of PC_NONULLEMPTY.  It's used in exactly
  one place with a path_conv constructor only used in this single
  place, just to override the automatic PC_NULLEMPTY addition
  when calling the other path_conv constructors.  Crazily,
  PC_NONULLEMPTY is a define, no path_types flag, despite its
  name.

- It doesn't help that the binary flag exists as mount and path
  flag, while the text flag only exists as path flag.  This leads
  to mount code using path flags to set text/binary.  Very confusing
  is the fact that a text mount/path flag is not actually required;
  the mount code sets the text flag on non binary mounts anyway, so
  there are only two states.  However, to puzzle people a bit more,
  path_conv::binary wrongly implies there's a third, non-binary/non-text
  state.

Clean up this mess:

- Store path flags separately from mount flags in path_conv and
  symlink_info classes and change all checks and testing inline
  methods accordingly.

- Make PC_NONULLEMPTY a simple path_types flag and drop the
  redundant path_check constructor.

- Clean up the definition of pathconv_arg, path_types, and mount flags.
  Use _BIT expression, newly define in cygwin/bits.h.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-06 20:30:14 +01:00
Corinna Vinschen 0d4b39d37b Cygwin: Add lsattr and chattr tools
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-12-26 09:24:33 +01:00
Ken Brown ed4d919c24 setfacl: Rename the option --file to --set-file, as on Linux
Retain --file as an undocumented option for backwards compatibility.
2018-08-17 11:35:24 +02:00
Corinna Vinschen 423fc83dfd Cygwin: utils: ps: use fputs to print fixed strings
Avoid gcc warning "format not a string literal and no format arguments"

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-09 08:41:18 +02:00
Corinna Vinschen 8bfb1afd6b Cygwin: utils: strace: fix format string
%ll is long valid for mingw builds.  Use this rather than %I64
to avoid a gcc warning

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 37f4fea07c Cygwin: utils: change 3rd readlink param to size_t
Avoid gcc warnings

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:19 +02:00
Corinna Vinschen 13909bc262 Cygwin: utils: cygcheck: fix filesystem output format
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-08-08 10:50:13 +02:00
Mark Geisert 7f32efbf73 POSIX Asynchronous I/O support: other files
Updates to misc files to integrate AIO into the Cygwin source tree.
Much of it has to be done when adding any new syscalls.  There are
some updates to limits.h for AIO-specific limits.  And some doc mods.
2018-07-25 09:36:24 +02:00
Ken Brown 982dd20ed9 getfacl: Simplify by using acl_to_any_text 2018-07-25 09:32:36 +02:00
Ken Brown b610a9cf29 getfacl and setfacl: Align with Linux
Make getfacl print two colons instead of one after "other" and "mask".
Change the help text for setfacl to indicate that there can be either
one colon or two.
2018-07-23 17:31:09 +02:00
Corinna Vinschen 6497fdfaf4 Cygwin: fix bumptious GCC 7 warnings
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-06-26 17:20:48 +02:00
Corinna Vinschen 26bcedda20 Cygwin: fix utils path handling in case cygdrive path is just '/'
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2018-02-16 17:21:48 +01:00
Yaakov Selkowitz e5d52a2db9 cygwin: add gencat tool
This is needed for compiling catalog files used in catgets(3) calls.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-19 13:19:21 -06:00
Yaakov Selkowitz 2cb24159fb cygwin: add LFS_CFLAGS etc. to confstr/getconf
These are used, for instance, when cross-compiling the Linux kernel.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-16 12:12:45 -06:00
Yaakov Selkowitz c37171b528 cygwin: fix getconf after commit 032aa2dba5
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28 11:36:14 -06:00
Ken Brown 3e8323dc06 winsup/utils/dump_setup.cc: Remove the function 'base'
This was called only on filenames in /etc/setup/installed.db, which
are all basenames anyway.  Moreover, base wasn't correctly handling
filenames containing colons.
2017-10-25 17:02:26 +02:00
Fujii Hironori 4d336756fa cygwin: regtool: encode error messages correctly
Error messages of regtool can't be read, which are encoded in,
for instance, SHIFT_JIS in Japanese Windows.  Fix by using
wide chars instead of multibyte.
2017-06-20 13:17:49 +02:00
Daniel Santos b43e28aef0 strace: Fix "over-optimization" flaw in strace.
Recent versions of gcc are optimizing away the TLS buffer allocated in
main, so we need to tell gcc that it's really used.  RtlSecureZeroMemory
accomplishes this while also inlining the memset.

Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
2017-04-19 20:17:04 +02:00
Jon Turney a9da3e4e67 Make ldd stop after any non-continuable exception
Ensure that ldd always stops when the exception is flagged as
non-continuable.

Also arrange for ldd to exit with a non-zero exit code if something went
wrong which prevented us from listing all dynamic dependencies.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-04-04 18:47:44 +01:00
Corinna Vinschen f5ecacfc6c Generate output with Unix line endings even from Mingw64 utils
This affects cygcheck and strace.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-02-24 20:55:14 +01:00
Jon Turney a15297381d Fix handling of '+' by 'cygcheck -p'
The form data sent to the server should be application/x-www-form-urlencoded

This replaces spaces with '+' before being RFC 1738 encoded, so a literal
'+' must be %-encoded also.

See https://cygwin.com/ml/cygwin/2014-01/msg00287.html et seq.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
2017-01-31 19:55:38 +00:00
Corinna Vinschen 584c6643fe cygutils: Fix resource leak in get_short_paths
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24 16:04:42 +01:00
Corinna Vinschen 9b01c29c04 Fix typo in kill(1)
buf is just a local buffer, sig is ultimately pointing to the
signal string.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24 16:00:28 +01:00
Corinna Vinschen bb7ad4ed64 pldd: Fix resource leak and missing check if fopen failed
Fixes Coverity CID 66903

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:22:34 +02:00
Corinna Vinschen 79edb254ac passwd: Fix potential buffer overflow
Fixes Coverity CID 66956

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:16:30 +02:00
Corinna Vinschen 526107a753 mkgroup/mkpasswd: Fix potential buffer overwrite in corner case
Fixes Coverity CIDs 60076, 60077 and 60081

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 17:04:55 +02:00
Corinna Vinschen 7d5af6f0ba getfacl: Don't trust length of incoming user/groupname
Fixes Coverity CIDs 60079 and 60080

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:52:28 +02:00
Corinna Vinschen cf01b8f029 tzset: Fix array length given to GetGeoInfoW
Fixes Coverity CID 66916

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:45:21 +02:00
Corinna Vinschen 5e087a8373 strace: Fix Coverity issues
CID 66964: Don't trust environment variable without length check
CID 66968: Add missing va_end

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:38:48 +02:00
Corinna Vinschen 9807a501b1 cygcheck: Use snprintf instead of multiple strcat
This not only simplifies the code but also fixes potential
memory corruption

Fixes Coverity CID 66952

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 16:16:22 +02:00
Corinna Vinschen f16f20ff95 cygcheck: Eenable output of Vista++ FS flags
Also, code cleanup

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23 15:57:40 +02:00
Corinna Vinschen 015f6894a0 cygcheck: Eliminate dead code
Fixes Coverity CID 66907

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 22:57:03 +02:00
Corinna Vinschen bbeef8ef3f cygcheck: Fix broken test for invalid wcstombs conversion reading symlinks
Fixes Coverity CID 66905

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 22:53:29 +02:00
Corinna Vinschen 7909b528e5 cygcheck: Fix check for Cygwin symlink
Fixes Coverity CID 66904 and 66906

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 22:50:33 +02:00
Corinna Vinschen 61401f24ef strace: Add comment trying to explain confusing code
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 22:39:31 +02:00
Corinna Vinschen 46c472a1c1 cygcheck: Close with pclose what has been opened with popen
Fixes Coverity CID 66900

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 22:14:34 +02:00
Corinna Vinschen db8bda4b47 Remove unreachable code from passwd(1)
Fixed Coverity CID 66966

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22 21:20:28 +02:00
Ken Brown dda82d1a7b Add _PC_CASE_INSENSITIVE to [f]pathconf
Update the getconf utility to support the new flag as well as
_PC_POSIX_PERMISSIONS and _PC_POSIX_SECURITY.  These were previously
unsupported, probably as an oversight.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-21 13:39:02 +02:00
Corinna Vinschen a157df3165 strace: Don't print exception info for SetThreadName exception
The new functionality to set the thread name for debugging purposes
creates exception debugging events.  These are printed out when running
strace.  Since these exceptions have nothing to do with real exceptions
but are, like breakpoint execptions, expected and non-fatal, don't print
exception info for them.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-31 12:15:29 +02:00
Corinna Vinschen 472e5439e7 Fix passwd getting error 1265 when running on newer Windows
On Windows 8.1 and later, the NetUserChangePassword call apparently
doesn't accept the usual "\\server" string anymore, but requires to
use the "domain" instead, otherwise it emits en error code 1265,
ERROR_DOWNGRADE_DETECTED.  Since this is accepted by pre-8.1 as well,
use the domain indiscriminately when calling NetUserChangePassword
from passwd(1).

While at it, do some minor cleanup in passwd.c.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-31 12:08:34 +02:00
Corinna Vinschen c02ac89f28 Add -i/--input option to locale(1)
The default UI language returned by GetUserDefaultUILanguage does not
necessarily reflect what the user really wants.  E. g., the system could
be en_US, but the desired language is en_CA, without having a CA langpack
installed.

Changing the settings under "Languages" and changing the keyboard layout
is only affecting the so-called  "Input language", while what's returned
by GetUserDefaultUILanguage is the "Display language".  Changing the
latter requires installing MUI langpacks.

Thus, we introduce a way to fetch the "Input language" using the -i or
--input option.

Also clean up documentation of locale(1).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-08-17 10:58:04 +02:00
Corinna Vinschen 85db21730b ldd: Handle executable relocation when setting breakpoint
set_entry_point_break() uses GetModuleInformation to fetch the
address of the exe's entry point.  However, just as with
lpStartAddress from the CREATE_PROCESS_DEBUG_EVENT event, the
returned address is only computed from the PE file header.  It's
not actually the entry point in memory, if the executable is
relocated (ASLR).  See
https://msdn.microsoft.com/en-us/library/windows/desktop/ms684229(v=vs.85).aspx

Convert this to using the info from CREATE_PROCESS_DEBUG_EVENT
combined with the offset from the PE file header's  AddressOfEntryPoint
to deal with relocation.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-02 12:36:05 +02:00
Corinna Vinschen 9f54ceadae ldd: terminate process on hitting breakpoint
So far ldd terminates the inferior process as soon as some thread
is started.  Apparently threads are started from even ntdll.dll
before the main thread of the application is started.  As a result
the dll list is cut short since ldd terminates prematurely.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-07-02 12:27:04 +02:00
Corinna Vinschen c920bf0b01 Reformat some too-long lines
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 18:00:56 +02:00
Corinna Vinschen d21b63594c Set supported Windows release to Windows 10
This affects setting _WIN32_WINNT and WINVER.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 17:51:41 +02:00
Corinna Vinschen b6693e7c17 Remove pre-Vista considerations from utilities
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27 17:50:25 +02:00
Corinna Vinschen 6e623e9320 Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout option
Bump GPLv2+ to GPLv3+ for some files, clarify BSD 2-clause.

Everything else stays under GPLv3+.

New Linking Exception exempts resulting executables from LGPLv3 section 4.

Add CONTRIBUTORS file to keep track of licensing.

Remove 'Copyright Red Hat Inc' comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23 10:09:17 +02:00
Yaakov Selkowitz 8502abb674 winsup/utils: port getconf to 64-bit
The available specifications obviously differ on 32-bit and 64-bit, as
already handled in <sys/features.h>.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2016-04-04 10:25:39 -05:00
Peter Foley 44b72b43d6 Update autoconf for doc/lsaauth/utils
Don't use obsolete LIB_AC_PROG_CC.
Run autoupdate.

winsup/ChangeLog:
doc/aclocal.m4: delete
lsaauth/aclocal.m4: ditto
doc/configure.ac: refactor and update
lsaauth/configure.ac: ditto
utils/configure.ac: ditto
doc/configure: regenerate
lsaauth/configure: regenerate
utils/configure: regenerate

Signed-off-by: Peter Foley <pefoley2@pefoley.com>
2016-04-01 14:04:41 +02:00
Corinna Vinschen 6436024c4c Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET, fix AC_INIT usage
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-30 14:09:19 +02:00