summaryrefslogtreecommitdiffstats
path: root/winsup/utils
Commit message (Collapse)AuthorAgeFilesLines
* cygwin: regtool: encode error messages correctlyFujii Hironori2017-06-201-5/+6
| | | | | | 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.
* strace: Fix "over-optimization" flaw in strace.Daniel Santos2017-04-191-1/+1
| | | | | | | | 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>
* Make ldd stop after any non-continuable exceptionJon Turney2017-04-041-1/+9
| | | | | | | | | | 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>
* Generate output with Unix line endings even from Mingw64 utilsCorinna Vinschen2017-02-242-0/+8
| | | | | | This affects cygcheck and strace. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix handling of '+' by 'cygcheck -p'Jon Turney2017-01-311-2/+2
| | | | | | | | | | | 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>
* cygutils: Fix resource leak in get_short_pathsCorinna Vinschen2016-11-241-0/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix typo in kill(1)Corinna Vinschen2016-11-241-1/+1
| | | | | | | buf is just a local buffer, sig is ultimately pointing to the signal string. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* pldd: Fix resource leak and missing check if fopen failedCorinna Vinschen2016-10-231-0/+4
| | | | | | Fixes Coverity CID 66903 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* passwd: Fix potential buffer overflowCorinna Vinschen2016-10-231-1/+2
| | | | | | Fixes Coverity CID 66956 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* mkgroup/mkpasswd: Fix potential buffer overwrite in corner caseCorinna Vinschen2016-10-232-9/+15
| | | | | | Fixes Coverity CIDs 60076, 60077 and 60081 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* getfacl: Don't trust length of incoming user/groupnameCorinna Vinschen2016-10-231-2/+2
| | | | | | Fixes Coverity CIDs 60079 and 60080 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* tzset: Fix array length given to GetGeoInfoWCorinna Vinschen2016-10-231-1/+1
| | | | | | Fixes Coverity CID 66916 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* strace: Fix Coverity issuesCorinna Vinschen2016-10-231-2/+6
| | | | | | | CID 66964: Don't trust environment variable without length check CID 66968: Add missing va_end Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Use snprintf instead of multiple strcatCorinna Vinschen2016-10-231-4/+1
| | | | | | | | | This not only simplifies the code but also fixes potential memory corruption Fixes Coverity CID 66952 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Eenable output of Vista++ FS flagsCorinna Vinschen2016-10-231-19/+32
| | | | | | Also, code cleanup Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Eliminate dead codeCorinna Vinschen2016-10-221-6/+0
| | | | | | Fixes Coverity CID 66907 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Fix broken test for invalid wcstombs conversion reading symlinksCorinna Vinschen2016-10-221-6/+6
| | | | | | Fixes Coverity CID 66905 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Fix check for Cygwin symlinkCorinna Vinschen2016-10-221-1/+1
| | | | | | Fixes Coverity CID 66904 and 66906 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* strace: Add comment trying to explain confusing codeCorinna Vinschen2016-10-221-0/+6
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygcheck: Close with pclose what has been opened with popenCorinna Vinschen2016-10-221-1/+1
| | | | | | Fixes Coverity CID 66900 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove unreachable code from passwd(1)Corinna Vinschen2016-10-221-3/+0
| | | | | | Fixed Coverity CID 66966 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Add _PC_CASE_INSENSITIVE to [f]pathconfKen Brown2016-10-211-0/+3
| | | | | | | | 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>
* strace: Don't print exception info for SetThreadName exceptionCorinna Vinschen2016-08-311-2/+6
| | | | | | | | | | 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>
* Fix passwd getting error 1265 when running on newer WindowsCorinna Vinschen2016-08-311-43/+49
| | | | | | | | | | | | | 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>
* Add -i/--input option to locale(1)Corinna Vinschen2016-08-171-2/+7
| | | | | | | | | | | | | | | | | | | 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>
* ldd: Handle executable relocation when setting breakpointCorinna Vinschen2016-07-021-23/+24
| | | | | | | | | | | | | | | | 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>
* ldd: terminate process on hitting breakpointCorinna Vinschen2016-07-021-4/+1
| | | | | | | | | 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>
* Reformat some too-long linesCorinna Vinschen2016-06-271-1/+2
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Set supported Windows release to Windows 10Corinna Vinschen2016-06-276-8/+8
| | | | | | This affects setting _WIN32_WINNT and WINVER. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Remove pre-Vista considerations from utilitiesCorinna Vinschen2016-06-274-55/+4
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen2016-06-2335-110/+30
| | | | | | | | | | | | | | 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>
* winsup/utils: port getconf to 64-bitYaakov Selkowitz2016-04-041-12/+23
| | | | | | | 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>
* Update autoconf for doc/lsaauth/utilsPeter Foley2016-04-011-4/+4
| | | | | | | | | | | | | | | | | 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>
* Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET, fix AC_INIT usageCorinna Vinschen2016-03-302-2/+1
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* winsup: Move all old CVS Changelogs into CVSChangeLogs.old dirCorinna Vinschen2016-03-194-4721/+0
|
* Remove ill-advised cygwin_propsCorinna Vinschen2016-03-191-116/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cygwin_props have been invented to allow switching off the unique installation keys in the first place, supposedly for debugging. This never really was a good idea, after all we *want* the installations to be independent and there's no good reason to break that, not even for debugging purposes. Other than that, cygwin_props were meant to be used for some other global settings which never took place. There's just no good reason to tweak the DLL binary invisibly where a setting could be done in a file or the environment. This patch removes the cygwin_props entirely, including the related settings in cygcheck. cygwin: * cygprops.h: Remove file. * globals.cc (cygwin_props): Remove. * cygheap.cc (init_cygheap::init_installation_root): Drop removing installation key. utils: * cygcheck.cc: Drop including cygprops.h. Remove now unused option values. (unique_object_name_opt): Remove. (handle_unique_object_name): Remove function. (usage): Remove text for unique-object-names options. (longopts): Remove unique-object-names options. (main): Drop handling unique-object-names options. doc: * utils.xml (cygcheck): Remove text for unique-object-names options. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Attempt to fix Coverity issues in sspJon Turney2016-03-151-6/+17
| | | | | | | | | | * ssp.c (lookup_thread_id): Consistently check if tix is a null pointer. (run_program): Annotate that STATUS_BREAKPOINT falls-through to STATUS_SINGLE_STEP case. (main): Guard against high_pc-low_pc overflow and malloc failure. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* Implement POSIX.1e ACL functionsCorinna Vinschen2016-03-082-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.in (DLL_OFILES): Add sec_posixacl.o. (SUBLIBS): Add libacl.a (libacl.a): New rule to create libacl.a. * common.din: Export POSIX ACL functions as well as most libacl.a extensions. * fhandler.h (fhander_base::acl_get): New prototype. (fhander_base::acl_set): Ditto. (fhandler_disk_file::acl_get): Ditto. (fhandler_disk_file::acl_set): Ditto. * include/acl/libacl.h: New file. * include/cygwin/version.h: Bump API minor version. * include/sys/acl.h: Drop including cygwin/acl.h. Accommodate throughout Cygwin. Add POSIX ACL definitions. * sec_acl.cc: Include sec_posixacl.h. Replace ILLEGAL_UID and ILLEGAL_GID with ACL_UNDEFINED_ID where sensible. (__aclcheck): New internal acl check function to be used for Solaris and POSIX ACLs. (aclcheck32): Call __aclcheck. (__aclcalcmask): New function to compute ACL_MASK value. (__aclsort): New internal acl sort function to be used for Solaris and POSIX ACLs. (aclsort32): Call __aclsort. (permtostr): Work directly on provided buffer. (__acltotext): New internal acltotext function to be used for Solaris and POSIX ACLs. (acltotext32): Call __acltotext. (__aclfromtext): New internal aclfromtext function to be used for Solaris and POSIX ACLs. (aclfromtext32): Call __aclfromtext. * sec_posixacl.cc: New file implemeting POSIX ACL functions. * sec_posixacl.h: New internal header. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* ssp: Fixes for 64-bitJon Turney2016-02-201-105/+119
| | | | | | | | | | | | | | | Fix various 32/64-bit portability issues in ssp, the single-step profiler, and also build it for 64-bit. This didn't turn out to actually be very useful for what I wanted to use it for, so it's only been lightly tested. It appears that on x86_64, single-step exceptions occur for much more of the code in system DLLs, unlike x86, so ssp may take much, much longer to profile some programs. There is existing code to use breakpoints to mitigate this, but that is currently disabled. Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
* cygpath: Avoid returning SysWOW64Corinna Vinschen2016-01-211-0/+13
| | | | | | | | | | | | | | | | | | | | | On Cygwin 32 running under WOW64: When case-correcting the path fetched with -S, the underlying Windows function fetching the normalized path returns the real path C:\Windows\SysWOW64 instead of the path redirection enabled C:\Windows\System32 path. This breaks using the result of `cygpath -S' to fetch the POSIX path of the network related files under SYSTEMROOT\drivers\etc. This path is in fact under the *real* C:\Windows\System32 and only mapped into the 32 bit C:\Windows\System32 (aka C:\Windows\SysWOW64) via path redirection. Sounds messy? This patch checks if we're running under WOW64. If so, it changes the path returned by GetSystemDirectoryW from "system32" to "Sysnative". This in turn is changed to "System32" by NtQueryInformationFile, so we're back to what we need. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Deprecate all winsup ChangeLog filesCorinna Vinschen2016-01-072-4288/+4289
| | | | Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* cygpath: Try to return system directories with correct caseCorinna Vinschen2016-01-071-14/+36
| | | | | | | | | * cygpath.cc (do_sysfolders): Drop lame workaround to fix case of directory returned by GetSystemDirectoryW. Try to fix case of any path returned by this function in case it has to return a POSIX path to support case-sensitivity. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl: Remove unused local variableCorinna Vinschen2015-12-252-1/+5
| | | | | | * setfacl.cc (delacl): Remove unused local variable. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl(1): Fix handling of -m and -x on a single commandlineCorinna Vinschen2015-12-212-9/+28
| | | | | | | | * setfacl.cc (delace): New helper function to delete a single ACE. (delacl): Call delace. (modacl): Ditto, if entry is supposed to get deleted. Align comments. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl(1): Rewrite support for mask recomputationCorinna Vinschen2015-12-212-30/+62
| | | | | | | | | | | | | | | | * 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>
* setfacl --mask/--no-mask really don't need an argumentHouder2015-12-202-2/+7
| | | | | | | * setfacl.cc (longopts): Drop accidentally requiring an argument to the --mask and --no-mask options. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Fix missing arg requirement for setfacl -x optionHouder2015-12-192-1/+5
| | | | | | * setfacl.cc (opts): Add colon to x option. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* Allow cygwin_conv_path(3) and cygpath(1) to emit /proc/cygdrive prefixed pathCorinna Vinschen2015-12-062-6/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fix SEGV of kill -l 0Michael Kwasigroch2015-11-262-3/+8
| | | | | | | * kill.cc (strsigno): Don't call sys_sigabbrev for signal 0. (listsig): Don't call strsigno for signal 0. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
* setfacl: Allow to combine -b and -k optionsCorinna Vinschen2015-11-182-125/+138
| | | | | | | | | | | | | | | * 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>