Commit Graph

6399 Commits

Author SHA1 Message Date
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
Christopher Faylor dc5694dc88 * fhandler.h (fhandler_console::dwBufferSize): Delete.
(fhandler_console::dwCursorPosition): Ditto.
(fhandler_console::wAttributes): Ditto.
(fhandler_console::b): New field encompassing previously disparate screen
buffer info.
(fhandler_console::save_bufsize): Rename from savebufsiz
(fhandler_console::save_buf): Rename sfrom savebuf.
(fhandler_console::save_cursor): New field.
(fhandler_console::save_restore): New function.
(fhandler_console::con): Rename from dev_state.
(fhandler_console::focus_aware): Accommodate name change.
* fhandler_console.cc: Use 'b' field of dev_console throughout instead of
disparate names.  Accommodate dev_state -> con rename.
(dev_state:save_restore): New function.  Attempt to save the entire screen
buffer rather than just the visible part.  Clear the buffer when saving, like
Linux.
(fhandler_console::char_command): Use con.save_restore() for Save/restore
screen sequence.
2014-03-09 22:49:56 +00:00
Christopher Faylor bc7c78b225 * sigproc.cc (_cygtls::remove_wq): Reset thread_ev inside of lock. Set to NULL
when done.
2014-03-09 19:25:38 +00:00
Christopher Faylor e8036b41ab * fhandler_console.cc (fhandler_console::char_command): Properly use calculated
value rather than directly using dev_state.args[0].
2014-03-09 18:46:30 +00:00
Christopher Faylor 8e513b0217 * dir.cc (opendir): Propagate any errno from build_fh_name. 2014-03-09 18:39:14 +00:00
Corinna Vinschen 0e8dd88459 * pwdgrp.h (pwdgrp::is_passwd): New inline method.
(pwdgrp::is_group): New inline method.
	(add_account_from_windows): Drop group argument from declaration.
	(fetch_account_from_windows): Ditto.
	(check_file): Ditto.
	(add_user_from_windows): Call add_account_from_windows accordingly.
	(add_group_from_windows): Ditto.
	* uinfo.cc (pwdgrp::add_account_from_windows): Drop group argument.
	Use is_group method instead.
	(pwdgrp::check_file): Ditto.
	(pwdgrp::fetch_account_from_windows): Ditto.
	* grp.cc: Accommodate aforementioned changes.
	* passwd.cc: Ditto.
2014-03-07 20:38:48 +00:00
Corinna Vinschen 29adfd78bd * passwd.cc (pg_ent::enumerate_builtin): Convert pwd_builtins and
grp_builtins to array of cygpsid pointers.  Replace SID strings with
	pointers to well known SIDs.
	* sec_helper.cc (well_known_local_service_sid): Define.
	(well_known_network_service_sid): Define.
	(trusted_installer_sid): Define.
	* security.h (well_known_local_service_sid): Declare.
	(well_known_network_service_sid): Declare.
	(trusted_installer_sid): Declare.
	* uinfo.cc (pwdgrp::fetch_account_from_windows): Throughout set acc_type
	to SidTypeUnknown if LookupAccountXXX function failed.  Create
	simplified passwd entry for non-user accounts, except for LocalSystem.
	Add comment.
2014-03-06 18:54:08 +00:00
Corinna Vinschen b8b4455f8f * setlsapwd.cc (setlsapwd): Use RtlSecureZeroMemory to delete password
from memory.
2014-03-06 17:00:52 +00:00
Corinna Vinschen 5e6b3cafa2 * ldap.cc (rediscover_thread): Remove.
(cyg_ldap::open): Remove code to rediscover DC.  It just won't do the
	right thing.
	(cyg_ldap::enumerate_ad_accounts): Change to be self-sufficient (no
	explicit open call required).  Enumerate on a DC of the domain itself
	instead of relying on delegation.  Remove ill-advised code trying to
	generate rootdse from domain name.
	* passwd.cc (pg_ent::enumerate_ad): Drop explicit call to
	cyg_ldap::open.
2014-03-05 20:58:33 +00:00
Corinna Vinschen 512ecab4a8 * include/cygwin/config.h (__TM_GMTOFF): Define.
(__TM_ZONE): Define.
2014-03-05 12:50:29 +00:00
Corinna Vinschen 27afe3a4ab * localtime.cc: Define TM_GMTOFF and TM_ZONE based on __TM_GMTOFF and
__TM_ZONE being defined.  Throughout, write to these struct tm members
	only if CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS is true.
	* libc/strptime.cc: Ditto.
	* include/cygwin/version.h (CYGWIN_VERSION_CHECK_FOR_EXTRA_TM_MEMBERS):
	Define.
	(CYGWIN_VERSION_API_MINOR): Bump to 272.
2014-03-05 12:45:49 +00:00
Corinna Vinschen 4e3c8d9425 * exception.h (exception::handler_installed): Remove.
(exception::exception): Remove old code.  Manually install SEH handler
	instead.
	(exception::~exception): For x86_64, define frame end label.
	* exceptions.cc (exception::handler_installed): Remove.
2014-03-04 11:56:42 +00:00