Commit Graph

6410 Commits

Author SHA1 Message Date
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
Christopher Faylor 71f36ed3c2 * fhandler.h (fhandler_dev_dsp): Remove variable names from declarations.
(fhandler_dev_dsp::close_audio_in): Make __reg1.
(fhandler_dev_dsp::close_audio_out): Make __reg2.
* fhandler_dev_dsp.cc (fhandler_dev_dsp::close_audio_in): Make __reg1.
(fhandler_dev_dsp::close_audio_out): Make __reg2.
(fhandler_dev_dsp::close): Don't abruptly terminate sound just because we are
exiting.
2014-03-19 20:43:15 +00:00
Corinna Vinschen 2c1e724ba4 * exception.h (exception::handle_while_being_debugged): Declare.
(exception::exception): Install unhandled exception filter.
	* exceptions.cc (exception::handle_while_being_debugged): New method.
2014-03-19 16:08:21 +00:00
Corinna Vinschen bdd04d0a62 Fix ChangeLog 2014-03-19 13:06:06 +00:00
Corinna Vinschen 40e0c34e9c * fhandler_dsp.cc (fhandler_dev_dsp::fixup_after_fork): Actually call
_fixup_after_fork rather than looping forever.
	(fhandler_dev_dsp::fixup_after_exec): Ditto.
2014-03-19 13:05:33 +00:00
Christopher Faylor 203cd39dfe * fhandler_dsp.cc (fhandler_dev_dsp::fixup_after_fork): Actually call
_fixup_after_fork rather than looping forever.
(fhandler_dev_dsp::fixup_after_exec): Ditto.
2014-03-18 20:17:03 +00:00
Corinna Vinschen 8c0389d330 Partially revert patch from 2014-03-04.
* exception.h (exception::handler_installed): Declare.
	(exception::exception): Install vectored exception handler on x86_64.
	(exception::~exception): Remove for x86_64.
	* exceptions.cc (exception::handler_installed): Define.
2014-03-18 13:51:18 +00:00
Christopher Faylor 4f0b5a097d * sigproc.h (no_thread_exit_protect): New class.
* sigproc.cc (thread_exit): Use no_thread_exit_protect to determine if we need
to coordinate ThreadExit/ExitProcess.
* fhandler_dsp.cc (fhandler_dev_dsp::Audio_out::stop): Use
no_thread_exit_protect to kludge around waiting for waveOutClose as it waits
for a thread that never exits.
(fhandler_dev_dsp::Audio_in::stop): Ditto for waveInClose.
* fhandler.h (fhandler_dev_dsp::base): New method.
(fhandler_dev_dsp::_read): Ditto.
(fhandler_dev_dsp::_write): Ditto.
(fhandler_dev_dsp::_ioctl): Ditto.
(fhandler_dev_dsp::_fixup_after_fork): Ditto.
(fhandler_dev_dsp::_fixup_after_exec): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::read): Call real function via base()
pointer.
(fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::ioctl): Ditto.
(fhandler_dev_dsp::fixup_after_fork): Ditto.
(fhandler_dev_dsp::fixup_after_exec): Ditto.
(fhandler_dev_dsp::_read): Rename by adding an leading underscore.
(fhandler_dev_dsp::_write): Ditto.
(fhandler_dev_dsp::_ioctl): Ditto.
(fhandler_dev_dsp::_fixup_after_fork): Ditto.
(fhandler_dev_dsp::_fixup_after_exec): Ditto.
2014-03-17 04:41:35 +00:00
Corinna Vinschen 29b7313d22 * cygheap.h (enum cygheap_pwdgrp::cache_t): Remove.
(cygheap_pwdgrp::caching): Convert to bool.
	(cygheap_pwdgrp::pwd_cache): Add cygserver member.
	(cygheap_pwdgrp::grp_cache): Ditto.
	(cygheap_pwdgrp::nss_db_caching): Drop.
	(cygheap_pwdgrp::nss_db_full_caching): Drop.
	(cygheap_pwdgrp::nss_cygserver_caching): New method.
	(cygheap_pwdgrp::nss_disable_cygserver_caching): New method.
	* cygserver.h (client_request::request_code_t): Add
	CYGSERVER_REQUEST_PWDGRP.
	* cygserver_pwdgrp.h: New file.
	* cygtls.h (struct _local_storage): Remove pwbuf and grbuf members.
	* grp.cc (pwdgrp::prep_tls_grbuf): Drop.
	(internal_getgrsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getgrnam): Ditto.
	(internal_getgrgid): Ditto.
	(gr_ent::enumerate_caches): Handle cygserver cache.
	* passwd.cc (pwdgrp::prep_tls_pwbuf): Drop.
	(internal_getpwsid): Handle cygserver caching and rearrange to check
	the caches first.
	(internal_getpwnam): Ditto.
	(internal_getpwuid): Ditto.
	(pw_ent::enumerate_caches): Handle cygserver cache.
	* pwdgrp.h (pwdgrp::add_account_from_cygserver): New method declaration.
	(pwdgrp::fetch_account_from_cygserver): New method declaration.
	(pwdgrp::prep_tls_pwbuf): Drop declaration.
	(pwdgrp::prep_tls_grbuf): Drop declaration.
	(pwdgrp::add_user_from_cygserver): New inline methods.
	(pwdgrp::add_group_from_cygserver): New inline methods.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
	* uinfo.cc (internal_getlogin): Call internal_getgroups if cygserver
	caching is not available.
	(cygheap_pwdgrp::init): Initialize pwd_cache.cygserver and
	grp_cache.cygserver.  Set caching to true.
	(cygheap_pwdgrp::nss_init_line): Drop db_cache handling entirely.
	(pwdgrp::add_account_from_windows): Drop no caching handling.
	(client_request_pwdgrp::client_request_pwdgrp): New method.
	(pwdgrp::fetch_account_from_cygserver): New method.
	(pwdgrp::add_account_from_cygserver): New method.

	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Fix formatting.
	* include/sys/cygwin.h: Ditto.
2014-03-12 17:36:56 +00:00
Corinna Vinschen e4f48af0fd * uinfo.cc (pwdgrp::fetch_account_from_windows): Avoid crash on
non-domain member machines if an unknown SID comes in.
2014-03-12 15:46:07 +00:00
Corinna Vinschen 8861a80ee8 * include/cygwin/socket.h (IPV6_JOIN_GROUP): Revert.
(IPV6_LEAVE_GROUP): Ditto.
2014-03-12 09:44:33 +00:00
Christopher Faylor 5c66535df9 * fhandler.h (dev_console::b): Redefine as CONSOLE_SCREEN_BUFFER_INFO for use
with older OS.
* fhandler_console.cc (dev_console::fillin): Ditto for
GetConsoleScreenBufferInfo.
2014-03-10 18:18:56 +00:00
Christopher Faylor ebfec24391 * fhandler_console.cc (dev_console::save_restore): Save entire line of current
cursor position.
2014-03-10 17:33:17 +00:00
Christopher Faylor cda5aac102 * fhandler_console.cc (fhandler_console::save_restore): Save only until last
written row and, because of this, don't bother trying to restore the screen
buffer size.  Set cursor position after refilling buffer.
(fhandler_console::write): Use absolute paths when saving/restoring cursor
position or suffer odd problems after a saved screen is restored.
2014-03-10 03:15:39 +00:00