Commit Graph

6606 Commits

Author SHA1 Message Date
Corinna Vinschen d2264bce02 * common.din (sockatmark): Export.
* net.cc (sockatmark): New function.
	* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2015-01-20 18:23:20 +00:00
Corinna Vinschen c95ce02160 * cygserver_ipc.h (ipc_retval): Add default constructor.
(class thread): struct->class.  Add prototypes for new private methods
	dup_signal_arrived and close_signal_arrived.  Implement constructor and
	destructor.
2015-01-19 17:42:04 +00:00
Corinna Vinschen a62dbcd6e0 * gendef: Export _sigbe on 64 bit as well.
* malloc_wrapper.cc (free): In malloc_printf, call caller_return_address
	instead of __builtin_return_address.
	(malloc): Ditto.
	(realloc): Ditto.
	(calloc): Ditto.
	* miscfuncs.cc (__caller_return_address): New function.
	* miscfuncs.h (caller_return_address): New macro calling
	__caller_return_address.
	(__caller_return_address): Add prototype.
2015-01-16 16:19:37 +00:00
Corinna Vinschen 5e41539dfc * uinfo.cc (fetch_windows_home): Disable fetching from homeDrive or
usri3_home_dir_drive.  Add comment.
2015-01-14 11:13:23 +00:00
Corinna Vinschen d63eac1033 * environ.cc (renv_arr): Drop variables not usually in a Windows
environment and all variables being uppercase anyway.  But keep
	TMP and TEMP for paranoia.
2015-01-14 10:40:03 +00:00
Corinna Vinschen 63716e7d42 * environ.cc (build_env): When merging the user's Windows environment,
explicitely skip the variables needing conversion to avoid collisions.
	Extend comment to explain.
2015-01-14 10:31:14 +00:00
Corinna Vinschen f5a9dd02c4 * uinfo.cc (pwdgrp::fetch_account_from_windows): Drop code from
2014-11-17, always prepending domain to NT SERVICE accounts when
	searching by name.  Fix test expression to allow fully qualified
	names for NT SERVICE accounts.  Extend comment to explain a bit.
2015-01-13 09:06:53 +00:00
Corinna Vinschen 7d0b0134ee * minires-os-if.c (cygwin_query): Change questions into answers. 2015-01-12 16:38:02 +00:00
Corinna Vinschen fae48dd783 * cygheap.h (cygheap_pwdgrp::get_shell): Add sid to argument list.
(cygheap_pwdgrp::get_gecos): Ditto.
	* uinfo.cc (fetch_windows_home): Accept cyg_ldap and PUSER_INFO_3
	arguments, and fetch db home dir values right here.
	(fetch_from_path): Accept cyg_ldap, PUSER_INFO_3 pointers and sid
	arguments.  Add '%H' format specifier to fetch Windows home dir in
	POSIX notation.
	(cygheap_pwdgrp::get_home): Accommodate changes to fetch_windows_home
	and fetch_from_path.
	(cygheap_pwdgrp::get_shell): Ditto.
	(cygheap_pwdgrp::get_gecos): Ditto.
	(pwdgrp::fetch_account_from_windows): Accommodate sid argument to
	cygheap_pwdgrp::get_shell and cygheap_pwdgrp::get_gecos.
2015-01-08 17:08:47 +00:00
Corinna Vinschen 46eb312f13 * include/cygwin/socket.h (struct cmsghdr): Redefine cmsg_len as type
size_t.  Add comment to explain why.
2015-01-08 13:12:50 +00:00
Corinna Vinschen fc55214612 * localtime.cc (__cygwin_gettzoffset): New function for access from
newlib.
	(__cygwin_gettzname): Ditto.
2015-01-08 09:37:16 +00:00
Corinna Vinschen 80d9bfa9a8 * localtime.cc (tzload): Fix loading latest timezone offsets into
tzinfo from zoneinfo files.  Add comment to explain what we do.
	(tzparse): Add more comments to explain in case of loading timezone
	offset from other sources.
2015-01-07 21:27:22 +00:00
Yaakov Selkowitz 65d785561d * common.din (__fbufsize, __flbf, __fpending, __freadable, __freading,
__fsetlocking, __fwritable, __fwriting, clearerr_unlocked,
feof_unlocked, ferror_unlocked, fflush_unlocked, fgetc_unlocked,
fgets_unlocked, fgetwc_unlocked, fgetws_unlocked, fileno_unlocked,
fputc_unlocked, fputs_unlocked, fputwc_unlocked, fputws_unlocked,
fread_unlocked, fwrite_unlocked, getwc_unlocked, getwchar_unlocked,
putwc_unlocked, putwchar_unlocked): Export.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2014-12-18 16:54:11 +00:00
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