Commit Graph

6423 Commits

Author SHA1 Message Date
Corinna Vinschen 9c9f0ee802 * fhandler_process.cc (get_mem_values): Rearrange code slightly to
avoid resource leakage (CID 59973).
	(format_process_stat): Drop temporary variable wcmd and avoid
	string copy without length check (CID 60050).
	(format_process_status): Ditto (CID 60051).
2014-05-20 11:20:02 +00:00
Corinna Vinschen 3ccae7b681 * fhandler_proc.cc (format_proc_swaps): Use tmp_pathbuf for filename,
rather than allocating and forgetting to free (CID 59982).
2014-05-20 11:00:37 +00:00
Corinna Vinschen 3da259f729 * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Fix floppy
drive handling broken with 1.7.19.
2014-05-20 10:25:32 +00:00
Corinna Vinschen 51a895f86d * scandir.cc (scandir): Assume namelist is always valid, per POSIX.
(CID 60021).
	* sec_auth.cc (cygwin_logon_user): Securely erase password copy.
	(lsaprivkeyauth): Avoid trying to dereference data if no key is stored
	in the registry (CID 60122).  Securely erase passwords after usage.
2014-05-20 10:21:34 +00:00
Corinna Vinschen d7dd11b8f3 * pseudo-reloc.cc (__report_error): Raise size of module name buffer to
PATH_MAX.  Fix length in call to GetModuleFileNameW (CID 59947).
2014-05-19 16:56:31 +00:00
Corinna Vinschen e0f53cfe6a * net.cc (call_gaa): Fix setting pa_ret pointer in case of an error
from GetAdaptersAddresses (CID 60218).
	(get_ifs): Add missing braces in AF_INET6 case which broke netmask
	computation.  Break out of loop if prefix gets <= 0 (CID 59939).
2014-05-19 15:57:22 +00:00
Corinna Vinschen a25a812338 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 31. 2014-05-19 14:31:08 +00:00
Corinna Vinschen 9c36b394d9 * dtable.cc (handle_to_fn): Fix length parameter in call to
QueryDosDeviceW (CID 59936).
2014-05-19 11:17:59 +00:00
Corinna Vinschen e928438c6b * pinfo.cc (pinfo_basic::pinfo_basic): Fix size of progname array in
call to GetModuleFileNameW (CID 59935).
2014-05-19 10:46:47 +00:00
Corinna Vinschen 02db8ae1db * smallprintf.cc (__small_vsprintf): Add missing break in 'C' case. 2014-05-19 10:42:04 +00:00
Corinna Vinschen f2e040ce76 * exceptions.cc (try_to_debug): Fix size of dbg_cmd (CID 59929). 2014-05-19 10:28:54 +00:00
Corinna Vinschen 8c14a5065d * syscalls.cc (getusershell): Fix buffer overrun (Coverity ID 59932). 2014-05-19 08:29:47 +00:00
Corinna Vinschen eec106c4ec * external.cc (cygwin_internal): Use local name buffer instead of
allocated one in CW_CYGNAME_FROM_WINNAME.
2014-05-16 12:13:57 +00:00
Corinna Vinschen 2d0cb1acc7 * include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump to 273. 2014-05-15 11:24:42 +00:00
Corinna Vinschen 076a61f0d9 * external.cc (cygwin_internal): Implement CW_CYGNAME_FROM_WINNAME.
Add lengthy comment to explain what we do and why.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add
	CW_CYGNAME_FROM_WINNAME.
2014-05-15 11:16:28 +00:00
Corinna Vinschen 6506454fb3 * sec_auth.cc (get_server_groups): Call get_logon_server only for
non-builtin accounts.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Check incoming
	account name for validity in terms of the current name prefixing rules
	and refuse invalid names.
2014-05-14 11:27:47 +00:00
Corinna Vinschen d4ff931bf8 * fhandler_socket.cc (fhandler_socket::ioctl): Handle the different
ideas of u_long between Winsock and Cygwin applications on x86_64.
	Add long comment.
2014-05-13 16:07:50 +00:00
Christopher Faylor 3ad50ff74a clarify checkin comment 2014-05-10 20:17:54 +00:00
Christopher Faylor fb1565af68 * signal.cc (sigprocmask): Fix strace output to include "how".
* fhandler_console.cc (dev_console::save_restore): Only current dwEnd line
rather than the one after that.
2014-05-09 14:28:48 +00:00
Corinna Vinschen 8764af1eb1 * uinfo.cc (cygheap_user::init): Fix formatting in debug output.
(struct cyg_USER_INFO_24): Define temporarily.  Explain why.
	(pwdgrp::fetch_account_from_windows): Handle sane primary group
	setting for Microsoft Accounts.  Explain why.
	* wincap.h (wincaps::has_microsoft_accounts): New element.
	* wincap.cc: Implement above element throughout.
2014-05-08 19:33:07 +00:00
Corinna Vinschen a5a75a5a98 * grp.cc (gr_ent::enumerate_caches): Fix copy/paste bug introducing
an endless loop.
2014-05-08 08:44:07 +00:00
Corinna Vinschen 03039d4fc2 * passwd.cc (pwdgrp::parse_passwd): Fix an off by one computing the
buffer len.  Add comment.
	* uinfo.cc (internal_getlogin): Fix typo in comment.
2014-05-07 14:49:54 +00:00
Corinna Vinschen 951bc34df4 * uinfo.cc (pwdgrp::fetch_account_from_windows): Tweak SID<->uid
conversion to cover S-1-5-113, S-1-5-114, and S-1-5-1000 groups.
2014-05-07 12:07:12 +00:00
Corinna Vinschen 20de26ebf9 * grp.cc (pwdgrp::parse_group): Set grp.len. Drop generating any
gr_mem entries.
	(getgrgid_r): Don't try to copy gr_mem entries.  Always set gr_mem
	to an empty list.
	(getgrnam_r): Ditto.
	(app_gr): New static struct to store group data propagated to the
	calling application via getgrgid/getgrnam.
	(getgr_cp): Fill app_gr and return pointer to app_gr.g.
	(getgrgid32): Call getgr_cp.
	(getgrnam32): Ditto.
	* passwd.cc (pwdgrp::parse_passwd): Set res.len.
	(app_pw): New static struct to store passwd data propagated to the
	calling application via getpwuid/getpwnam.
	(getpw_cp): Fill app_pw and return pointer to app_pw.p.
	(getpwuid32): Cal getpw_cp.
	(getpwnam): Ditto.
	* pwdgrp.h (struct pg_pwd): Add len member.
	(struct pg_grp): Ditto.
2014-05-07 11:00:00 +00:00
Corinna Vinschen fc3a3524b2 * security.h (MAX_SUBAUTH_CNT): Drop. Use SID_MAX_SUB_AUTHORITIES
instead throughout.
	(MAX_SID_LEN): Drop.  Use SECURITY_MAX_SID_SIZE instead throughout.
2014-05-06 12:28:33 +00:00
Corinna Vinschen 439b7db785 * grp.cc (internal_getgroups): Drop unused cygsid variable.
* sec_helper.cc (cygpsid::pstring): Use sid_sub_auth_count macro.
	(cygsid::get_sid): Use MAX_SUBAUTH_CNT rather than wrong constant 8.
	Don't call memcpy to copy subauthorities into SID, use assignment.
	(cygsid::getfromstr): Use MAX_SUBAUTH_CNT rather than wrong constant 8.
	* security.h (MAX_SUBAUTH_CNT): New definition.  Set to 11 to cover
	Microsoft Accounts.
	(MAX_SID_LEN): Define in terms of SID member sizes and MAX_SUBAUTH_CNT.
	(DBGSID): Use MAX_SUBAUTH_CNT to define size of SubAuthority array.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Handle Micosoft
	Accounts.  Handle them as well known group.  Compare domain names
	case-insensitive.
	* winlean.h (PIPE_REJECT_REMOTE_CLIENTS): Drop temporary definition
	since Mingw64 catched up.
	(DNLEN): Redefine as 16.  Explain why.
2014-05-06 12:02:48 +00:00
Corinna Vinschen 67797a9560 * net.cc (cygwin_getsockopt): Rearrange code slightly and handle
TCP_NODELAY just like SO_KEEPALIVE and SO_DONTROUTE.
2014-05-05 15:18:17 +00:00
Christopher Faylor d8b41bc3d0 * spawn.cc (av::setup): Eat trailing whitespace on #! script. 2014-05-03 19:58:20 +00:00
Christopher Faylor b0aa67c40e * fhandler_dsp.cc (ioctl): Use _ioctl for recursive call. 2014-05-02 15:14:17 +00:00
Christopher Faylor 6e06243942 * DevNotes: Add entry cgf-000026.
* fhandler.h (fhandler_console::save_top): Save top of screen coordinates.
* fhandler_console.cc (dev::save_restore): Record top of screen coordinates.
Clear entire buffer when restoring saved buffer and try to position the cursor
on the save relative place on the screen.
2014-04-26 17:38:22 +00:00
Corinna Vinschen e1c519b41f * syscalls.cc (NT_TRANSACTIONAL_ERROR): Cover all status codes up to
STATUS_TRANSACTION_NOT_ENLISTED.
2014-04-25 14:43:13 +00:00
Corinna Vinschen 8e22028339 * fhandler_socket.cc: On x86_64, define u_long as __ms_u_long before
including the windows headers.  Explain why.
	(get_inet_addr): Convert ANY address to LOOPBACK address.  Explain why.
	(fhandler_socket::evaluate_events): Forcibly set SO_ERROR socket option
	in case a connection attempt failed.  Explain why.
	(fhandler_socket::ioctl): Drop x86_64 re-definition of u_long here.
	* fhandler_procnet.cc: On x86_64, define u_long as __ms_u_long before
	including the windows headers.  Explain why.
	* net.cc: Ditto.
2014-04-24 13:44:23 +00:00
Corinna Vinschen ef7e42ec0f * miscfuncs.cc (check_iovec): Allow 0 as valid iovcnt value. 2014-04-23 15:26:14 +00:00
Corinna Vinschen 93a1517f68 * ldap.cc (user_attr): Remove "uid" attribute.
* ldap.h (LDAP_USER_NAME_ATTR): Remove.  Change other attribute index
	values as required.
	(cyg_ldap::get_user_name): Remove inline function.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Remove code to handle
	Cygwin username different from Windows username.
	(pwdgrp::add_account_from_cygserver): Remove unnecessary cast.
2014-04-22 10:36:35 +00:00
Corinna Vinschen 98c9a93c7d * winf.cc (linebuf::fromargv): Temporarily revert patch from 2014-01-24. 2014-04-18 18:50:21 +00:00
Corinna Vinschen 7ae3e6b3d4 * cygtls.h (TP_NUM_C_BUFS): Raise to 50 to allow SYMLOOP_MAX recursions
path_conv <-> normalize_posix_path, plus a bit of buffer.
	(TP_NUM_W_BUFS): Ditto.
	(class san): Change type of _c_cnt and _w_cnt to unsigned.
	* path.cc (normalize_posix_path): Guard recursion into path_conv
	against tmp_pathbuf overflow.  Generate normalized path in call to
	path_conv.  If the path is valid, replace dst with the normalized_path
	from path_conv call.  Add comment to explain why we're doing this.
	* tls_pbuf.cc (tls_pathbuf::destroy): Only free buffers until the
	first buffer pointer is NULL.
	(tmp_pathbuf::c_get): Simplify error message.
	(tmp_pathbuf::w_get): Ditto.
	* tls_pbuf.h (class tmp_pathbuf): Change type of c_buf_old and w_buf_old
	to unsigned.
	(tmp_pathbuf::check_usage): New inline method to check if we have
	enough tmp_pathbuf buffers left to call a function using tmp_pathbuf
	buffers.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
2014-04-18 14:29:49 +00:00
Corinna Vinschen c0efb4de1c * net.cc (cygwin_setsockopt): Ignore IPV6_TCLASS the same way as IP_TOS. 2014-04-16 08:58:20 +00:00
Corinna Vinschen 91659b43b9 * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix gid evaluation
for local accounts.
2014-04-12 11:10:13 +00:00
Corinna Vinschen 3d6a6ba138 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 30. 2014-04-10 19:20:49 +00:00
Corinna Vinschen 09a7cdcc4b * exceptions.cc (exception::myfault_handle): Only handle the minimum
amount of exceptions the myfault handler was designed for.
2014-04-09 19:20:01 +00:00
Corinna Vinschen 236f226893 * cygwin.sc.in: (Temporarily?) workaround serious ld bug which
truncates symbols in certain computations to 32 bit.  See
	https://sourceware.org/bugzilla/show_bug.cgi?id=16821
2014-04-08 14:13:59 +00:00
Corinna Vinschen 584c857700 * cygserver_ipc.h (ipc_set_proc_info): Add bool parameter to specify
whether or not to send signal_arrived.
	* shm.cc (client_request_shm::client_request_shm): Call
	ipc_set_proc_info with bool parameter set to true to not send
	signal_arrived.
2014-04-07 11:25:58 +00:00
Corinna Vinschen b283470e51 * ntea.cc (EA_BUFSIZ): Fix comment.
(read_ea): Use tmp_pathbuf for local buffer rather than alloca.
	Throughout change ZwQueryEaFile to NtQueryEaFile in comments.
2014-04-04 14:26:05 +00:00
Corinna Vinschen 54b7688e0d * ntea (EA_BUFSIZ): Reduce to 64K. Add comment to explain why. 2014-04-04 13:38:42 +00:00
Christopher Faylor c6eaf1f3f7 * DevNotes: Add entry cgf-000025.
* exceptions.cc (_cygtls::signal_debugger): Reorganize to avoid contacting the
debugger if we have already done so via the exception handler.  Eliminate need
for goto.  Remove an ifdef in favor of just allocating a larger buffer.
2014-03-29 21:16:09 +00:00
Corinna Vinschen 20738749f6 * dcrt0.cc (dll_crt0_0): Install myfault exception handler on x86_64.
* exception.h (exception_list): Typedef as void on x86_64.
	(exception::handler_installed): Remove.
	(exception::handle_while_being_debugged): Remove.
	(exception::myfault_handle): Declare for x86_64.
	(exception::handle): Declare as ordinary exception handler on x86_64
	as well.
	(exception::exception): Drop previous code (again).  Install
	exception::handle as SEH handler.
	(exception::install_myfault_handler): New x86_64-only method to
	install exception::myfault_handle as VEH handler.  Explain why.
	(exception::~exception): For x86_64, define frame end label (again).
	* exceptions.cc (CYG_EXC_CONTINUE_EXECUTION): Drop definition.
	(CYG_EXC_CONTINUE_SEARCH): Ditto.
	(exception::myfault_handle): New x86_64-only method, VEH handler to
	handle myfault exceptions.
	(exception::handle): Define as ordinary exception handler on x86_64
	as well.  Use ExceptionContinueExecution and ExceptionContinueSearch
	throughout instead of deleted Cygwin macros.  Don't handle myfault
	exceptions on x86_64.
2014-03-28 22:31:53 +00:00
Corinna Vinschen 58cc7a6498 * sec_auth.cc (create_token): Initialize lsa handle to NULL, rather than
to INVALID_HANDLE_VALUE.
	(lsaauth): Ditto.
	(lsaprivkeyauth): Ditto.
	* setlsapwd.cc (setlsapwd): Don't initialize lsa handle.
2014-03-28 20:34:04 +00:00
Corinna Vinschen c16097ed26 * exceptions.cc (_cygtls::signal_debugger): Move memcpy to copy context
from incoming siginfo_t to thread_context, too.
2014-03-28 16:56:03 +00:00
Corinna Vinschen 50b0a28824 * gendef (_sigbe/x86_64): Fix typo in .seh_proc pseudo-op.
(setjmp/x86_64): Drop storing ExceptionList pointer in jmp_buf->Frame.
	Drop comment.  Store likely frame in rdx.  Jump to __setjmpex.
	(__setjmpex): New function providing setjmp functionality.  Fetch
	jmp_buf->Frame from rdx, like MSVCRT setjmpex.
	(__sjfault/x86_64): Store rdx content in jmp_buf->Frame.
	(__ljfault/x86_64): Don't restore ExceptionList pointer.
	(longjmp/x86_64): Ditto.
2014-03-27 19:35:55 +00:00
Christopher Faylor 364f6915f8 * fhandler_dsp.cc (fhandler_dev_dsp::ioctl): Actually pass ioctl argument to
_ioctl.
2014-03-20 02:23:52 +00:00