Commit Graph

6643 Commits

Author SHA1 Message Date
Corinna Vinschen 21f22726c7 * path.cc (find_fast_cwd): Point to problem reporting web site rather
than to mailing list.
2014-12-16 09:24:40 +00:00
Corinna Vinschen 0793492d8f * path.cc (warn_msdos): Slightly reformat.
(find_fast_cwd): Change warning message to urge an update before
	reporting the problem.
2014-12-16 09:16:03 +00:00
Corinna Vinschen 4bfa0b5a36 * winver.rc (LegalCopyright): Fix belatedly (uh-oh). 2014-12-10 15:41:49 +00:00
Corinna Vinschen e20a68a56f * environ.cc (regopt): Remove function.
(environ_init): Drop undocumented feature to read application-specific
	environment variables from the registry.
	* include/cygwin/version.h (CYGWIN_INFO_PROGRAM_OPTIONS_NAME): Remove.
2014-12-08 11:21:14 +00:00
Corinna Vinschen 03ff627e16 * environ.cc (build_env): Remove loquacious debug statements. 2014-12-06 09:54:28 +00:00
Yaakov Selkowitz 0548dda67f * common.din (__bsd_qsort_r): Add.
(qsort_r): Add.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-12-05 16:31:36 +00:00
Corinna Vinschen df386ddac8 * flock.cc (create_lock_in_parent): Make lf_obj handle inheritable.
Explain why.
	(lockf_t::create_lock_obj): Use FALSE, rather than 0 for BOOL argument.
	(lockf_t::del_lock_obj): Check if NtSetEvent succeeded and print system
	message if not.
2014-12-02 15:39:57 +00:00
Corinna Vinschen 44cacc7f44 * uinfo.cc (fetch_windows_home): New function fetching Windows-compliant
home directory.  Include longish comment to explain what we're doing.
	(cygheap_pwdgrp::get_home): Take additional sid parameter.  In
	NSS_SCHEME_WINDOWS case, call fetch_windows_home to create home
	directory.
	(pwdgrp::fetch_account_from_windows): Call cygheap_pwdgrp::get_home
	with additional sid argument.
	* cygheap.h (cygheap_pwdgrp::get_home): Align declaration to above
	change.
2014-12-02 11:30:04 +00:00
Corinna Vinschen 4fe712cd80 * uinfo.cc (cygheap_user::ontherange): Fix order of fallbacks creating
HOMEDRIVE/HOMEPATH values to be Windows-compliant.  Add comments.
2014-12-02 11:26:22 +00:00
Corinna Vinschen 41f77e25f1 * autoload.cc (CreateProfile): Import.
(LoadUserProfileW): Import.
	* registry.cc (get_registry_hive_path): Move to sec_auth.cc.
	(load_registry_hive): Remove.
	* registry.h (get_registry_hive_path): Drop declaration.
	(load_registry_hive): Ditto.
	* sec_auth.cc (get_user_profile_directory): Moved from registry.cc and
	renamed.  Take third parameter with buffer length.
	(load_user_profile): New function taking over for load_registry_hive.
	Use official functions to load profile.  If profile is missing, create
	it on Vista and later.
	* security.h (get_user_profile_directory): Declare.
	(load_user_profile): Declare.
	* syscalls.cc (seteuid32): Replace call to load_registry_hive with call
	to load_user_profile.
	* uinfo.cc (cygheap_user::env_userprofile): Replace call to
	get_registry_hive_path with call to get_user_profile_directory.
2014-12-02 10:49:47 +00:00
Corinna Vinschen 195a9205e5 * uinfo.cc (fetch_from_description): Make static.
(fetch_from_path): Ditto.
2014-12-02 10:28:42 +00:00
Corinna Vinschen 9119d13db8 * autoload.cc (CreateEnvironmentBlock): Import.
(DestroyEnvironmentBlock): Import.
	* environ.cc (env_compare): New static bsearch comparison function.
	(build_env): Add parameter taking a user token.  If token is non-NULL,
	fetch user's default Windows environment and merge it into the resulting
	environment.  Explain what we do in preceeding comment.
	* environ,h (build_env): Align prototype to above change.
	* external.cc (create_winenv): Call build_env with NULL token.
	* spawn.cc (child_info_spawn::worker): When spawning new process under
	another user account, call build_env with new token to allow merging
	user's default Windows environment.
	* winlean.h (_USERENV_): Define to override dllimport.
2014-12-02 10:16:03 +00:00
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