2014-02-11  Corinna Vinschen  <corinna@vinschen.de>

	* ldap.cc (rediscover_thread): Give argument a useful name.
	* miscfuncs.cc (NT_readline::init): It's a really bad idea trying to
	print a pointer to a PUNICODE_STRING as PUNICODE_STRING.  Fix it.
	* uinfo.cc (cygheap_domain_info::init): Print status codes as hex
	values in debug output.

2014-02-11  Corinna Vinschen  <corinna@vinschen.de>

	* autoload.cc (NetLocalGroupGetInfo): Replace NetGroupGetInfo.
	* cygheap.h (class cygheap_ugid_cache): Move ugid_cache_t type here
	and rename.
	(struct init_cygheap): Add cygheap_ugid_cache member "ugid_cache".
	* pwdgrp.h (class ugid_cache_t): Remove here.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Accommodate
	move of ugid_cache to cygheap.
	* sec_helper.cc (get_sids_info): Ditto.
	* uinfo.cc (ugid_cache): Remove.
	(pwdgrp::fetch_account_from_windows): Define id_val globally.
	Move SidTypeAlias handling into SidTypeUser/SidTypeGroup branch since
	aliases are handled like groups in SAM.  Accommodate move of ugid_cache
	to cygheap.  Consolidate code reading SAM comments into a single branch
	for both, SidTypeUser and SidTypeAlias.  For SidTypeAlias, fix thinko
	and call NetLocalGroupGetInfo rather than NetGroupGetInfo.  Simplify
	code setting Cygwin primary group for SAM accounts.  Add code to handle
	UNIX uid/gid from SAM comment.

2014-02-11  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* winsup.h (Interlocked*): Use intrinsic versions of Interlocked
	functions.

	* cygwin.sc.in: More closely emulate default pe/i386 linker script.

2014-02-10  Corinna Vinschen  <corinna@vinschen.de>

	* uinfo.cc (cygheap_domain_info::init): Drop accidentally leftover if
	statement.

2014-02-10  Corinna Vinschen  <corinna@vinschen.de>

	* uinfo.cc (cygheap_domain_info::init): Fix handling of account domain
	on donmain controllers.  Explain why.

2014-02-10  Corinna Vinschen  <corinna@vinschen.de>

	* cygheap.cc (cwcsdup): Change parameter to correct PWCSTR.
	(cwcsdup1): Ditto.
	* cygheap_malloc.h: Change declarations accordingly.

2014-02-10  Corinna Vinschen  <corinna@vinschen.de>

	* uinfo.cc (pwdgrp::fetch_account_from_windows): Add code to allow
	setting the primary group from the SAM comment field.

2014-02-10  Corinna Vinschen  <corinna@vinschen.de>

	* dcrt0.cc (child_info_spawn::handle_spawn): Call fixup_lockf_after_exec
	with additional argument to specify if the process has been execed
	or spawned.
	* flock.cc (fixup_lockf_after_exec): Take bool parameter to handle
	exec and spawn differently.  In case of spawn, just give up POSIX
	locks in favor of the still running parent.  Add comments to explain.

2014-02-09  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* environ.cc (strbrk): Properly deal with environment variable sans
	quote.

2014-02-09  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* environ.cc (strbrk): New function.
	(parse_options): Use strbrk to parse CYGWIN environment variable.

2014-02-09  Corinna Vinschen  <corinna@vinschen.de>

	Introduce reading passwd/group entries from SAM/AD.  Introduce
	/etc/nsswitch.conf file to configure it.
	* Makefile.in (DLL_OFILES): Add ldap.o.
	* autoload.cc: Import ldap functions from wldap32.dll.
	(DsEnumerateDomainTrustsW): Import.
	(NetGroupGetInfo): Import.
	* cygheap.h (class cygheap_domain_info): New class to keep global
	domain info.
	(class cygheap_pwdgrp): New class to keep passwd/group caches and
	configuration info from /etc/nssswitch.conf.
	(struct init_cygheap): Add cygheap_domain_info member "dom" and
	cygheap_pwdgrp member "pg".
	* cygtls.h (struct _local_storage): Remove unused member "res".
	Rearrange slightly, Add members pwbuf and grbuf to implement non-caching
	passwd/group fetching from SAM/AD.  Make pw_pos and pw_pos unsigned.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): Add RFC 2307
	uid/gid mapping.
	* fhandler_process.cc: Drop including pwdgrp.h.
	* fhandler_procsysvipc.cc: Ditto.
	* fhandler_registry.cc (fhandler_registry::fstat): Set key uid/gid
	to ILLEGAL_UID/ILLEGAL_GID rather than UNKNOWN_UID/UNKNOWN_GID.
	* grp.cc (group_buf): Drop.
	(gr): Drop.
	(pwdgrp::parse_group): Fill pg_grp.
	(pwdgrp::read_group): Remove.
	(pwdgrp::init_grp): New method.
	(pwdgrp::prep_tls_grbuf): New method.
	(pwdgrp::find_group): New methods.
	(internal_getgrsid): Convert to call new pwdgrp methods.
	(internal_getgrnam): Ditto.
	(internal_getgrgid): Ditto.
	(getgrgid_r): Drop 2nd parameter from internal_getgrgid call.
	(getgrgid32): Ditto.
	(getgrnam_r): Ditto for internal_getgrnam.
	(getgrnam32): Ditto.
	(getgrent32): Convert to call new pwdgrp methods.
	(internal_getgrent): Remove.
	(internal_getgroups): Simplify, especially drop calls to
	internal_getgrent.
	* ldap.cc: New file implementing cyg_ldap class for LDAP access to AD
	and RFC 2307 server.
	* ldap.h: New header, declaring cyg_ldap class.
	* passwd.cc (passwd_buf): Drop.
	(pr): Drop.
	(pwdgrp::parse_passwd): Fill pg_pwd.
	(pwdgrp::read_passwd): Remove.
	(pwdgrp::init_pwd): New method.
	(pwdgrp::prep_tls_pwbuf): New method.
	(find_user): New methods.
	(internal_getpwsid): Convert to call new pwdgrp methods.
	(internal_getpwnam): Ditto.
	(internal_getpwuid): Ditto.
	(getpwuid32): Drop 2nd parameter from internal_getpwuid call.
	(getpwuid_r): Ditto.
	(getpwnam): Ditto for internal_getpwnam.
	(getpwnam_r): Ditto.
	(getpwent): Convert to call new pwdgrp methods.
	* path.cc (class etc): Remove all methods.
	* path.h (class etc): Drop.
	* pinfo.cc (pinfo_basic::pinfo_basic): Set gid to ILLEGAL_GID rather
	than UNKNOWN_GID.
	(pinfo_init): Ditto.
	* pwdgrp.h (internal_getpwnam): Drop 2nd parameter from declaration.
	(internal_getpwuid): Ditto.
	(internal_getgrgid): Ditto.
	(internal_getgrnam): Ditto.
	(internal_getgrent): Drop declaration.
	(enum fetch_user_arg_type_t): New type.
	(struct fetch_user_arg_t): New type.
	(struct pg_pwd): New type.
	(struct pg_grp): New type.
	(class pwdgrp): Rework to provide functions for file and db requests
	and caching.
	(class ugid_cache_t): New class to provide RFC 2307 uid map caching.
	(ugid_cache): Declare.
	* sec_acl.cc: Drop including pwdgrp.h.
	* sec_auth.cc: Drop including dsgetdc.h and pwdgrp.h.
	(get_logon_server): Convert third parameter to ULONG flags argument
	to allow arbitrary flags values in DsGetDcNameW call and change calls
	to this function throughout.  Use cached account domain name rather
	than calling GetComputerNameW.
	(get_unix_group_sidlist): Remove.
	(get_server_groups): Drop call to get_unix_group_sidlist.
	(verify_token): Rework token group check without calling
	internal_getgrent.
	* sec_helper.cc (cygpsid::pstring): New methods, like string() but
	return pointer to end of string.
	(cygsid::getfromstr): Add wide character implementation.
	(get_sids_info): Add RFC 2307 uid/gid mapping for Samba shares.
	* security.cc: Drop including pwdgrp.h.
	* security.h (DEFAULT_UID): Remove.
	(UNKNOWN_UID): Remove.
	(UNKNOWN_GID): Remove.
	(uinfo_init): Move here from winsup.h.
	(ILLEGAL_UID): Ditto.
	(ILLEGAL_GID): Ditto.
	(UNIX_POSIX_OFFSET): Define.  Add lengthy comment.
	(UNIX_POSIX_MASK): Ditto.
	(MAP_UNIX_TO_CYGWIN_ID): Ditto.
	(ILLEGAL_UID16): Move here from winsup.h.
	(ILLEGAL_GID16): Ditto.
	(uid16touid32): Ditto.
	(gid16togid32): Ditto.
	(sid_id_auth): New convenience macro for SID component access.
	(sid_sub_auth_count): Ditto.
	(sid_sub_auth): Ditto.
	(sid_sub_auth_rid): Ditto.
	(cygpsid::pstring): Declare.
	(cygsid::getfromstr): Declare wide character variant.
	(cygsid::operator=): Ditto.
	(cygsid::operator*=): Ditto.
	(get_logon_server): Change declaration according to source code.
	* setlsapwd.cc (setlsapwd): Drop 2nd parameter from internal_getpwnam
	call.
	* shared.cc (memory_init): Call cygheap->pg.init in first process.
	* syscalls.cc: Drop including pwdgrp.h.
	* tlsoffsets.h: Regenerate.
	* tlsoffsets64.h: Ditto.
	* uinfo.cc (internal_getlogin): Drop gratuitious internal_getpwuid
	call.  Fix debug output.  Overwrite user gid in border case of a
	missing passwd file while a group file exists.
	(pwdgrp::add_line): Allocate memory on cygheap.
	(pwdgrp::load): Remove.
	(ugid_cache): Define.
	(cygheap_pwdgrp::init): New method.
	(cygheap_pwdgrp::nss_init_line): New method.
	(cygheap_pwdgrp::_nss_init): New method.
	(cygheap_domain_info::init): New method.
	(logon_sid): Define.
	(get_logon_sid): New function.
	(pwdgrp::add_account_post_fetch): New method.
	(pwdgrp::add_account_from_file): New methods.
	(pwdgrp::add_account_from_windows): New methods.
	(pwdgrp::check_file): New method.
	(pwdgrp::fetch_account_from_line): New method.
	(pwdgrp::fetch_account_from_file): New method.
	(pwdgrp::fetch_account_from_windows): New method.
	* winsup.h: Move aforementioned macros and declarations to security.h.

2014-02-09  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* sigproc.cc (sig_send): Don't bother with an error message if we are
	exiting.

2014-02-08  Corinna Vinschen  <corinna@vinschen.de>

	* miscfuncs.h (class NT_readline): New class to implement line-wise
	reading from file using native NT functions.
	* miscfuncs.cc (NT_readline::init): New method.
	(NT_readline::fgets): New method.
	* mount.cc (mount_info::from_fstab): Utilize NT_readline to read
	fstab files.

2014-02-06  Corinna Vinschen  <corinna@vinschen.de>

	* fhandler_disk_file.cc (fhandler_disk_file::fchown): Fix typo in
	comment.
	* mount.cc (mount_info::from_fstab): Use tmp_pathbuf rather than
	stack for big local buffer.
	* net.cc (cygwin_gethostname): Call GetComputerNameExA rather than
	GetComputerNameA if gethostname failed.
	* shared.cc (user_info::initialize): Fix formatting.

2014-02-06  Corinna Vinschen  <corinna@vinschen.de>

	* include/sys/file.h: Define flock and accompanying macros if not
	already defined in sys/_default_fcntl.h.

2014-02-04  Corinna Vinschen  <corinna@vinschen.de>

	* include/cygwin/version.h (CYGWIN_VERSION_DLL_MINOR): Bump to 29.

2014-01-30  Corinna Vinschen  <corinna@vinschen.de>

	* dir.cc (opendir): Call set_unique_id only with valid fh.

2014-01-30  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* fhandler.h (cltype): Add cl_buf_beg, cl_buf_end.
	* fhandler_console.cc (dev_console::console_attrs::set_cl_x): Honor
	buffer locations.
	(dev_console::console_attrs::set_cl_y): Ditto.
	(fhandler_console::write): On reset, use absolute positioning to go to
	beginning of buffer.  Clear entire buffer.

2014-01-27  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* gendef (_setjmp (x86)): Save FPU control word location in sequential
	location.  Adjust sigstack save accordingly.
	(_longjmp (x86)): Ditto for restore.

2014-01-27  Corinna Vinschen  <corinna@vinschen.de>

	* gendef (sigdelayed (x86_64)): Save and restore FPU control word.
	(_sigdelayed (x86)): Ditto.  Save and restore XMM registers.  Add
	comment.
	(_setjmp (x86)): Save FPU control word, following FreeBSD here.
	(_longjmp (x86)): Restore FPU control word.

2014-01-24  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* winf.cc (linebuf::fromargv): Treat '=' as a special character.

2014-01-23  Corinna Vinschen  <corinna@vinschen.de>

	* security.h (open_local_policy): Remove declaration.
	(lsa_open_policy): Declare.
	(lsa_close_policy): Declare.
	* sec_auth.cc (lsa_open_policy): Rename from open_local_policy.  Take
	server name as parameter.  Return NULL in case of error, rather than
	INVALID_HANDLE_VALUE.
	(lsa_close_policy): Rename from close_local_policy.  Make externally
	available.  Get handle by value.
	(create_token): Convert call to open_local_policy/close_local_policy
	according to aforementioned changes.
	(lsaauth): Ditto.
	(lsaprivkeyauth): Ditto.
	* setlsapwd.cc (setlsapwd): Ditto.

2014-01-22  Corinna Vinschen  <corinna@vinschen.de>

	* path.cc (etc::test_file_change): In case of NtQueryFullAttributesFile
	returning an error, only return true if file actually exists.

2014-01-20  Corinna Vinschen  <corinna@vinschen.de>

	* include/cygwin/in6.h (struct ipv6_rt_hdr): Define.
	* include/cygwin/socket.h: Fix formatting.
	(IP_UNICAST_IF): Define.
	(IPV6_JOIN_GROUP): Remove Windowism.
	(IPV6_LEAVE_GROUP): Ditto.
	(IPV6_UNICAST_IF): Define.
	(IPV6_TCLASS): Ditto.
	(IPV6_RECVTCLASS): Ditto.

2014-01-18  Corinna Vinschen  <corinna@vinschen.de>

	* include/netinet/ip6.h: New file, copied from FreeBSD vebatim.

2014-01-17  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* dtable.h (dtable::lock): Revert static.
	(dtable::unlock): Ditto.

2014-01-17  Corinna Vinschen  <corinna@vinschen.de>

	* passwd.cc (setpassent): Align to BSD definition.

2014-01-17  Corinna Vinschen  <corinna@vinschen.de>

	* syscalls.cc (popen): Introduce Glibc 'e' flag to allow thread-safe
	opening of the pipe with O_CLOEXEC flag.  Simplify FD_CLOEXEC handling.

2014-01-17  Corinna Vinschen  <corinna@vinschen.de>

	* include/sys/file.h (LOCK_SH): Drop definition in favor of new
	definitions in newlib.
	(LOCK_EX): Ditto.
	(LOCK_NB): Ditto.
	(LOCK_UN): Ditto.
	(flock): Ditto.
	(F_OK): Drop.  Already correctly defined in unistd.h.
	(X_OK): Ditto.
	(W_OK): Ditto.
	(R_OK): Ditto.

2014-01-17  Corinna Vinschen  <corinna@vinschen.de>

	* include/cygwin/config.h (_STDIO_BSD_SEMANTICS): Define as 1.

2014-01-16  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* dtable.h (dtable::lock): Make static.
	(dtable::unlock): Ditto.

2014-01-08  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* exception.h (cygwin_exception::open_stackdumpfile): Move old
	function into class.
	(cygwin_exception::h): New member.
	(cygwin_exception::cygwin_exception): Initialize h to NULL.
	* exceptions.cc (cygwin_exception::open_stackdumpfile): Move into
	cygwin_exception class.  Use 'h' class member.
	(cygwin_exception::dumpstack): Close stack dump file handle if opened.

2014-01-04  Christopher Faylor  <me.cygwin2014@cgf.cx>

	* fhandler.h (cltype): New enum.
	(dev_console::console_attrs): Define struct name.
	(dev_console::console_attrs::set_cl_x): New function.
	(dev_console::console_attrs::set_cl_y): New function.
	(fhandler_console::clear_screen): Redefine input params.
	* fhandler_console.cc: Throughout, reflect change in arguments to
	fhandler_console::clear_screeen.
	(fhandler_console::mouse_aware): Simplify logic slightly.
	(fhandler_console::scroll_screen): Remove hopefully obsolete win95
	code.
	(dev_console::console_attrs::set_cl_x): New function.
	(dev_console::console_attrs::set_cl_y): New function.
	(fhandler_console::clear_screen): Redefine input params.  Calculate
	position based on enum value.
	(region_split): Change arguments.  Simplify.
	(ReadConsoleOutputWrapper): Remove coord argument since we now always
	use 0, 0.  Send extra arguments to region_split.