Commit Graph

6681 Commits

Author SHA1 Message Date
Corinna Vinschen 0c326d84b5 * spawn.cc (child_info_spawn::worker): Fix formatting. 2014-12-02 10:09:13 +00:00
Corinna Vinschen adc07b999f * sec_auth.cc (str2lsa): Remove.
(str2buf2lsa): Remove.
	(lsaauth): Call RtlInitAnsiString instead of str2lsa and str2buf2lsa.
2014-12-02 10:04:53 +00:00
Corinna Vinschen f5dc13757f * cygheap.cc (init_cygheap::init_installation_root): Fix typo in
comment.
2014-12-02 09:59:53 +00:00
Corinna Vinschen 79a6cc4d49 * autoload.cc (IdnToAscii): Use simpler, equivalent LoadDLLfuncEx.
(IdnToUnicode): Ditto.
2014-12-02 09:59:01 +00:00
Corinna Vinschen 9e9d7a8ce1 * wincap.cc (wincap_minimal): Remove.
(wincaps): Drop has_physical_mem_access.
	(wincap_10): New global wincaps to support Windows 10.
	(wincapc::init): Use wincap_10 for version >= 6.4 and as default.
	* wincap.h (wincaps::has_physical_mem_access): remove.
2014-12-01 14:02:55 +00:00
Corinna Vinschen 26158dc3e9 * cygheap.cc (init_cygheap::init_tls_list): Accommodate threadlist
having a new type threadlist_t *.  Convert commented out code into an
	#if 0.  Create thread mutex.  Explain why.
	(init_cygheap::remove_tls): Drop timeout value.  Always wait infinitely
	for tls_sentry.  Return mutex HANDLE of just deleted threadlist entry.
	(init_cygheap::find_tls): New implementation taking tls pointer as
	search parameter.  Return threadlist_t *.
	(init_cygheap::find_tls): Return threadlist_t *.  Define ix as auto
	variable.  Drop exception handling since crash must be made impossible
	due to correct synchronization.  Return with locked mutex.
	* cygheap.h (struct threadlist_t): Define.
	(struct init_cygheap): Convert threadlist to threadlist_t type.
	(init_cygheap::remove_tls): Align declaration to above change.
	(init_cygheap::find_tls): Ditto.
	(init_cygheap::unlock_tls): Define.
	* cygtls.cc (_cygtls::remove): Unlock and close mutex when finishing.
	* exceptions.cc (sigpacket::process): Lock _cygtls area of thread before
	accessing it.
	* fhandler_termios.cc (fhandler_termios::bg_check): Ditto.
	* sigproc.cc (sig_send): Ditto.
	* thread.cc (pthread::exit): Ditto.  Add comment.
	(pthread::cancel): Ditto.
2014-11-28 20:46:13 +00:00
Corinna Vinschen 9d2eff6684 * cygheap.cc (init_cygheap::find_tls): Add comment.
* cygtls.cc (well_known_dlls): Rephrase comment.
	(bloda_detect): New function.
	(_cygtls::call2): Call init_thread and bloda_detect for non-pthread
	threads only.
	(_cygtls::remove): Move remove_tls and remove_wq calls up to run first.
	* miscfuncs.cc (struct pthread_wrapper_arg): Rename from struct
	thread_wrapper_arg.
	(pthread_wrapper): Rename from thread_wrapper and drop "static".  Fix
	comment.  Drop call to _cygtls::remove.  Call api_fatal rather than
	ExitThread.  Explain why.
	* miscfuncs.h (pthread_wrapper): Declare pthread_wrapper.
	* thread.cc (pthread::exit): Add a FIXME comment.  Call _cygtls::remove
	before calling ExitThread.
2014-11-28 12:10:12 +00:00
Corinna Vinschen e7d7418270 * mount.cc (mount_info::init): Take bool argument and allow to
initialize mount table in two steps, system and user, depending on
	bool value.
	* mount.h (class mount_info): Align declaration of init function to
	above change.
	* shared.cc (user_info::initialize): Initialize mount table in two
	steps to allow internal_getpwsid to create valid POSIX paths from
	DOS paths given in AD.  Add comments.
	* uinfo.cc (cygheap_pwdgrp::get_home): Allow DOS paths in
	NSS_SCHEME_FREEATTR attributes.
	(cygheap_pwdgrp::get_shell): Ditto.
2014-11-27 16:49:41 +00:00
Corinna Vinschen db880b5642 * cygheap.cc (init_cygheap::find_tls): Allow to keep loop going after
access to threadlist[ix] faulted.  In case of an exception, remove
	threadlist[ix] from threadlist only.  Add comment.
2014-11-27 16:20:14 +00:00
Corinna Vinschen 93d15b36ef * Makefile.in (install): Add install-ldif target.
(install-ldif): New target to install cygwin.ldif.
	* cygheap.h (class cygheap_pwdgrp): Rename pfx_t to nss_pfx_t.  Add
	PFX to enum value.  Add nss_scheme_method enum and nss_scheme_t
	structure.  Add home_scheme, shell_scheme and gecos_scheme members.
	(NSS_SCHEME_MAX): Define.
	(cygheap_pwdgrp::get_home): Declare.
	(cygheap_pwdgrp::get_shell): Declare.
	(cygheap_pwdgrp::get_gecos): Declare.
	* cygwin.ldif: New file.
	* ldap.cc (std_user_attr): New array, just defining the standard
	attributes.
	(group_attr): Add cygwinUnixGid.
	(user_attr): Convert to macro pointing to cygheap->pg.ldap_user_attr.
	(cygheap_pwdgrp::init_ldap_user_attr): New method.
	(cyg_ldap::fetch_ad_account): Call cygheap_pwdgrp::init_ldap_user_attr
	if user_attr initialization is required.  Fix comment.
	(cyg_ldap::get_string_attribute): Implement taking attribute name
	as argument.
	* ldap.h: Drop unused macros.
	(cyg_ldap::get_gecos): Remove.
	(cyg_ldap::get_home): Remove.
	(cyg_ldap::get_shell): Remove.
	(cyg_ldap::get_string_attribute): Declare name argument variant public.
	* uinfo.cc (cygheap_user::ontherange): Fix indentation.
	(cygheap_pwdgrp::init): Initialize new home_scheme, shell_scheme and
	gecos_scheme members.  Align comment.
	(NSS_NCMP): Define comparison macro.
	(NSS_CMP): Ditto.
	(cygheap_pwdgrp::nss_init_line): Use aforementioned macros throughout.
	Fix comment handling.  Add db_home, db_shell and db_gecos handling.
	(fetch_from_description): New function to fetch XML-style attributes
	from (description) string.
	(fetch_from_path): New function to evaluate path string with wildcards.
	(cygheap_pwdgrp::get_home): New methods to fetch pw_dir value.
	(cygheap_pwdgrp::get_shell): Ditto for pw_shell.
	(cygheap_pwdgrp::get_gecos): Ditto for pw_gecos.
	(colon_to_semicolon): Move up.
	(pwdgrp::fetch_account_from_windows): Convert home, shell, gecos
	variables to char*.  Drop statement breaking extended group info.
	Fetch home, shell and gecos values using new methods.  Use
	fetch_from_description calls to fetch UNIX id and primary groups from
	SAM comment field.  Accommodate uxid being a char* now.  Accommodate
	the fact that extended info is malloc'ed, rather then alloca'ed.
	Create linebuf content as multibyte string.  Create line buffer by
	just calling cstrdup.
2014-11-26 19:46:59 +00:00
Corinna Vinschen cda7e6ca20 * include/fcntl.h: Move all open flags (except O_NDELAY) to newlib's
sys/_default_fcntl.h.
2014-11-25 11:42:20 +00:00
Corinna Vinschen d8ba3ea1db * binmode.c (cygwin_premain0): Don't use underscore'd variants of the
open flags.
	* textmode.c (cygwin_premain0): Ditto.
2014-11-25 11:27:12 +00:00
Corinna Vinschen 764d261276 * init.cc (dll_entry): Revert previous patch. This requires another
solution.
	* miscfuncs.cc (thread_wrapper): Ditto.
	* sigproc.cc (exit_thread): Disable sending a signal for synchronization
	with process exit.  Explain why.  Keep code in for later inspection,
	should the problem show up again.
	(sig_send): Use "tls", rather than "tid" as name for _cygtls arg.
2014-11-21 21:41:37 +00:00
Corinna Vinschen f2a0724fca * init.cc (dll_entry): Call _my_tls.remove with INFINITE wait period
to avoid SEGVs and subsequent hangs in _cygtls::find_tls.
	* miscfuncs.cc (thread_wrapper): Ditto.
2014-11-20 16:23:14 +00:00
Corinna Vinschen f70b9c32d5 * net.cc (fdsock): Change default values for socket buffers on 32 bit
to fix performance on 10Gb networks.
2014-11-20 08:29:31 +00:00
Corinna Vinschen 5c6a0f3117 * uinfo.cc (pwdgrp::fetch_account_from_windows): Allow fetching of
NT SERVICE accounts by name.  Always prepend domain to NT SERVICE
	accounts.  Add U-domain\username string to pw_gecos for predefined
	builtin accounts as well.
2014-11-17 10:09:01 +00:00
Corinna Vinschen 1243cefd78 * fhandler_termios.cc (fhandler_termios::line_edit): Fix fatal typo in
bytes_read pointer checks.
2014-11-14 10:57:45 +00:00
Corinna Vinschen 73742508fc * fhandler.h (fhandler_termios::line_edit): Add parameter to return
written bytes.
	* fhandler_termios.cc (fhandler_termios::tcinit): Fix formatting.
	(fhandler_termios::line_edit): Return bytes actually written.  Write
	in 32 byte chunks in non-canonical mode to reduce number of WriteFile
	calls.  Don't just eat unwritten bytes in case of an error condition.
	Especially, don't report them back to the caller as written.
	* fhandler_tty.cc (fhandler_pty_slave::read): Disable code reducing
	the number of bytes read from the pipe to vmin.  Add comment.
	(fhandler_pty_master::write): Convert ret to ssize_t type.  Just call
	line_edit once, not in a loop once for each byte.  Return bytes written
	as returned by line_edit.
2014-11-13 18:37:15 +00:00
Corinna Vinschen d544f256d1 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 34.
* new-features.xml (ov-new1.7.34): Add new section.
	(ov-new1.7.33): Reflect intermediate 1.7.33 release.
2014-11-13 13:10:26 +00:00
Corinna Vinschen 54f79f8650 * cygheap.h (cygheap_pwdgrp): Remove constants NSS_FILES and NSS_DB.
Use NSS_SRC_FILES and NSS_SRC_DB throughout instead.
	(cygheap_pwdgrp::nss_pwd_src): New inline method.
	(cygheap_pwdgrp::nss_grp_src): Ditto.
	* external.cc (cygwin_internal): Add CW_GETNSS_PWD_SRC and
	CW_GETNSS_GRP_SRC cases.
	* uinfo.cc: Use NSS_SRC_FILES and NSS_SRC_DB throughout.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_GETNSS_PWD_SRC
	and CW_GETNSS_GRP_SRC.
	(NSS_SRC_FILES): Define.
	(NSS_SRC_DB): Define.
2014-11-12 11:19:08 +00:00
Corinna Vinschen 3daf2dc4f1 * dcrt0.cc (cygwin__cxa_atexit): Fetch correct DSO handle value
by searching dll list.  Explain why.
2014-11-07 08:33:22 +00:00
Corinna Vinschen dfc361dad4 * dcrt0.cc (cygwin_atexit): Change preceeding comment to reflect
API version numbers.
	* external.cc (cygwin_internal): disable setting cxx_malloc on 64 bit.
	Add CW_FIXED_ATEXIT case.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_FIXED_ATEXIT.
	* lib/atexit.c (atexit): Test running Cygwin version by checking
	return value of cygwin_internal (CW_FIXED_ATEXIT).
2014-11-06 15:32:21 +00:00
Corinna Vinschen e5e6b6c49f * lib/atexit.c (atexit): Check for being linked into the executable.
If so, call __cxa_atexit with NULL DSO handle.  Explain why.
	* lib/dso_handle.c: New file providing fallback __dso_handle.
2014-11-05 16:26:18 +00:00
Corinna Vinschen 4d67bb4936 * Makefile.in (NEW_FUNCTIONS): Add atexit to be not exported.
* lib/atexit.c (atexit): New, statically linkable version of atexit.
	* dcrt0.cc (cygwin_atexit): Add comment to mark this function as old
	entry point.  Indiscriminately check for DSO of function pointer for
	all functions, if checking for DSO of return address fails on x86_64.
	Change comment accordingly.
2014-11-05 09:48:00 +00:00
Corinna Vinschen a2ba36a67d * Makefile.in (NEW_FUNCTIONS): Define target-independent. Add target
dependent stuff afterwards.  Globally define timezone and all xdr
	symbols as non-exported from libcygwin.a.
2014-11-05 09:28:01 +00:00
Corinna Vinschen c5d751a658 * cygheap.cc: Fix formatting. 2014-11-03 15:30:59 +00:00
Corinna Vinschen 91233e688a * uinfo.cc (cygheap_user::ontherange): Don't mention /etc/passwd. 2014-10-30 16:07:04 +00:00
Corinna Vinschen 5da7a22be0 * cygheap.cc (init_cygheap::init_installation_root): Create content of
installation_dir as non-prefixed path, if possible.
2014-10-29 10:40:47 +00:00
Corinna Vinschen 6bb19351d9 * common.din (__cxa_atexit): Define as cygwin__cxa_atexit.
* dcrt0.cc (cygwin__cxa_atexit): New function.  Explain what we do.
2014-10-29 09:56:18 +00:00
Corinna Vinschen e6a4318d78 * globals.cc (dos_file_warning): Set to false by default.
* path.cc (warn_msdos): Make static.  Drop test for dos_file_warning.
	(path_conv::check): Check for dos_file_warning here to avoid a function
	call in the default case.
2014-10-28 10:44:49 +00:00
Corinna Vinschen b7749822ed * dcrt0.cc (cygwin_atexit): Add workaround for broken atexit calls
in __gcc_register_frame of DLLs built with gcc-4.8.3-3.
2014-10-27 21:19:40 +00:00
Corinna Vinschen 4be37ddfc8 * dlfcn.cc (dlopen): Drop patch accommodating SetDllDiretory from
2014-10-14.
2014-10-27 13:13:54 +00:00
Corinna Vinschen f7cb52eec7 * cygheap.cc (cygheap_fixup_in_child): Drop call to set_dll_dir.
(init_cygheap::init_installation_root): Set installation_dir_len.
	(setup_cygheap): Drop call to set_dll_dir.
	* cygheap.h (struct init_cygheap): Add installation_dir_len member.
	(init_cygheap::set_dll_dir): Remove.
	* environ.cc (win_env::add_cache): Use stpcpy for speed.
	(posify_maybe): Use tmp_pathbuf buffer instead of stack.
	(raise_envblock): New function to resize Windows environment block.
	(build_env): Fix indentation.  Call raise_envblock function.  Check if
	$PATH exists and is non-empty.  If not, add PATH variable with Cygwin
	installation directory as content to Windows environment.  Explain why.

	* uinfo.cc (cygheap_pwdgrp::_nss_init): Fill UNICODE_STRING members
	on the fly.  Drop call to RtlInitUnicodeString.
	(pwdgrp::check_file): Ditto.
2014-10-27 11:33:53 +00:00
Corinna Vinschen b701da7f14 * fhandler_socket.cc (fhandler_socket::af_local_connect): Drop
setting connect_state to connect_credxchg.
	(fhandler_socket::af_local_accept): Ditto.
	(fhandler_socket::recv_internal): Drop ill-advised connect_state check.
	Add comment so as not to repeat the exercise.
	* fhandler.h (enum conn_state): Drop now unneeded connect_credxchg
	state.
2014-10-26 18:47:24 +00:00
Corinna Vinschen e91c2f80ba * fhandler_proc.cc (format_proc_cygdrive): Fix symlink path if cygdrive
is "/".
2014-10-24 19:08:55 +00:00
Corinna Vinschen de7358ca6b * gendef (sigdelayed): 64 bit only: Fix seh_pushreg statements in
prologue.
2014-10-24 15:04:10 +00:00
Corinna Vinschen d3779269ca * gendef (sigdelayed): 64 bit only: Push CPU flags before aligning
stack to avoid changing flag values.
2014-10-24 13:40:02 +00:00
Yaakov Selkowitz d6aa3abb4f * common.din (stime): Export.
* times.cc (stime): New function.
* include/cygwin/time.h (stime): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-22 19:03:02 +00:00
Corinna Vinschen 51521b2a6e * sec_auth.cc (get_user_groups): Remove experimental exception handler
added 2014-09-05.
	(get_user_local_groups): Ditto.
2014-10-21 19:17:09 +00:00
Corinna Vinschen f2ee8ffeb1 Fix typo 2014-10-20 16:38:19 +00:00
Corinna Vinschen 03a6a1e408 * fhandler_serial.cc: Revert debug code accidentally checked in on
2014-08-18.
2014-10-20 14:30:35 +00:00
Corinna Vinschen 85bfa90696 * path.cc (symlink_info::check): Set error from status code if opening
the parent directory failed, but keep special case for root dirs.
2014-10-20 10:29:30 +00:00
Corinna Vinschen cc5a7d7519 * cygheap.cc (cygheap_fixup_in_child): Call set_dll_dir.
(init_cygheap::init_installation_root): Just memmove contents of
	installation_root instead of calling GetModuleFileNameW again.
	Copy installation_root to installation_dir before stripping of
	"bin" dir.  Don't call SetDllDirectory here.  Explain what we do.
	(setup_cygheap): New function taking over initial cygheap setup
	from memory_init.  Additionally call set_dll_dir.
	* cygheap.h (struct init_cygheap): Add installation_dir member.
	(init_cygheap::set_dll_dir): Define.
	(setup_cygheap): Declare.
	* dcrt0.cc: Throughout drop parameter from memory_init call.
	(dll_crt0_0): Call setup_cygheap prior to memory_init.
	* dlfcn.cc (dlopen): Change comment to point to the right function.
	* shared.cc (memory_init): Drop parameter.  Drop cygheap setup.
	* shared_info.h (memory_init): Change declaration accordingly.
2014-10-17 14:36:59 +00:00
Corinna Vinschen 1f0bd6f96f fix typo 2014-10-17 13:47:48 +00:00
Corinna Vinschen 1182991e60 * cygtls.h (__try): Define __l_endtry as block-local label in 32 bit
case as well.
2014-10-17 08:34:51 +00:00
Corinna Vinschen 1db937e986 * Makefile.in (DLL_OFILES): Add quotactl.o.
* common.din (quotactl): Export.
	* ntdll.h: Define FILE_FS_CONTROL_INFORMATION::FileSystemControlFlags
	flag values.
	(struct _FILE_FS_CONTROL_INFORMATION): Define.
	(struct _FILE_GET_QUOTA_INFORMATION): Define.
	(typedef struct _FILE_QUOTA_INFORMATION): Define.
	(NtQueryObject): Use PVOID rather than VOID*.
	(NtQueryVolumeInformationFile): Ditto.
	(NtQueryQuotaInformationFile): Declare.
	(NtSetQuotaInformationFile): Declare.
	(NtSetVolumeInformationFile): Declare.
	* quotactl.cc: New file implementing quotactl().
	* include/sys/mount.h (BLOCK_SIZE): Define.
	(BLOCK_SIZE_BITS): Define.
	* include/sys/quota.h: New header.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-17 08:19:27 +00:00
Corinna Vinschen 5fedfc22b8 * Makefile.in (DLL_OFILES): Rearrange with one file per line. 2014-10-16 15:40:09 +00:00
Corinna Vinschen a3dfd53a74 * fhandler_proc.cc (format_proc_partitions): Extend output to print
the windows mount points the device is mounted on.
2014-10-16 15:35:10 +00:00
Corinna Vinschen 50e4b6d557 * fhandler_socket.cc (fhandler_socket::connect): Don't change state
on WSAEALREADY error.  Change comment accordingly.
2014-10-14 19:43:09 +00:00
Corinna Vinschen 1dd75c50d5 * cygheap.cc (init_cygheap::init_installation_root): Install Cygwin's
installation dir as DLL search path, instead of ".".
	* cygheap.h (class cwdstuff): Add parameter names in function
	declarations for readability.
	(cwdstuff::get): Ad inline implementation fetching the CWD as wide char
	string.
	* dlfcn.cc (dlopen): Add searching for dependent DLLs in DLL
	installation dir or CWD, if all else failed.
	Add comment to explain scenarios this is accommodating.
2014-10-14 19:14:33 +00:00
Corinna Vinschen 2599a694a6 * fhandler_socket.cc (fhandler_socket::connect): Init connect_state to
connect_pending only on unconnected socket.  Set connect_state to
	connected on WSAEISCONN error.  Set connect_state to connect_failed
	on any other error except WSAEWOULDBLOCK if connect is still pending.
	Add lots of comment to explain why all of the above.
2014-10-14 19:08:27 +00:00
Corinna Vinschen 6a56366a9e * net.cc (cygwin_setsockopt): Drop redundant test for AF_LOCAL and
SOCK_STREAM in SO_PEERCRED case, as in the original patch.
2014-10-13 08:18:18 +00:00
Corinna Vinschen 7563a26d9b * dlfcn.cc (gfpod_helper): Only check for POSIX dir separator, same as
in get_full_path_of_dll.
2014-10-12 19:14:07 +00:00
Corinna Vinschen 57cd3486e6 * dlfcn.cc (set_dl_error): Drop useless __stdcall.
(check_path_access): Ditto.  Drop FE_CWD from call to find_exec.
	(gfpod_helper): Call path_conv::check for all paths containing a dir
	separator to more closely follow the Linux search algorithm.
	(get_full_path_of_dll): Drop useless __stdcall.
	(dlopen): Simplify RTLD_NOLOAD case by calling GetModuleHandleEx
	instead of GetModuleHandle/LoadLibrary.
2014-10-12 19:03:52 +00:00
Corinna Vinschen 697b9afe00 Add setsockopt(sd, SOL_SOCKET, SO_PEERCRED, NULL, 0) to disable
initial handshake on AF_LOCAL sockets.
	* fhandler.h (class fhandler_socket): Add no_getpeereid status flag.
	(fhandler_socket::af_local_set_no_getpeereid): New prototype.
	* fhandler_socket.cc (fhandler_socket::af_local_connect): Skip handshake
	if no_getpeereid is set.  Add debug output.
	(fhandler_socket::af_local_accept): Likewise.
	(fhandler_socket::af_local_set_no_getpeereid): New function.
	(fhandler_socket::af_local_copy): Copy no_getpeereid.
	(fhandler_socket::getpeereid): Fail if no_getpeereid is set.
	* net.cc (cygwin_setsockopt): Add SO_PEERCRED for AF_LOCAL/SOCK_STREAM
	sockets.  Add comment to explain why we need it.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-10-11 18:28:04 +00:00
Corinna Vinschen a85ab1d482 * fhandler_socket.cc (fhandler_socket::af_local_connect): Drop outdated
comment.
	(fhandler_socket::evaluate_events): Only set connect_state and call
	af_local_connect if connect_state is connect_pending.  Explain why.
	Drop redundant test for socket family and type.
	(fhandler_socket::connect): Extend comment.
2014-10-11 16:37:29 +00:00
Corinna Vinschen 2483fa2719 * fhandler_socket.cc (fhandler_socket::evaluate_events): Handle
connect_state and af_local_connect connect call here, once, independent
	of FD_CONNECT being requested.  Add comment to explain why.
	(fhandler_socket::connect): Drop connect_state handling and calling
	af_local_connect.  Move remaining AF_LOCAL stuff prior  to calling
	::connect and explain why.  Simplify error case.
	* poll.cc (poll): Handle connect state independently of POLLOUT being
	requested for the descriptor to allow setting POLLIN if connect failed.
	Add comment.
	* select.cc (set_bits): Drop connect_state and AF_LOCAL handling here.
2014-10-11 12:14:29 +00:00
Corinna Vinschen 9f64fd8081 * fhandler_socket.cc (fhandler_socket::evaluate_events): Slightly
rearrange code.  Rephrase a comment.
2014-10-11 10:50:36 +00:00
Corinna Vinschen 3ab591cf71 * dlfcn.cc (dlopen): Disable old 32 bit code on 64 bit.
* dcrt0.cc (check_sanity_and_sync): Ditto.
	* dll_init.cc (dll_dllcrt0_1): Fix typo in comment.
2014-10-10 15:29:18 +00:00
Corinna Vinschen f49469bb1e * fhandler_procsys.cc (fhandler_procsys::readdir): Just test
ObjectTypeName for object types rather than calling lstat to avoid
	performance hit.
	* globals.cc (ro_u_natdir): Define.
	(ro_u_natsyml): Define.
	(ro_u_natdev): Define.
2014-10-09 17:45:27 +00:00
Corinna Vinschen 0613efefc7 * fhandler_disk_file.cc (fhandler_disk_file::readdir_helper): Set d_type
for virtual directories.
2014-10-09 13:32:59 +00:00
Corinna Vinschen 54338f169f * fhandler_proc.cc (fhandler_proc::readdir): Set dirent d_type.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
	* fhandler_procnet.cc (fhandler_procnet::readdir): Ditto.
	* fhandler_procsys.cc (fhandler_procsys::readdir): Ditto.
	* fhandler_procsysvipc.cc (fhandler_procsysvipc::readdir): Ditto.
	*  fhandler_virtual.h (virt_ftype_to_dtype): Define new inline function
	to generate dirent d_type from virtual_ftype_t.
2014-10-09 13:24:37 +00:00
Corinna Vinschen 657ca84427 Add accidentally missing ChangeLog for latest change. 2014-10-09 08:31:34 +00:00
Corinna Vinschen 2fb56bbfaa * syscall.cc (ffs): Fix crash of ffs (0x80000000) on 64 bit. 2014-10-08 16:34:31 +00:00
Corinna Vinschen 2bf7d695ea * fhandler_process.cc (format_process_statm): Fix output of dirty
pages.  Add linefeed.
2014-10-08 15:25:52 +00:00
Corinna Vinschen ee97a4e332 Fix typo 2014-10-08 14:41:44 +00:00
Corinna Vinschen f207699a53 * fhandler_proc.cc (proc_tab): Add entry for cygdrive symlink.
(format_proc_cygdrive): New function to implement /proc/cygdrive.
2014-09-05 19:11:01 +00:00
Corinna Vinschen bea3ef947a * exception.h (class exception): Remove unnecessary #ifdef.
* uinfo.cc (client_request_pwdgrp::client_request_pwdgrp): Fix length
	counter to include trailing NUL.

	* sec_auth.cc (get_user_groups): Add experimental exception handler.
	(get_user_local_groups): Ditto.
2014-09-05 11:47:33 +00:00
Corinna Vinschen acc511d184 * uinfo.cc (pwdgrp::fetch_account_from_windows): Handle APPLICATION
PACKAGE AUTHORITY SIDs.
	* winlean.h (DNLEN): Raise to 31.  Explain why.
2014-09-05 09:46:26 +00:00
Corinna Vinschen e5110581dc * sec_acl.cc (aclcheck32): Check for required default entries as well.
Enable check for missing CLASS_OBJ entries, now that setfacl creates
	them.
2014-09-03 12:46:19 +00:00
Corinna Vinschen 7a1cf1a003 * sec_acl.cc (aclsort32): Set errno to EINVAL if aclcheck32 failed. 2014-09-02 20:07:21 +00:00
Corinna Vinschen f2b03c9258 * uinfo.cc (pwdgrp::fetch_account_from_windows): Disallow user accounts
as groups.  Add comment.
2014-08-31 19:33:19 +00:00
Corinna Vinschen cc332c9e27 * uinfo.cc (cygheap_pwdgrp::init): Fix comment. Rearrange code for
style.
	(cygheap_pwdgrp::nss_init_line): Disable db_prefix and db_separator
	settings.  Add comment.
	(pwdgrp::fetch_account_from_windows): Drop outdated comment.  Fix code
	fetching primary group gid of group setting in SAM description field.
	Change comment accordingly.
2014-08-31 18:18:49 +00:00
Corinna Vinschen 3faecb14b4 * uinfo.cc (pwdgrp::fetch_account_from_windows): Disallow creating an
entry for "NULL SID".
2014-08-31 14:16:04 +00:00
Corinna Vinschen ebf78cec85 * sec_acl.cc (setacl): Add comment. Handle NULL ACE for SUID, SGID,
and VTX bits.  Create owner, group, other and NULL entries in the same
	way and in the same order as alloc_sd.
	(getacl): Skip NULL ACE.
2014-08-31 14:13:01 +00:00
Corinna Vinschen 1a33a5c6d3 * fhandler.cc (fhandler_base::facl): Drop CLASS_OBJ entry.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Ditto in noacl case.
	* sec_acl.cc (getacl): Compute useful fake CLASS_OBJ and DEF_CLASS_OBJ
	permission bits based on how these values are generated on Linux.
	Add commants to explain what the code is doing.
	* security.cc (get_attribute_from_acl): Compute group permission based
	on the actual primary group permissions and all secondary user and group
	ACCESS_ALLOWED_ACEs to emulate Linux' behaviour more closely.
	(check_access): Fix typos im comment.
	* include/cygwin/acl.h (MIN_ACL_ENTRIES): Redefine as 3.
2014-08-28 12:38:52 +00:00
Corinna Vinschen c51ce2447a * fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Try the
FileFsSizeInformation information class on filesystems choking on
	FileFsFullSizeInformation (I see you Netapp!)
2014-08-28 12:29:42 +00:00
Corinna Vinschen 326510785e * fhandler.h (fhandler_pty_slave::fch_open_handles): Add bool parameter
to declaration.
	* fhandler_tty.cc (fhandler_pty_slave::fch_open_handles): Add bool
	parameter "chown".  Only request WRITE_OWNER access when opening pty
	synchronization objects if "chown" is set.
	(fhandler_pty_slave::fchmod): Call fch_open_handles with new bool
	parameter set to false.
	(fhandler_pty_slave::fchown): Call fch_open_handles with new bool
	parameter set to true.
	* kernel32.cc (CreateFileMappingW): Fix default standard rights for
	file mappings from READ_CONTROL to STANDARD_RIGHTS_REQUIRED to allow
	changing the DACL (fixes "access denied" error in pinfo::set_acl).

	* fhandler_disk_file.cc (fhandler_base::fstat_helper): Change debug
	output to print mode bits in octal.
	* security.cc (alloc_sd): Ditto.
	(set_file_attribute): Ditto.
2014-08-27 11:42:17 +00:00
Corinna Vinschen 37579836e3 * kernel32.cc (CreateFileMappingW): Fix default standard rights for
file mappings from READ_CONTROL to STANDARD_RIGHTS_REQUIRED to allow
	changing the DACL (fixes "access denied" error in pinfo::set_acl).
2014-08-27 10:44:50 +00:00
Corinna Vinschen db1ff3b932 * ntea.cc (read_ea): Change left-over return to __leave. Fix
condition to close handle.  Call NtClose rather than CloseHandle.
	(write_ea): Fix condition to close handle.  Call NtClose rather than
	CloseHandle.
	* security.cc (get_file_sd): Call pc.init_reopen_attr if a valid
	incoming handle was given, pc.get_object_attr otherwise.
	(set_file_sd): Ditto.
2014-08-27 09:39:44 +00:00
Corinna Vinschen dc847e6b9e * path.h (path_conv::init_reopen_attr): Change from void to returning
POBJECT_ATTRIBUTES.  Take OBJECT_ATTRIBUTES reference as argument, not
	pointer.
	* fhandler_disk_file.cc: Throughout accommodate above change.
	* syscalls.cc: Ditto.
	* ntea.cc (read_ea): Don't set hdl to NULL if it's already NULL.  Set
	attr with pc.init_reopen_attr before trying to reopen file.
	(write_ea): Ditto.
	* security.cc (get_file_sd): Use pc.init_reopen_attr rather than
	pc.get_object_attr when trying to reopen file.
	(set_file_sd): Ditto.
2014-08-26 20:47:46 +00:00
Corinna Vinschen 12b244394c * cygtls.cc (san::leave/x86_64): Implement.
* cygtls.h (class tls_pathbuf): Move counter variables into a union.
	Add 64 bit element _counters covering both counter variables to
	optimize save and restore operations.
	(class san/x86_64): Only store single 64 bit value.
	(san::san/x86_64): Implement.
	(san::leave/x86_64): Only declare here, as returns_twice function.
	Explain why.
	(class san/i686): Change type of _c_cnt and _w_cnt to uint32_t.
	(__try/x86_64): Move definition of __sebastian after the first memory
	barrier.  Drop __sebastian.setup call.
2014-08-25 19:47:44 +00:00
Corinna Vinschen 5578cc4b73 * cygtls.cc (_cygtls::remove): Revert previous patch.
*  cygtls.h (struct _local_storage): Move pathbufs back here.
	(class san/x86_64): Revert class.  Save and restore pathbufs counters
	only.
	(class san/i686): Revert saving and restoring pathbufs counters.
	(__try/x86_64): Add a san variable and call it's setup method.
	(__except/x86_64): Call san::leave to restore pathbufs counters.
	* gendef (_sigbe): Revert previous change.
	* thread.cc (verifyable_object_state): Remove gcc 4.7 workaround in
	forward declaration as well.
	* tls_pbuf.cc (tls_pbuf): Revert previous change.
	* tls_pbuf.h (class tmp_pathbuf): Accommodate reverting pathbufs to
	locals structure.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
2014-08-25 14:53:49 +00:00
Corinna Vinschen 3f3bd10104 * Throughout, use __try/__except/__endtry blocks, rather than myfault
handler.
	* cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs
	has been moved from _local_storage to _cygtls.
	* cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage
	of counters.  Change type of counters to uint32_t for clarity.
	Remove _cygtls as friend class.
	(struct _local_storage): Move pathbufs from here...
	(struct _cygtls): ...to here, allowing to access it from _sigbe.
	(class san): Only define on 32 bit.  Remove errno, _c_cnt and _w_cnt
	members.
	(san::setup): Drop parameter.  Don't initialize removed members.
	(san::leave): Don't set removed members.
	(class myfault): Only define on 32 bit.
	(myfault::faulted): Only keep implementation not taking any parameter.
	Drop argument in call to sebastian.setup.
	(__try/__leave/__except/__endtry): Implement to support real SEH.  For
	now stick to SJLJ on 32 bit.
	* dcrt0.cc (dll_crt0_0): Drop 64 bit call to
	exception::install_myfault_handler.
	* exception.h (exception_handler): Define with EXCEPTION_DISPOSITION
	as return type.
	(PDISPATCHER_CONTEXT): Define as void * on 32 bit.  Define as pointer
	to _DISPATCHER_CONTEXT on 64 bit.
	(class exception): Define separately for 32 and 64 bit.
	(exception::myfault): Add handler for myfault SEH handling on 64 bit.
	(exception::exception): Fix mangled method name to account for change
	in type of last parameter.
	(exception::install_myfault_handler): Remove.
	* exceptions.cc (exception::myfault_handle): Remove.
	(exception::myfault): New SEH handler for 64 bit.
	* gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when
	returning to the caller.
	* ntdll.h: Move a comment to a better place.
	(struct _SCOPE_TABLE): Define on 64 bit.
	* thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround.
	* tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs.
	(tls_pathbuf::destroy): Change type of loop variables to uint32_t.
	* tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to
	uint32_t.  Accommodate new place of pathbufs.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Regenerate.
2014-08-22 09:21:33 +00:00
Corinna Vinschen 33ed7bb5bc * miscfuncs.cc (__import_address): Cover the first dereference to imp
under the fault handler.
2014-08-21 09:04:09 +00:00
Corinna Vinschen b1f81c3b71 * net.cc (if_freenameindex): Don't catch a SEGV from free to fail
loudly on double free.
2014-08-21 08:59:28 +00:00
Corinna Vinschen 88fa851784 * dir.cc (rmdir): Don't skip deleting fh in the ENOTEMPTY case. 2014-08-21 08:46:35 +00:00
Corinna Vinschen 854e058b56 * tls_pbuf.h (tmp_pathbuf::tmp_pathbuf): Convert to inline method.
(tmp_pathbuf::~tmp_pathbuf): Ditto.
	* tls_pbuf.cc (tmp_pathbuf::tmp_pathbuf): Remove here.
	(tmp_pathbuf::~tmp_pathbuf): Ditto.
2014-08-20 19:44:09 +00:00
Corinna Vinschen 905a851912 * dir.cc (dirfd): Per POSIX, return EINVAL on invalid directory stream.
(telldir): Per POSIX, return -1 and set errno to EBADF, rather than
	just returning 0, on invalid directory stream.
	* signal.cc (sigwaitinfo): Return -1, not EFAULT, when SEGV was catched.
2014-08-19 19:25:54 +00:00
Corinna Vinschen de1c312566 * fhandler.h (enum conn_state): Add "connect_credxchg" state.
(class fhandler_socket): Grant another bit to connect_state flag.
	* fhandler_socket.cc (fhandler_socket::af_local_connect): Rearrange
	variable definition.  Set connect_state to connect_credxchg.
	(fhandler_socket::af_local_accept): Ditto.
	(fhandler_socket::recv_internal): Accept connect_credxchg on connection
	oriented AF_LOCAL sockets as well to allow the credential exchange.
	Extend comment to explain.
2014-08-19 09:47:12 +00:00
Corinna Vinschen 67986ac4a4 * autoload.cc: Replace WNet[...]A with WNet[...]W imports.
* dcrt0.cc (initial_env): Drop strlwr calls.  Call strcasestr instead.
	* fhandler_netdrive.cc: Throughout, convert to calling WNet UNICODE
	functions.  Use tmp_pathbuf rather than alloca.  Replace call to
	strlwr with call to RtlDowncaseUnicodeString.
2014-08-19 08:41:40 +00:00
Corinna Vinschen be2b7c5684 * fhandler.h (fhandler_serial::is_tty): Reinstantiate. 2014-08-19 08:31:10 +00:00
Corinna Vinschen bd094739f3 * miscfuncs.cc (strlwr): Rename from cygwin_strlwr. Drop __stdcall
decoration.
	(strupr): Rename from cygwin_strupr.  Drop __stdcall decoration.
	* string.h (strlwr): Remove override macro.  Simply declare.
	(strupr): Ditto.
2014-08-18 18:24:06 +00:00
Corinna Vinschen 1091d4404e * dtable.cc (dtable::init_std_file_from_handle): Mention that console
handles are kernel objects since Windows 8.
	* fhandler.h (enum conn_state): Add "listener" state.
	(class fhandler_socket): Drop listener status flag.
	(fhandler_socket::lseek): Return -1 and errno ESPIPE.
	(fhandler_serial::lseek): Ditto.
	* fhandler_socket.cc (fhandler_socket::listen): Set connect_state to
	listener.  Add comment.
	(fhandler_socket::accept4): Explicitely check if the socket is listening
	and fail with EINVAL, if not.  Explain why we have to do that.
	(fhandler_socket::recv_internal): Explicitely check if the socket is
	connected if it's a stream socket.  Explain why we have to do that.
	(fhandler_socket::getpeereid): Drop now redundant test.
2014-08-18 11:09:56 +00:00
Corinna Vinschen 4dd1ecc3d4 * winsup.h (_GNU_SOURCE): Define. Explain why.
* configure.ac: Convert to new AC_INIT style.
	* configure: Regenerate.
2014-08-15 21:21:59 +00:00
Corinna Vinschen fc15ff2f0d * cygerrno.h (seterrno): Define as (always) inline function.
* errno.cc (seterrno): Remove.
2014-08-15 13:50:53 +00:00
Corinna Vinschen d9e9de3f38 * dll_init.sgml: Remove.
* dtable.sgml: Move into ../doc/misc-funcs.xml.
	* external.sgml: Ditto.
	* stackdump.sgml: Ditto.
2014-08-14 20:46:28 +00:00
Corinna Vinschen 308ea1e73c * security.sgml: Move to ../doc dir and rename to logon-funcs.xml. 2014-08-14 20:12:50 +00:00
Corinna Vinschen ec50fa3597 * path.sgml: Move to ../doc dir and rename to path.xml.
* posix.sgml: Move to ../doc dir and rename to posix.xml.
2014-08-14 19:31:33 +00:00
Corinna Vinschen f509713291 * dlmalloc.c: Remove unused file.
* dlmalloc.h: Ditto.
	* malloc.cc: Update to Doug Lea's malloc version 2.8.6.
2014-08-14 17:36:24 +00:00
Corinna Vinschen 0d45f7ee54 * include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 33.
(CYGWIN_VERSION_API_MINOR): Bump to reflect intermediate 1.7.32 release.
2014-08-13 17:38:47 +00:00
Corinna Vinschen 5b4e301b36 * cpuid.h: Add missing copyright header. Fix formatting. Use uint32_t
instead of unsigned throughout.  Change functions to static inline and
	always inline.
	(cpuid): Add parameter to set ecx, allowing to request extended CPUID
	info.
	* fhandler_proc.cc (format_proc_cpuinfo): Use uint32_t instead of
	unsigned throughout.  Add fake decimal places to MHz info.  Handle more
	feature flags.
	* fhandler_random.cc (fhandler_dev_random::write): Allow up to 4K
	input to add entropy.
	* syscalls.cc: Drop including cpuid.h.
2014-08-11 12:03:18 +00:00
Yaakov Selkowitz f9c956a1ff * common.din (__cxa_finalize): Export.
* dcrt0.cc (cygwin_atexit): Use d->handle with __cxa_atexit.
* dll_init.cc (dll_list::detach): Use d->handle with __cxa_finalize.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Use 274 for
__cxa_finalize as well.
2014-08-07 16:25:06 +00:00
Corinna Vinschen 0b20d00bf3 * include/sys/file.h: Add extern "C". 2014-08-06 08:46:12 +00:00
Corinna Vinschen 79131d442e * common.din (__cxa_atexit): Export.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump to 274.
2014-08-04 16:52:04 +00:00
Corinna Vinschen 64665f459e * uinfo.cc (pwdgrp::fetch_account_from_windows): Drop "plus_prepended"
as naming style.  Drop enum name_style_t, use a boolean
	"fully_qualified_name" value instead.  Rework function to drop
	"plus_prepended" handling througout and default to "name only" style
	as replacement.
2014-08-04 15:50:42 +00:00
Eric Blake 9067d19b9a headers: properly decorate attributes
As pointed out here:
https://cygwin.com/ml/cygwin/2014-07/msg00371.html

any use of __attribute__ in a header that can be included by a user
should be namespace-safe, by decorating the attribute arguments with __
(while gcc does a lousy job at documenting it, ALL attributes have a __
counterpart, precisely so that public headers can use attributes without
risk of collision with macros belonging to user namespace).

* include/pthread.h: Decorate attribute names with __, for
namespace safety.
* include/cygwin/core_dump.h: Likewise.
* include/cygwin/cygwin_dll.h: Likewise.
* include/sys/cygwin.h: Likewise.
* include/sys/strace.h: Likewise.
2014-08-01 15:48:37 +00:00
Corinna Vinschen 1721a38efd * uinfo.cc (pwdgrp::fetch_account_from_windows): Fix comment. 2014-07-30 14:23:53 +00:00
Corinna Vinschen 898e26c82f * cygheap.h (class cygheap_domain_info): Remove lowest_tdo_posix_offset.
* ldap.cc (cyg_ldap::fetch_posix_offset_for_domain): Return UINT32_MAX
	in case of error.
	* security.h (PRIMARY_POSIX_OFFSET): Define.
	(NOACCESS_POSIX_OFFSET): Define.
	(UNUSABLE_POSIX_OFFSET): Define.
	* uinfo.cc (cygheap_domain_info::init): Drop initializing
	lowest_tdo_posix_offset.
	(pwdgrp::fetch_account_from_file): Set PosixOffset to either
	UNUSABLE_POSIX_OFFSET or NOACCESS_POSIX_OFFSET in case we don't get a
	sensible offset from AD.  Explain why.  Drop setting ch
	lowest_tdo_posix_offset.
	(pwdgrp::fetch_account_from_windows): Replace constant 0x100000 with
	PRIMARY_POSIX_OFFSET throughout.
2014-07-29 08:53:13 +00:00
Corinna Vinschen c999d29a7b * fhandler_socket.cc (fhandler_socket::send_internal): Fix value of
out_len when tweaking the last buffer so out_len is correct in a
	subsequent if expression.
2014-07-24 13:21:02 +00:00
Corinna Vinschen 3be2cd0405 * thread.cc (pthread::init_mainthread): Initialize thread mutex to
type PTHREAD_MUTEX_RECURSIVE, just as for any other thread.
2014-07-21 16:32:09 +00:00
Corinna Vinschen 7cc124b0e5 bump to 32 2014-07-21 11:08:07 +00:00
Corinna Vinschen 9c96187172 * uinfo.cc: Fix typo in comment. 2014-07-21 09:55:52 +00:00
Corinna Vinschen 2f84de1ff5 * thread.cc (pthread::create): Handle stackaddr as upper bound address.
Add comment.
	(pthread_attr_setstack): Store upper bound address in stackaddr.
	Explain why.
	(pthread_attr_getstack): Handle stackaddr as upper bound address.
	Add comment.
	(pthread_attr_setstackaddr): Add comment.
	(pthread_attr_getstackaddr): Add comment.
	(pthread_attr_getstacksize): Return default stacksize if stacksize has
	not been set by the application, just as on Linux.  Add comment.
	(pthread_getattr_np): Store upper bound address in stackaddr.  Explain
	why.
	* include/pthread.h: Remove outdated comment.
	(pthread_attr_getstackaddr): Mark as deprecated, as on Linux.
	(pthread_attr_setstackaddr): Ditto.
2014-07-16 10:21:18 +00:00
Christopher Faylor 6f05b32767 * sigproc.cc (sigproc_init): Set aside more buffer space for signal pipes.
(sig_send): Retry WriteFiles which fail when there is no error but packbytes
have not been sent.
2014-07-15 22:11:23 +00:00
Christopher Faylor 0db2f28fd6 * sigproc.cc (send_sig): Don't report an error if WriteFile succeeds. 2014-07-15 14:57:30 +00:00
Christopher Faylor b6e90a06a1 * sigproc.cc (send_sig): Fix bad format in diagnostic output. 2014-07-14 18:16:16 +00:00
Corinna Vinschen 6aafa0bfc2 * uinfo.cc (cygheap_domain_info::init): Correctly set
lowest_tdo_posix_offset to UNIX_POSIX_OFFSET.
	(fetch_posix_offset): Redesign to fake a POSIX offset in all cases
	where we can't fetch a non-0 POSIX offset from our primary domain.
2014-07-14 13:33:20 +00:00
Corinna Vinschen 4866e86cb1 * thread.cc (pthread_mutex::pthread_mutex): Change default type
to PTHREAD_MUTEX_NORMAL.
	(pthread_mutex::unlock): Return EPERM if the mutex has no owner and
	the mutex type is PTHREAD_MUTEX_ERRORCHECK, as on Linux.
	(pthread_mutexattr::pthread_mutexattr): Ditto.
	(pthread_mutex_unlock): Do not fail if mutex is a normal mutex
	initializer.
	* include/pthread.h (PTHREAD_MUTEX_INITIALIZER): Redefine as
	PTHREAD_NORMAL_MUTEX_INITIALIZER_NP.
2014-07-14 09:42:15 +00:00
Corinna Vinschen 96ed53c10f * thread.cc (pthread::create): Use PTHREAD_DEFAULT_STACKSIZE stacksize
if attr.stacksize is 0.
	(pthread_attr::pthread_attr): Initialize stacksize to 0 to align more
	closely to Linux.
	(pthread_attr_getstack): Fix incorrect stackaddr computation.  Return
	stackaddr just like pthread_attr_getstackaddr.  Remove slightly off
	comment.
	(pthread_attr_getstackaddr): Remove slightly off comment.
	(pthread_getattr_np): Return stackaddr and stacksize based on the full
	allocated stackarea.
2014-07-09 12:06:08 +00:00
Corinna Vinschen 3dab1e488a * exceptions.cc (exception::myfault_handle): Rephrase comment. 2014-07-09 10:41:11 +00:00
Corinna Vinschen 64cfc4ac5a * exceptions.cc (exception::myfault_handle): Fix typo in comment. 2014-07-09 10:21:05 +00:00
Corinna Vinschen e1d158a04f * exceptions.cc (exception::myfault_handle): Disable handling
STATUS_STACK_OVERFLOW.  Explain why.
2014-07-07 19:58:16 +00:00
Corinna Vinschen f135cbdd45 * fhandler_socket.cc (fhandler_socket::send_internal): Improve loop to
write streams in chunks of wmem() bytes to raise performance when
	writing small buffers.  Rename variables and add comments to help
	understanding the code in years to come.
2014-07-07 12:57:03 +00:00
Corinna Vinschen 72506dd846 * passwd.cc (pg_ent::enumerate_ad): Revert to simply skipping a domain
if opening the connection to the domain fails.
2014-07-07 10:22:51 +00:00
Corinna Vinschen f0c23915ec * libc/minires.c (minires_dprintf): Change "Minires" to "Resolv" to
differ from external minres lib.
	(res_nquerydomain): Fix off-by-one in domain concatenation.  Add debug
	output.
2014-07-07 08:40:31 +00:00
Corinna Vinschen fcef025b94 * fhandler_disk_file.cc (fhandler_disk_file::fstatvfs): Add debug
output.
2014-07-03 16:48:21 +00:00
Corinna Vinschen 7e10b64973 * errno.cc (errmap): Fix order of SERVICE_REQUEST_TIMEOUT. 2014-06-25 10:01:58 +00:00
Corinna Vinschen 9b9fb0042f * errno.cc (errmap): Handle Windows error codes ERROR_CANCELLED,
ERROR_CONNECTION_REFUSED, ERROR_DEV_NOT_EXIST, ERROR_DS_GENERIC_ERROR,
	ERROR_NOT_ENOUGH_QUOTA, ERROR_SERVICE_REQUEST_TIMEOUT, ERROR_TIMEOUT,
	ERROR_UNEXP_NET_ERR.
	* ldap.cc (cyg_ldap::map_ldaperr_to_errno): Drop explicit LDAP_TIMEOUT
	handling.
2014-06-25 09:59:38 +00:00
Corinna Vinschen 37b1464588 * ldap.cc (cyg_ldap::map_ldaperr_to_errno): Explicitely map LDAP_TIMEOUT
to EIO.
2014-06-25 09:28:12 +00:00
Corinna Vinschen e35b92c202 * autoload.cc (ldap_search_sW): Replace ldap_search_stW.
(LdapMapErrorToWin32): Import.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Accommodate
	change to cyg_ldap::open.
	* ldap.cc (CYG_LDAP_TIMEOUT): Remove.
	(CYG_LDAP_ENUM_TIMEOUT): Remove.
	(def_tv): Remove.
	(enum_tv): Remove.
	(cyg_ldap::map_ldaperr_to_errno): New method to map LDAP error codes to
	POSIX errno codes.  Explicitly map LDAP_NO_RESULTS_RETURNED to ENMFILE.
	(cyg_ldap::wait): Ditto.
	(struct cyg_ldap_init): New struct.
	(cyg_ldap::connect_ssl): Return ULONG.  Drop setting LDAP_OPT_TIMELIMIT.
	Add call to ldap_search_sW to fetch root DSE.
	(cyg_ldap::connect_non_ssl): Ditto.
	(ldap_init_thr): New static thread function.
	(cyg_ldap::connect): New method to call connect_ssl/connect_non_ssl in
	an interruptible cygthread.
	(struct cyg_ldap_search): New struct.
	(cyg_ldap::search_s): New method to perform generic synchronous search.
	(ldap_search_thr): New static thread function.
	(cyg_ldap::search): New method to call search_s in an interruptible
	cygthread.
	(struct cyg_ldap_next_page): New struct.
	(cyg_ldap::next_page_s): New method to perform generic synchronous
	paged search.
	(ldap_next_page_thr): New static thread function.
	(cyg_ldap::next_page): New method to call next_page_s in an
	interruptible cygthread.
	(cyg_ldap::open): Return POSIX errno.  Call connect method.
	(cyg_ldap::fetch_ad_account): Call search method rather than
	ldap_search_stW.
	(cyg_ldap::enumerate_ad_accounts): Return POSIX errno.  Use infinite
	timeout in call to ldap_search_init_pageW.
	(cyg_ldap::next_account): Return POSIX errno.  Call next_page method
	rather than ldap_get_next_page_s.
	(cyg_ldap::fetch_posix_offset_for_domain): Call search method rather
	than ldap_search_stW.
	(cyg_ldap::fetch_unix_sid_from_ad): Ditto.
	(cyg_ldap::fetch_unix_name_from_rfc2307): Ditto.
	* ldap.h (class cyg_ldap): Accommodate aforementioned changes.
	* passwd.cc (pg_ent::enumerate_ad): Ditto.  Break search if one of
	cyg_ldap::enumerate_ad_accounts or cldap.next_account returns with
	an error code other than ENMFILE.
	* sec_helper.cc (cygpsid::get_id): Accommodate change to cyg_ldap::open.
	* uinfo.cc (fetch_posix_offset): Ditto.
2014-06-25 09:10:50 +00:00
Corinna Vinschen 8431e478d2 * spawn.cc (find_exec): Initialize err (CID 60111).
* strace.cc (strace::activate): Fix potential buffer overrun (CID 59938)
	* syscalls.cc (popen): Close parent pipe descriptor via fclosing fp on
	error to avoid resource leak (CID 59981).
	* thread.cc (pthread::exit): Avoid accessing cygtls member after
	deleting "this" (CID 60217).
2014-06-23 19:05:15 +00:00
Corinna Vinschen f739fd3ef0 * select.cc (start_thread_socket): Delete si on early return in case of
an error (CID 59967).
2014-06-23 14:56:45 +00:00
Corinna Vinschen 565e3643dd * regex/regcomp.c (computematchjumps): Free local memory in case of
error (CID 59975).
2014-06-23 14:33:55 +00:00
Corinna Vinschen f83cc3b7e9 * mount.cc (fs_info::update): Define dir in the outermost scope to avoid
accessing out-of-scope value (CID 60027).  Always initialize attr to
	upath (CID 60113).
2014-06-23 14:05:16 +00:00
Corinna Vinschen 6950fc18e3 * malloc_wrapper.cc (mallinfo): Initialize m if external malloc is used,
too (CID 60120).
2014-06-23 13:45:49 +00:00
Corinna Vinschen 28b4c8483e * localtime.cc (tzload): Fix leaking memory (CID 60001). 2014-06-23 13:38:06 +00:00
Corinna Vinschen 4337e28e62 * exceptions.cc (try_to_debug): Free environment pointer when not used
anymore (CID 59968).
2014-06-23 13:23:14 +00:00
Corinna Vinschen 4ea38ac7ef * net.cc (cygwin_getaddrinfo): Fix value of hint->ai_addrlen on 64 bit.
Explain why.
2014-06-23 12:35:31 +00:00
Corinna Vinschen 9c54570beb * environ.cc (regopt): Allocate small local buffer to avoid copying
twice.  Fixes resource leak (CID 60012).  Add comment.
2014-06-23 11:43:33 +00:00
Corinna Vinschen 686f560ece * dll_init.cc (dll_list::alloc): Fix buffer overrun (CID 59940). 2014-06-23 10:52:44 +00:00
Corinna Vinschen a1fd4b1a03 * dcrt0.cc (insert_file): Fix resource leaks (CIDs 59987, 59988). 2014-06-23 10:18:26 +00:00
Corinna Vinschen 852ed641ee * ldap.cc (CYG_LDAP_TIMEOUT): Set to 5 secs.
(CYG_LDAP_ENUM_TIMEOUT): New timeout value for enumeration only.  Set
	to 60 secs.
	(CYG_LDAP_ENUM_PAGESIZE): Define as number of entries per single
	search page.  Set to 100.  Use throughout.
	(def_tv): Rename from tv.  Use throughout.
	(enum_tv): New variable.  Use in call to ldap_get_next_page_s.
2014-06-23 09:09:54 +00:00
Corinna Vinschen b1c17593f8 * ldap.cc (CYG_LDAP_TIMEOUT): Define as timeout value. Set to 30 secs
for now.  Use throughout.
	* uinfo.cc (colon_to_semicolon): New local function.
	(pwdgrp::fetch_account_from_windows): Convert all colons in AD gecos
	entry to commas.
2014-06-18 17:41:52 +00:00
Corinna Vinschen 5b5c45752e Fix timestamp 2014-06-17 13:13:06 +00:00
Corinna Vinschen 451f0f45ee * libc/rexec.cc (cygwin_rexec): Make ahostbuf static to avoid returning
an out-of-scope address.
2014-06-17 08:46:59 +00:00
Corinna Vinschen d510072c83 * fhandler_socket.cc (fhandler_socket::evaluate_events): Call
WSASetLastError after setsockopt.  Explain why.
2014-06-16 13:01:40 +00:00
Corinna Vinschen 6681d11fd3 * grp.cc (getgrouplist): Fix setting ngroups to make sure to return
the right value.
2014-06-16 09:12:29 +00:00
Christopher Faylor 4d79de90e1 * timer.cc (timer_tracker::cancel): Demote api_fatal to system_printf, printing
more details about odd failure condition.
2014-06-05 19:50:24 +00:00
Corinna Vinschen f9f90410fd * autoload.cc (ldap_memfreeW): Remove.
(ldap_msgfree): Import.
	* ldap.cc: Throughout, use ldap_msgfree to free LDAPMessage memory,
	rather than ldap_memfreeW.
	(cyg_ldap::next_account): Immediately abandon search when quiting from
	search.
2014-05-23 10:29:11 +00:00