aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils
AgeCommit message (Collapse)AuthorFilesLines
2018-01-16cygwin: add LFS_CFLAGS etc. to confstr/getconfYaakov Selkowitz1-0/+4
These are used, for instance, when cross-compiling the Linux kernel. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-11-28cygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47Yaakov Selkowitz1-0/+1
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-10-25winsup/utils/dump_setup.cc: Remove the function 'base'Ken Brown1-16/+1
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-06-20cygwin: regtool: encode error messages correctlyFujii Hironori1-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.
2017-04-19strace: Fix "over-optimization" flaw in strace.Daniel Santos1-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>
2017-04-04Make ldd stop after any non-continuable exceptionJon Turney1-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>
2017-02-24Generate output with Unix line endings even from Mingw64 utilsCorinna Vinschen2-0/+8
This affects cygcheck and strace. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2017-01-31Fix handling of '+' by 'cygcheck -p'Jon Turney1-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>
2016-11-24cygutils: Fix resource leak in get_short_pathsCorinna Vinschen1-0/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-11-24Fix typo in kill(1)Corinna Vinschen1-1/+1
buf is just a local buffer, sig is ultimately pointing to the signal string. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23pldd: Fix resource leak and missing check if fopen failedCorinna Vinschen1-0/+4
Fixes Coverity CID 66903 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23passwd: Fix potential buffer overflowCorinna Vinschen1-1/+2
Fixes Coverity CID 66956 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23mkgroup/mkpasswd: Fix potential buffer overwrite in corner caseCorinna Vinschen2-9/+15
Fixes Coverity CIDs 60076, 60077 and 60081 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23getfacl: Don't trust length of incoming user/groupnameCorinna Vinschen1-2/+2
Fixes Coverity CIDs 60079 and 60080 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23tzset: Fix array length given to GetGeoInfoWCorinna Vinschen1-1/+1
Fixes Coverity CID 66916 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-23strace: Fix Coverity issuesCorinna Vinschen1-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>
2016-10-23cygcheck: Use snprintf instead of multiple strcatCorinna Vinschen1-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>
2016-10-23cygcheck: Eenable output of Vista++ FS flagsCorinna Vinschen1-19/+32
Also, code cleanup Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22cygcheck: Eliminate dead codeCorinna Vinschen1-6/+0
Fixes Coverity CID 66907 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22cygcheck: Fix broken test for invalid wcstombs conversion reading symlinksCorinna Vinschen1-6/+6
Fixes Coverity CID 66905 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22cygcheck: Fix check for Cygwin symlinkCorinna Vinschen1-1/+1
Fixes Coverity CID 66904 and 66906 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22strace: Add comment trying to explain confusing codeCorinna Vinschen1-0/+6
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22cygcheck: Close with pclose what has been opened with popenCorinna Vinschen1-1/+1
Fixes Coverity CID 66900 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-22Remove unreachable code from passwd(1)Corinna Vinschen1-3/+0
Fixed Coverity CID 66966 Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-10-21Add _PC_CASE_INSENSITIVE to [f]pathconfKen Brown1-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>
2016-08-31strace: Don't print exception info for SetThreadName exceptionCorinna Vinschen1-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>
2016-08-31Fix passwd getting error 1265 when running on newer WindowsCorinna Vinschen1-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>
2016-08-17Add -i/--input option to locale(1)Corinna Vinschen1-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>
2016-07-02ldd: Handle executable relocation when setting breakpointCorinna Vinschen1-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>
2016-07-02ldd: terminate process on hitting breakpointCorinna Vinschen1-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>
2016-06-27Reformat some too-long linesCorinna Vinschen1-1/+2
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27Set supported Windows release to Windows 10Corinna Vinschen6-8/+8
This affects setting _WIN32_WINNT and WINVER. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-27Remove pre-Vista considerations from utilitiesCorinna Vinschen4-55/+4
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-06-23Switching the Cygwin DLL to LGPLv3+, dropping commercial buyout optioncygwin-2_5_2-releaseCorinna Vinschen35-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>
2016-04-04winsup/utils: port getconf to 64-bitYaakov Selkowitz1-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>
2016-04-01Update autoconf for doc/lsaauth/utilsPeter Foley1-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>
2016-03-30Replace AC_CANONICAL_SYSTEM with AC_CANONICAL_TARGET, fix AC_INIT usageCorinna Vinschen2-2/+1
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-19winsup: Move all old CVS Changelogs into CVSChangeLogs.old dirCorinna Vinschen4-4721/+0
2016-03-19Remove ill-advised cygwin_propsCorinna Vinschen1-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>
2016-03-15Attempt to fix Coverity issues in sspJon Turney1-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>
2016-03-08Implement POSIX.1e ACL functionsCorinna Vinschen2-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>
2016-02-20ssp: Fixes for 64-bitJon Turney1-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>
2016-01-21cygpath: Avoid returning SysWOW64Corinna Vinschen1-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>
2016-01-07Deprecate all winsup ChangeLog filesCorinna Vinschen2-4288/+4289
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-01-07cygpath: Try to return system directories with correct caseCorinna Vinschen1-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>
2015-12-25setfacl: Remove unused local variableCorinna Vinschen2-1/+5
* setfacl.cc (delacl): Remove unused local variable. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-12-21setfacl(1): Fix handling of -m and -x on a single commandlineCorinna Vinschen2-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>
2015-12-21setfacl(1): Rewrite support for mask recomputationCorinna Vinschen2-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>
2015-12-20setfacl --mask/--no-mask really don't need an argumentHouder2-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>
2015-12-19Fix missing arg requirement for setfacl -x optionHouder2-1/+5
* setfacl.cc (opts): Add colon to x option. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>