Commit Graph

4387 Commits

Author SHA1 Message Date
Corinna Vinschen c6b7418c89 * environ.cc (environ_init): Avoid evaluating $CYGWIN twice. 2008-11-05 11:57:44 +00:00
Corinna Vinschen 8937c103ed * wincap.cc (all wincaps): Store in .cygwin_dll_common section same as
wincap.  Add comment to explain why.
2008-10-23 21:00:45 +00:00
Corinna Vinschen 3e97726f98 * autoload.cc (GetSystemWindowsDirectoryW): Define.
* kernel32.cc (GetWindowsDirectoryW): Implement to abstract from
	running under Terminal Services or not.
	(GetWindowsDirectoryA): Ditto.
2008-10-22 13:30:42 +00:00
Corinna Vinschen df54adb746 * passwd.cc (pwdgrp::read_passwd): Check if we're called within
user_shared initialization and ignore myself, if so.  Reformat
	conditional expression.
2008-10-21 16:47:28 +00:00
Corinna Vinschen 669bdeb822 * ntdll.h (NtSetAttributesFile): New inline function.
* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Use
	NtSetAttributesFile.
	* path.cc (symlink_worker): Ditto.
	* syscalls.cc (unlink_nt): Ditto.
	(rename): Omit FILE_SHARE_DELETE when opening files on Samba.  Add
	comment to explain why.
2008-10-20 19:30:06 +00:00
Corinna Vinschen edf5a5bd15 * dtable.cc (dtable::get_debugger_info): Call SetStdHandle
for the newly opened handle.  Explain why.
	(dtable::stdio_init): Don't duplicate standard error handle
	when stderr has already been created under debugger control.
2008-10-17 16:24:20 +00:00
Corinna Vinschen 5f9ca0d25a * sec_acl.cc (setacl): Align standard owner and group permissions
with alloc_sd.  Strip FILE_READ_ATTRIBUTES fromn setting
	FILE_GENERIC_EXECUTE permissions same as in alloc_sd.
	* security.cc (alloc_sd): Reformat expression.  Strip EA permission
	bits from owner_deny and group_deny computation.
2008-10-13 16:01:50 +00:00
Corinna Vinschen 079db16bf7 * fhandler_disk_file.cc (fhandler_base::fstat_helper): Check
for executable suffixes here in case we're on a file system
	not supporting permission.
	* path.cc (path_conv::check): Drop check for executable suffixes.
2008-10-09 14:23:09 +00:00
Corinna Vinschen 3059d18288 * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Keep track of
current position in non-buffered case, too.
2008-10-09 12:41:52 +00:00
Corinna Vinschen 2768ae50dd * grp.cc (pwdgrp::read_group): Generate more speaking group name
if passwd gid exists under different gid in /etc/group.
2008-10-09 11:52:54 +00:00
Corinna Vinschen c7a8139540 Fix ChangeLog entry 2008-10-09 10:01:49 +00:00
Corinna Vinschen c32849c5bc * path.cc (path_conv::is_binary): Always check for GetBinaryType.
* syscalls.cc (rename): Fix test for just changing case of name on
	case insensitive filesystems.
2008-10-09 09:43:02 +00:00
Corinna Vinschen 4e88323ba0 * path.cc (symlink_info::check_shortcut): Don't check for executability
here.
	(symlink_info::check_sysfile): Ditto.
2008-10-09 08:56:09 +00:00
Corinna Vinschen 3ae5cb32c5 * path.cc (path_conv::path_conv): Only assume executability by suffix
on file systems not supporting permissions.
2008-10-08 14:58:26 +00:00
Christopher Faylor c4cb50b3a8 * pthread.cc (pthread_create): Very minor formatting change.
* timer.cc (timer_thread): Ensure that any created thread defaults to detached
state.
2008-10-07 23:28:30 +00:00
Christopher Faylor f241db6f60 * cygtls.h (_cygtls::initialized): Remove bogus stack check which would when
checking the current thread from the current thread.
2008-10-07 02:38:15 +00:00
Christopher Faylor 585697536f * dcrt0.cc (dll_crt0_0): Don't initialize signals early when dynamically
loaded.
(dll_crt0_1): Wait until this phase to initialize signals when dynamically
loaded.
2008-10-05 16:48:30 +00:00
Christopher Faylor 36670cc234 * thread.cc (pthread_mutex::_fixup_after_fork): Reinstate DEBUGGING
conditional.
2008-09-30 02:39:07 +00:00
Christopher Faylor 18f43099f7 * thread.cc (pthread_mutex::_fixup_after_fork): Just reset lock to pristine
state after fork.  Don't recreate a mutex since it may not actually be needed.
2008-09-30 02:22:39 +00:00
Corinna Vinschen e7afe579f5 * flock.cc (inode_t::get_all_locks_list): Fix typo.
* posix.sgml: Add cfmakeraw to list of implemented BSD functions.
2008-09-29 17:03:49 +00:00
Eric Blake ddf8700121 * errno.cc (_sys_errlist): Add ECANCELED, ENOTRECOVERABLE, EOWNERDEAD. 2008-09-19 23:29:24 +00:00
Christopher Faylor f2c11dadcf * cygtls.h (unionent): Move from net.cc.
(unionent::struct_type): Move enum here.
(_local_storage::hostent_buf): Define as unionent.
(_local_storage::protoent_buf): Ditto.
(_local_storage::servent_buf): Ditto.
* net.cc (unionent): Move to cygtls.h.
(struct_type): Ditto.
(dup_ent): Define one function per {host,proto,serv}ent type.
(cygwin_getprotobyname): Simplify dup_ent call.  Removed now-unneeded return
type coercion.
(cygwin_getprotobynumber): Ditto.
(cygwin_getservbyname): Ditto.
(cygwin_getservbyport): Ditto.
(cygwin_gethostbyname): Ditto.
(cygwin_gethostbyaddr): Ditto.  tlsoffsets.h: Regenerate.
2008-09-16 02:04:27 +00:00
Christopher Faylor 175742d8c8 * Makefile.in: Add -c option which is now removed from COMPILE_C*.
* cygwin.din (cfmakeraw): Export.
* termios.cc (cfmakeraw): Implement.
* include/sys/termios.h (cfmakeraw): Declare.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
2008-09-12 22:32:07 +00:00
Christopher Faylor c4ca0e800a * cygwin.din (sys_sigabbrev): Add this here.
* dcrt0.cc (__argc,__argv,_check_for_executable): Remove dllexport decoration
since it is already handled in cygwin.din.
* errno.cc (_sys_errlist): Ditto.
* strsig.cc (sys_sigabbrev): Ditto.
* include/cygwin/signal.h: Protect use of dllimport when __INSIDE_CYGWIN__.
* libc/getopt.c: Revert previous changes.  Define __INSIDE_CYGWIN__.
2008-09-11 06:22:31 +00:00
Christopher Faylor cb7e1879ee * localtime.cc (increment_overflow): Mark as non-inline to prevent compiler
from complaining about the very thing we're trying to test.
* ntea.cc (read_ea): Reorganize to avoid a new compiler warning/error.
* sched.cc (sched_rr_get_interval): Ditto.
* select.cc (peek_serial): Ditto.
* libc/rexec.cc (ruserpass): Ditto.
* posix_ipc.cc (ipc_names): Make static to avoid a compiler warning
(and it's the right thing to do anyway).
2008-09-11 05:43:11 +00:00
Christopher Faylor 81ba2b77de * net.cc (in6addr_any, in6addr_loopback): Add appropriate number of braces
around initializer.
(dup_ent): Try harder to coerce the first argument to deal with more stringent
compiler.
(get_2k_ifs): Remove extraneous typedef.
(get_2k_ifs): Reorganize expression to avoid a compiler warning.
(get_xp_ifs): Ditto.
(get_nt_ifs): Ditto.
2008-09-11 04:58:45 +00:00
Christopher Faylor e3cbf1cc48 * fhandler.h (fhandler_pipe::raw_read): Remove __stdcall decoration.
* pipe.cc (fhandler_pipe::raw_read): Ditto.
2008-09-11 04:41:24 +00:00
Christopher Faylor 7b9e380f03 * cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.
* dtable.cc (handle_to_fn): Ditto.
* fhandler_console.cc (fhandler_console::read): Ditto.
(fhandler_console::scroll_screen): Ditto.
(dev_console::set_color): Ditto.
* fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto.
(fhandler_dev_dsp::read): Ditto.
* fhandler_tape.cc (mtinfo_drive::get_status): Ditto.
* hookapi.cc (find_first_notloaded_dll): Ditto.
* mmap.cc (msync): Ditto.
* pipe.cc (pipesync::pipesync): Ditto.
* sec_acl.cc (getace): Ditto.
* sec_auth.cc (create_token): Ditto.
(lsaauth): Ditto.
* select.cc (peek_pipe): Ditto.
* spawn.cc (av::fixup): Ditto.
* syscalls.cc (popen): Ditto.
* tty.cc (tty::init_session): Ditto.
* uinfo.cc (pwdgrp::load): Ditto.
* fhandler.cc (fhandler_base::setup_overlapped): Ditto.
(fhandler_base::wait_overlapped): Rename second use of res variable to wres or
errors are not returned correctly.
* dcrt0.cc: Remove obsolete variable.
* dll_init.cc (release_upto): Fix typo involving incorrect use of '|'.
* fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler
warning regarding coercing type-punned variables.
(fhandler_base::fstat_by_name): Ditto.  fhandler_fifo.cc
(fhandler_fifo::open_nonserver): Fix = vs.  == typo.
(fhandler_fifo::wait): Add all conditions to switch statement to avoid a
compiler warning.
* fhandler_process.cc: Avoid unneeded initialization of variables to zero.
(fhandler_socket::listen): Add braces around initializer.
* flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler
warning.  Fix problem with EWOULDBLOCK error return.
* path.cc (GUID_shortcut): Use braces around struct initializer.
(cygwin_conv_path): Reorganize to avoid a compiler warning.
* random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized"
warning.
* libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to
do the right thing with them.
* libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments
to avoid a compiler warning.
2008-09-11 04:34:24 +00:00
Christopher Faylor 5f05c64ce4 * fhandler_tty.cc (close_maybe): Check for both types of invalid handle before
attempting CloseHandle.
(fhandler_pty_master::setup): Only set inheritance on pty handles, not tty
handles.
2008-08-27 21:55:19 +00:00
Christopher Faylor 7e73b9cfd7 * shared_info.h (shared_info::create_root_entry): Remove extraneous
mount_info:: from declaration.
2008-08-26 16:56:30 +00:00
Corinna Vinschen a5d4ae5c5b * fhandler.h (class fhandler_pipe): Rename read and write
declarations to raw_read and raw_write.
	* pipe.cc (fhandler_pipe::raw_read): Rename from read.
	(fhandler_pipe::raw_write): Rename from write.
2008-08-26 15:39:17 +00:00
Christopher Faylor 8b2ed8e20a * fhandler.cc (fhandler_base::wait_overlapped): Reorganize again to accommodate
what appears to be an MSDN hint about not resetting the overlapped event prior
to calling GetOverlappedResult.
2008-08-22 04:06:01 +00:00
Corinna Vinschen 7d0a7940e6 * path.cc (symlink_info::check_shortcut): If file can't be opened,
treat it as non-symlink rather than generating an EIO error.
	(symlink_info::check_sysfile): Ditto.
2008-08-20 10:53:54 +00:00
Christopher Faylor fbf39a58cb * fhandler.cc (fhandler_base::wait_overlapped): Always assume that bytes will
be non-NULL.  Distinguish input result from result derived from WFMO and
GetOverlappedResult or res can never be -1.  Only raise SIGPIPE when writing.
* fhandler.h (fhandler_base::wait_overlapped): Pass first argument by value.
* fhandler_fifo.cc (fhandler_fifo::wait): Pass in dummy byte count to
wait_overlapped.
* pipe.cc (DEFAULT_PIPEBUFSIZE): Define to 65536 explicitly.
2008-08-20 02:25:06 +00:00
Corinna Vinschen ec8a7e416f * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Drop fattr variable
and use FILE_ATTRIBUTE_DIRECTORY directly in call to NtCreateFile.
	* posix_ipc.cc (ipc_mutex_init): Fix format string when creating IPC
	object name.
	(ipc_cond_init): Ditto.
	* security.cc (alloc_sd): Add parentheses to fix setting initial
	owner_allow value.
2008-08-19 09:46:31 +00:00
Christopher Faylor 46c6def37f * fhandler.cc (fhandler_base::wait_overlapped): Don't treat ERROR_BROKEN_PIPE
as a non-error.  Do raise SIGPIPE when it is detected.
2008-08-19 02:56:28 +00:00
Corinna Vinschen 2bd94f906d * mount.cc (mount_info::get_mounts_here): Don't subtract 2 from
Length if it's 0 anyway.
2008-08-15 12:33:26 +00:00
Corinna Vinschen 975f052c60 * mount.cc (mount_info::create_root_entry): Create default cygdrive
prefix with MOUNT_NOPOSIX flag.
2008-08-15 12:06:38 +00:00
Corinna Vinschen 2b41d940ca * path.cc (symlink_info::check): Don't use eabuf when trying to open
file a second time.  Call NtOpenFile instead of NtCreateFile in this
	case.
2008-08-15 10:19:12 +00:00
Corinna Vinschen 39f50e387b * fhandler_disk_file.cc (fhandler_disk_file::link): Fix linking
against symlinks.
2008-08-14 15:00:52 +00:00
Corinna Vinschen 88797e5979 * external.cc (cygwin_internal): Call set_security_attribute with
additional path_conv argument.
	* fhandler.cc (fhandler_base::open): Ditto.
	* fhandler_disk_file.cc (fhandler_disk_file::fchmod): Never set DOS
	R/O attribute when using ACLs.
	(fhandler_disk_file::mkdir): Ditto.  Set
	security descriptor on remote dirs after creating the dir, same as in
	fhandler_base::open.
	* fhandler_socket.cc (fhandler_socket::bind): Ditto for remote AF_LOCAL
	socket files.
	* path.cc (symlink_worker): Ditto. for remote symlinks.
	* security.cc (alloc_sd): Take additional path_conv argument.
	Accommodate throughout.  Drop setting FILE_WRITE_EA/FILE_READ_EA
	flags unconditionally (was only necessary for "ntea"). Don't set
	FILE_READ_ATTRIBUTES and FILE_WRITE_ATTRIBUTES unconditionally on
	Samba.  Add comment to explain.  Drop useless setting of
	STANDARD_RIGHTS_WRITE, it's in FILE_GENERIC_WRITE anyway.
	Remove FILE_READ_ATTRIBUTES bit from FILE_GENERIC_EXECUTE so as not
	to enforce read permissions on Samba.
	(set_security_attribute): Take additional path_conv argument.
	* security.h (set_security_attribute): Change prototype accordingly.
2008-08-14 14:05:04 +00:00
Corinna Vinschen 452f665fb1 * mount.cc (fillout_mntent): Always print noumount option last. 2008-08-13 15:30:52 +00:00
Corinna Vinschen aed2404c0d * mount.cc (fillout_mntent): Print options as taken in fstab and mount. 2008-08-13 15:11:25 +00:00
Corinna Vinschen 69d704beff * dll_init.cc: Throughout convert to use long pathnames.
* dll_init.h (struct dll): Change name to WCHAR, change operator [] to
	take PWCHAR argument.
2008-08-13 08:25:44 +00:00
Corinna Vinschen 0ea2c19934 * syscalls.cc (rename): If newpath doesn't exist, check if .exe suffix
in oldpath has been omitted before appending .exe to newpath.
2008-08-11 15:05:25 +00:00
Corinna Vinschen 36f17b4b40 * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Don't set
eom_detected when EOF is detected, thus returning 0 instead of
	setting errno to ENOSPC.
2008-08-09 11:09:02 +00:00
Corinna Vinschen b2d3f28fda * fhandler.cc (fhandler_base::open): Use Samba workaround generally
for all remote filesystems supporting ACLs.  Change comment and
	explain why.  Refer to the discussion which led to this.
2008-08-07 16:20:03 +00:00
Brian Dessent af15c95e70 * config/i386/profile.h (mcount): Mark asms volatile. 2008-08-05 19:20:58 +00:00
Christopher Faylor 53364a1fae * dll_init.cc (dll_global_dtors): Add an additional test to avoid walking the
linked list if it is empty.
(dll_list::detach): Don't set dll_global_dtors_recorded if we aren't actually
going to record any dlls.
2008-08-05 14:26:47 +00:00
Christopher Faylor bee18f45fd Changes suggested by Dave Korn.
* dcrt0.cc (cygwin_exit): Remove (hopefully) extraneous call to
dll_global_dtors.
* dll_init.cc (dll_global_dtors): Run destructors in reverse dependency/load
order.
* dll_init.h (dll_list): Add dll_global_dtors as a friend.
2008-08-04 15:55:32 +00:00
Christopher Faylor b23b171641 * dcrt0.cc (dll_crt0_1): Add a symbol denoting return from call to main().
* exceptions.cc (stack_info::walk): Stop walking the stack when we hit
_cygwin_exit_return rather than just blindly stopping when PC becomes zero.
2008-08-01 19:12:49 +00:00
Corinna Vinschen 3462d736b6 * path.cc (symlink_info::check): Handle (and explain) a special case
when accessing files matching DOS device names on SMB shares.
2008-07-31 14:48:28 +00:00
Corinna Vinschen 9fe98985b3 * spawn.cc (spawn_guts): Check constructed short pathname for being
a DOS device name and fall back to long path name, if so.
2008-07-31 14:41:19 +00:00
Corinna Vinschen d79a78e5c8 * fhandler_disk_file.cc (fhandler_base::fstat_by_name): Check for
file systems incapable of handling FileIdBothDirectoryInformation
	correctly.
	(fhandler_disk_file::opendir): Ditto.
	* path.cc (fs_info::update): Always clear at the start.
	Rearrange to make certain tests only on non-Samba, non-NFS remote
	drives.
	Add test for file systems known to be incapable of handling
	FileIdBothDirectoryInformation correctly.  Right now that's just
	"UNIXFS".
	* path.h (struct fs_info): Add has_buggy_fileid_dirinfo flag and
	accessor methods.
	(class path_conv): Add has_buggy_fileid_dirinfo method.
2008-07-30 14:41:59 +00:00
Corinna Vinschen b54881352d * sec_auth.cc (extract_nt_dom_user): Return domain and user name as
WCHAR.
	(cygwin_logon_user): Accommodate above change.  Convert password to
	WCHAR and call LogonUserW.
	* external.cc (cygwin_internal): Accommodate above change.
	* security.h (extract_nt_dom_user): Change prototype accordingly.
2008-07-30 12:10:20 +00:00
Christopher Faylor a010e6abed * cygwin.din (_getutline): Remove.
* lib/bsdlib.cc (login): Make argument const as per linux.
(logout): Ditto.
* syscalls.cc (getutid): Ditto.
(getutline): Ditto.
(pututline): Ditto.
(getutxent): Add comment mentioning non-thread-safety.
(getutxid): Ditto.
(getutxline): Ditto.
(pututxline): Ditto.
* sys/utmp.h: Declare arguments to various functions as const as per linux.
Remove bogus _getutline definition.
2008-07-30 04:58:24 +00:00
Christopher Faylor dbfc6f0e78 (missing changelog entry)
* include/cygwin/version.h: Add comment indicating that current API number bump
also has another consequence.
2008-07-30 01:37:55 +00:00
Corinna Vinschen f9afd0ced7 * Makefile.in (DLL_OFILES): Remove v8 regexp files.
(OBSOLETE_FUNCTIONS): Remove v8 regexp functions.
	(NEW_FUNCTIONS): Remove POSIX regex functions.
	* cygwin.din: Export POSIX regex functions with their correct symbol
	name.  Export with posix_ prefix for backward compatibility.
	* syscalls.cc (regfree): Remove ancient fake function.
	* regex/regex.h: Remove renaming regex functions within Cygwin.
	* regexp/*: Remove.
	* include /cygwin/version,.h: Bump API minor number.
2008-07-29 10:40:37 +00:00
Christopher Faylor 038af33480 * dcrt0.cc (dll_crt0_0): Remove calling malloc_init and
user_shared_initialize_1 from here.
(dll_crt0_1): Remove dynamically_loaded check.  Just call malloc_init and
user_shared_initialize unconditionally.
* shared.cc (user_shared_create): Rename from user_shared_initialize.
(user_shared_initialize): Rename from user_shared_initialize_1.  Move complete
user_shared content initialization code here from user_shared_create.
* syscalls.cc (seteuid32): Remove call to user_shared_initialize_1.  That is
implied by the "true" argument to user_shared_create().
2008-07-27 22:31:48 +00:00
Christopher Faylor b58e5f427a * mount.cc (mount_info::init): Add location where we're looking for fstab to
temporary message.
* lib/cygwin_crt0.c (cygwin_crt0): Simplify by eliminating accommodations for
ancient cygwin DLLs.
* lib/crt0.h: Include <windows.h> directly since it is needed.
2008-07-27 16:59:07 +00:00
Christopher Faylor 904413e731 * shared_info.h (shared_destroy): Declare.
* shared.cc (shared_destroy): Define new function to destroy shared memory
regions.
* init.cc (dll_entry): Call shared_destroy when dll detaches from the process.
2008-07-27 14:52:46 +00:00
Corinna Vinschen bfd2b1c930 * fhandler_socket.cc (fhandler_socket::send_internal): Send never more
then 64K bytes at once.  For blocking sockets, loop until entire data
	has been sent or an error occurs.
	(fhandler_socket::sendto): Drop code which sends on 64K bytes.
	(fhandler_socket::sendmsg): Ditto.
2008-07-27 10:20:49 +00:00
Christopher Faylor 34cc372abe * fhandler_tty.cc (fhandler_pty_master::setup): Reorganize so that all
operations for each end of the pipe are grouped together.
2008-07-26 19:35:21 +00:00
Corinna Vinschen e643b202e6 * dcrt0.cc (dll_crt0_1): Call malloc_init and user_shared_initialize_1
only in non-dynamically loaded case.
2008-07-26 08:32:28 +00:00
Corinna Vinschen 1d011c0a68 * dcrt0.cc (dll_crt0_0): Call malloc_init and user_shared_initialize_1
here in case we're dynamically loaded.  Explain why.
	(dll_crt0_1): Call user_shared_initialize_1 from here.
	* mount.cc (is_native_path): New inline function testing for native
	and long Win32 path prefix.
	(is_unc_share): Remove long WIn32 path prefix test.
	(mount_info::create_root_entry): Use PATH_MAX buffer.
	(mount_info::init): Ditto.
	(mount_info::add_item): Test for is_native_path as well.
	* path.cc (normalize_win32_path): Simplify native path prefix code.
	* shared.cc (user_shared_initialize_1): New function taking user
	shared initialization code relying on malloc and cygtls.
	(user_shared_initialize): Move mountinfo initialization to
	user_shared_initialize_1.
	* shared_info.h (user_shared_initialize_1): Declare.
	* syscalls.cc (seteuid32): Call user_shared_initialize_1 after user
	changed.
2008-07-25 15:23:56 +00:00
Corinna Vinschen e0fa82235a * mount.cc (mount_info::from_fstab): Change system_printf to
debug_printf on NtOpenFile failure.
2008-07-24 18:32:41 +00:00
Corinna Vinschen 520fcc9747 * shared.cc (user_shared_initialize): Fetch potentially changed Cygwin
username from /etc/passwd before loading mount table.
	(shared_info::init_installation_root): New function fetching Cygwin's
	installation root dir and storing as native NT path in global shared
	memory.
	(shared_info::initialize): Call init_installation_root exactly once at
	first startup.
	* shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Add installation_root member.
	(shared_info::init_installation_root): Declare.

	* grp.cc (pwdgrp::read_group): Call pwdgrp::load with native WCHAR path.
	* passwd.cc (pwdgrp::read_passwd): Ditto.  Avoid recursion.
	(etc::init): Take POBJECT_ATTRIBUTES instead of path_conv.
	* path.h (etc::init): Change prototype accordingly.
	* pwdgrp.h (class pwdgrp): Store path as UNICODE_STRING/PWCHAR instead
	of as path_conv.
	(pwdgrp::load): Accommodate prototype.
	* uinfo.cc (pwdgrp::load): Change argument type from char to wchar_t.
	Create native NT path here instead of calling path_conv.

	* mount.cc (find_root_from_cygwin_dll): Drop in favor of global
	initializaion in shared_info.
	(mount_info::init): Fetch native NT root dir from cygwin_shared.
	(mount_info::from_fstab): Expect native NT path and use native NT
	functions to access file.  Convert username part in user fstab path
	according to special char transformation rules.
	* path.cc (tfx_chars): Convert slash to backslash.
	(transform_chars): Implement for path given as PWCHAR.
	(transform_chars): PUNICODE_STRING version calls PWCHAR version.
	Remove useless commented code.
2008-07-24 18:25:52 +00:00
Corinna Vinschen 02151f07e6 * spawn.cc (spawn_guts): Fix previous patch for UNC paths. 2008-07-23 10:17:04 +00:00
Corinna Vinschen 73814f5ee2 Remove erroneous ChangeLog entry. 2008-07-22 17:31:35 +00:00
Corinna Vinschen 19dc8ba9b2 * spawn.cc (spawn_guts): Remove long path prefix from win32 path
before calling CreateProcess if path length is < MAX_PATH.
2008-07-22 16:59:59 +00:00
Corinna Vinschen 737a72dd0e * include/ctype.h: Declare __ctype_ptr__ to keep newlib build happy. 2008-07-22 10:38:18 +00:00
Corinna Vinschen 0485c2ceec * Makefile.in (cygcheck.exe): Link against ntdll.
* bloda.cc: link against ntdll functions statically.
	* cygpath.cc (get_user_folder): Drop 9x code.
	(print_version): Fix copyright.
	* mkgroup.c: Remove 9x code.
	* mkpasswd.c: Ditto.
	* path.cc (oopts): Add new mount options.
	* ps.cc: Fix copyright.
2008-07-21 13:44:42 +00:00
Corinna Vinschen 5a3ed02610 * autoload.cc (WNetGetProviderNameA): Define.
(WNetGetResourceParentA): Remove.
	* fhandler_netdrive.cc (struct net_hdls): New structure to keep
	WNet handles.  Stored in dir->__handle throughout.
	(thread_netdrive): Rewrite to enumerate all servers in all accessible
	domains and workgroups.
	(fhandler_netdrive::readdir): Simplify toplevel code.  Lowercase all
	server names in toplevel.
	(fhandler_netdrive::rewinddir): Close all WNet handles and free
	net_hdls structure.
2008-07-19 12:26:09 +00:00
Corinna Vinschen 8d7e80c2e1 * fhandler.cc (fhandler_base::open): Rename x to fh. On Samba, always
create file with NULL security descriptor and set the permissions
	afterwards.  Explain why.
2008-07-18 12:21:22 +00:00
Corinna Vinschen fd8e5366aa * environ.cc (known): Remove "binmode" option.
* fhandler.cc (binmode): Remove.
	(fhandler_base::set_flags): Accommodate binmode removal.
	* path.h (path_conv::set_binary): Remove.
	* pipe.cc (pipe): Create pipes always as binary pipes.
	* winsup.h (binmode): Remove declaration.
2008-07-18 08:16:40 +00:00
Corinna Vinschen 5fc03e3d73 * mount.cc (mount_info::from_fstab_line): Default to binary mount. 2008-07-17 14:14:34 +00:00
Corinna Vinschen a0c53f920f * path.cc (allow_winsymlinks): Revert default to create system bit
symlinks for speed.
2008-07-16 21:08:22 +00:00
Corinna Vinschen e4b575030b Add case-sensitivity.
Unconditionally handle mount points case-sensitive.
	Unconditionally handle virtual paths case-sensitive.
	Unconditionally handle registry paths case-insensitive.
	Otherwise, accommodate case-sensitivity of given path throughout.
	* cygheap.cc (cygheap_root::set): Get additional caseinsensitive
	parameter and store it.
	* cygheap.h (struct cygheap_root_mount_info): Add member
	caseinsensitive.
	* dlfcn.cc (get_full_path_of_dll): Drop PC_NOFULL parameter from call
	to path_conv::check.
	* environ.cc (pcheck_case): Remove.
	(check_case_init): Remove.
	(known): Drop "check_case" option.
	* exceptions.cc (open_stackdumpfile): Add comment.
	* fhandler.cc (fhandler_base::get_default_fmode): Call pathmatch
	instead of strcasematch.
	* fhandler_disk_file.cc: Accommodate case-sensitivity of given path
	throughout.
	(__DIR_mounts::check_mount): Unconditionally check virtual paths
	case-sensitive.
	(fhandler_disk_file::link): Drop case clash handling.
	(fhandler_disk_file::open): Ditto.
	(fhandler_disk_file::readdir_helper): Drop managed mount code.
	* mount.cc: Remove managed mount code and datastructures.
	(struct opt): Remove "managed" option.  Add "posix=0" and "posix=1"
	options.
	(fillout_mntent): Remove "managed" output.  Add "posix" output.
	* path.cc (struct symlink_info): Remove case_clash member and
	case_check method.
	(pcheck_case): Remove.
	(path_prefix_p): Take additional bool parameter "caseinsensitive".
	(pathnmatch): Ditto.
	(pathmatch): Ditto.
	(mkrelpath): Ditto.
	(fs_info::update): Set caseinsensitive flag according to file system
	name and FILE_CASE_SENSITIVE_SEARCH flag.  Add comment.
	(tfx_chars_managed): Remove.
	(transform_chars): Drop "managed" parameter.  Always use tfx_chars.
	(get_nt_native_path): Drop "managed" parameter.  Make sure drive letters
	are always upper case.
	(getfileattr): Change second parameter to denote caseinsensitivity.
	(path_conv::check): Initialize caseinsensitive to OBJ_CASE_INSENSITIVE.
	Set caseinsensitive according to global obcaseinsensitive flag, file
	system case sensitivity and MOUNT_NOPOSIX mount flag.
	Drop case_clash and all the related code.
	(symlink_worker): Drop case clash handling.
	(symlink_info::set): Drop setting case_clash.
	(symlink_info::case_check): Remove.
	(cwdstuff::set): Add comment.
	(etc::init): Take path_conv instead of PUNICODE_STRING as parameter to
	allow case sensitivity.
	* path.h (enum pathconv_arg): Drop PC_SYM_IGNORE.
	(enum case_checking): Remove.
	(enum path_types): Drop PATH_ENC, add PATH_NOPOSIX flag.
	(struct fs_info): Add caseinsensitive flag and accessor methods.
	(class path_conv): Add caseinsensitive member and define
	objcaseinsensitive method.  Drop case_clash member and isencoded method.
	(pathmatch): Change prototype according to above change.
	(pathnmatch): Ditto.
	(path_prefix_p): Ditto.
	(get_nt_native_path): Ditto.
	(class etc): Ditto.
	(fnunmunge): Remove prototype.
	* shared.cc (shared_info::init_obcaseinsensitive): Initialize
	obcaseinsensitive flag from obcaseinsensitive registry value.
	(shared_info::initialize): Call init_obcaseinsensitive here by the
	first process creating the shared memory.
	* shared_info.h (mount_item::fnmunge): Remove.
	(shared_info::obcaseinsensitive): Rename from obcaseinsensitivity.
	(shared_info::init_obcaseinsensitive): Declare.
	* syscalls.cc (try_to_bin): Add comment.
	* include/sys/mount.h (MOUNT_ENC): Remove flag.
	(MOUNT_NOPOSIX): Add flag.
2008-07-16 20:20:45 +00:00
Corinna Vinschen 80f6f52cb1 * fhandler_tape.cc (mtinfo::initialize): Remove synchronization stuff.
Just initialize drive data.
	* mtinfo.h (MTINFO_MAGIC): Remove.
	(MTINFO_VERSION): Remove.
	(class mtinfo): Remove magic and version members.
	* shared.cc (shared_info::initialize): Move call to
	get_session_parent_dir so that the dir creation is only called once.
	Move call to mt.initialize so that it's called only by the first
	process creating the shared memory.
	* shared_info.h (SHARED_INFO_CB): Accommodate change to shared_info.
	(CURR_SHARED_MAGIC): Ditto.
	(class shared_info): Add obcaseinsensitivity member.
2008-07-15 11:42:45 +00:00
Corinna Vinschen 3e153bcd55 * fhandler.cc (fhandler_base::fpathconf): On _PC_POSIX_PERMISSIONS
and _PC_POSIX_SECURITY, return true for NFS, too.
2008-07-14 20:46:27 +00:00
Corinna Vinschen e2406d71aa Throughout drop allow_ntsec and allow_smbntsec handling.
* environ.cc (set_ntsec): Remove.
	(set_smbntsec): Remove.
	(known): Remove ntsec and smbntsec options.
	* external.cc (check_ntsec): Return true if no filename is given.
	* mount.cc (oopts): Add "acl" and "noacl" options.  Set MOUNT_NOACL
	flag accordingly.
	(fillout_mntent): Handle MOUNT_NOACL flag.
	* path.h (enum path_types): Add PATH_NOACL.
	* security.cc (allow_ntsec): Remove.
	(allow_smbntsec): Remove.
	* security.h (allow_ntsec): Drop declaration.
	(allow_smbntsec): Drop declaration.
	* include/sys/mount.h (MOUNT_NOACL): Define.
2008-07-14 20:22:03 +00:00
Corinna Vinschen bf216dcad6 * miscfuncs.cc (cygwin_strncasecmp): Fix bug which results in
prematurely truncated strings.  Simplify target length argument to
	sys_mbstowcs.
2008-07-14 19:58:16 +00:00
Corinna Vinschen 88d1b6df94 * autoload.cc (GetExtendedTcpTable): Define.
* fhandler_socket.cc (address_in_use): Take const struct sockaddr
	pointer as argument.  Implement additional AF_INET6 table check.
	(fhandler_socket::bind): Drop AF_INET test before calling
	address_in_use.
	* net.cc (ipv4_getnameinfo): Return EAI_FAMILY instead of 1 if
	called with unsupported af_family.
2008-07-14 15:56:11 +00:00
Eric Blake 25dab6dc60 Fix usage of recently fixed Interlocked* functions.
* winbase.h (ilockincr, ilockdecr, ilockexch, ilockcmpexch): Add
volatile qualifier, to match Interlocked* functions.
2008-07-12 18:09:17 +00:00
Corinna Vinschen 84e2d2e6cf * select.cc (peek_pipe): Temporarily revert patch from 2008-05-30. 2008-07-11 16:37:29 +00:00
Corinna Vinschen 9a51257715 Change length for domain buffers from INTERNET_MAX_HOST_NAME_LENGTH to
MAX_DOMAIN_NAME_LEN throughout.
	* cyglsa.h (CYG_LSA_MAGIC): New value.
	(cyglsa_t): Define username and domain as WCHAR arrays.
	* errno.cc (errmap): Add mapping for ERROR_NONE_MAPPED.
	* sec_auth.cc: Drop 'w' prefix from WCHAR string variable names where
	appropriate.
	(extract_nt_dom_user): Prefer resolving by SID before resolving by
	domain\name pair.
	(cygwin_logon_user): Don't print cleartext password in debug output.
	Change comment.
	(get_user_groups): Revert calls to LookupAccountNameW to use NULL
	server instead of explicit server name, according to MSDN.
	(get_user_local_groups): Ditto.
	(get_server_groups): Fetch domain and user name from usersid per
	LookupAccountSidW instead of calling extract_nt_dom_user.
	(lsaauth): Fetch domain and user name from usersid per LookupAccountSidW
	instead of calling extract_nt_dom_user.
	* sec_helper.cc (cygpriv): Convert to wchar_t pointer array.
	(privilege_luid): Convert first parameter to  PWCHAR.
	(privilege_name): Return wchar_t pointer.
	(set_privileges): Accommodate debug output.
	* security.h (privilege_luid): Change prototype accordingly.
2008-07-11 10:00:36 +00:00
Corinna Vinschen c68cb84e88 * cyglsa.h (SECURITY_STRING): Define.
(enum _SECPKG_NAME_TYPE): Define.
	(struct _SECPKG_CALL_INFO): Define.
	(struct _LSA_SECPKG_FUNCS): Extend to full size.  Define unused
	functions lazily.
	(cygprf_t): Define.
	* sec_auth.cc (lsaauth): Use actual primary group if no admins group.
	Add (disabled) code to fetch token from profil data.
2008-07-10 18:01:25 +00:00
Corinna Vinschen 9035519215 * sec_auth.cc (verify_token): Allow builtin groups missing in a token
and it's still valid.  Explain why.
2008-07-09 15:45:08 +00:00
Corinna Vinschen 5558de95e5 * autoload.cc (DsGetDcNameW): Replace DsGetDcNameA.
* dcrt0.cc (child_info_spawn::handle_spawn): Drop artificial
	supplementary group list from calling setgroups in parent.
	* grp.cc (internal_getgroups): Drop 9x-only code.  Reformat.
	* sec_auth.cc (get_logon_server): Do everything in WCHAR only.
	(get_user_groups): Ditto.  Use wlogonserver in LookupAccountNameW
	calls, too.
	(is_group_member): Get logon server as first argument and use in call
	to NetLocalGroupGetMembers.
	(get_user_local_groups): Get logon server as first argument and use in
	calls to NetLocalGroupEnum and LookupAccountNameW.  Revamp to work
	more correctly in domain environments.
	(get_server_groups): Accommodate aforementioned changed function calls.
	* security.h (get_logon_server): Change prototype accordingly.
	* uinfo.cc (cygheap_user::env_logsrv): Accommodate changed
	get_logon_server call.
2008-07-09 11:58:38 +00:00
Corinna Vinschen 8f7208243e * grp.cc (internal_getgroups): Also add integrity-enabled groups. 2008-07-09 09:14:12 +00:00
Corinna Vinschen 2827371898 * sec_auth.cc (verify_token): Disable code which returns false if
the token contains additional groups not requested by setgroups.
	Explain why.
2008-07-09 08:10:25 +00:00
Corinna Vinschen 23672785ee * fhandler_socket.cc (fhandler_socket::bind): Don't run explicit
local socket test in SO_REUSEADDR case on systems supporting
	enhanced socket security.  Explain why.  Only call address_in_use
	for AF_INET sockets.
	* net.cc (cygwin_setsockopt): Don't call setsockopt to set SO_REUSEADDR
	on systems supporting enhanced socket security.  Add comment.
	* wincap.h (wincaps::has_enhanced_socket_security): New element.
	* wincap.cc: Implement above element throughout.
2008-07-08 20:12:46 +00:00
Corinna Vinschen b8fbf5d4c4 * net.cc (ipv6_inited): Make NO_COPY. 2008-07-08 12:37:44 +00:00
Corinna Vinschen bb82bbe6ff * path.cc (path_conv::is_binary): Fix test. Add comment. 2008-07-02 14:00:27 +00:00
Corinna Vinschen 7b3e3bfd49 * net.cc (cygwin_bindresvport_sa): Fix usage of last_used_bindresvport. 2008-06-24 13:13:44 +00:00
Corinna Vinschen 3db08eeece * include/limits.h (PATH_MAX): Add comment.
* include/cygwin/config.h (__FILENAME_MAX__): Define as 4096.  Add
	comment.
2008-06-21 20:24:45 +00:00
Corinna Vinschen 83e80c9178 * fhandler_tty.cc (fhandler_pty_master::setup): Fix pipe inheritance. 2008-06-19 19:50:47 +00:00
Christopher Faylor 4f1ed68c5c * strsig.cc (strsignal): Return non-const buffer to allow building with recent
newlib change.
2008-06-19 00:02:13 +00:00
Corinna Vinschen e4278ecbd2 * sec_auth.cc (DsGetDcNameA): Drop declaration.
(DS_FORCE_REDISCOVERY): Drop definition.
2008-06-17 18:54:16 +00:00
Christopher Faylor 7ba4aab9b6 * spawn.cc (spawn_guts): Reinstate call to fhandler_console::need_invisible
since it is required to prevent console flashing.
2008-06-17 15:38:17 +00:00
Corinna Vinschen 95c9157df0 * include/resolv.h (_getshort): Drop declaration.
(_getlong): Ditto.
2008-06-17 10:05:28 +00:00
Corinna Vinschen 0730461203 * mount.cc (mount_info::get_cygdrive_info): Fix usage of user and
system arguments.  Strip trailing slash from path for backward
	compatibility.
2008-06-13 15:22:59 +00:00
Corinna Vinschen 9cdaf8733f * fhandler.h (set_console_state_for_spawn): Drop declaration.
* fhandler_console.cc (set_console_state_for_spawn): Remove.
	(fhandler_console::open): Set console state last.  Don't set
	ENABLE_PROCESSED_INPUT flag.
	* spawn.cc (spawn_guts): Drop call to set_console_state_for_spawn.
2008-06-12 15:57:23 +00:00
Corinna Vinschen 24790b9cdb * path.cc (get_nt_native_path): Drop considerations for DOS devices.
Keep relative paths relative.
	(cygwin_conv_path): Don't try to skip native NT prefixes on relative
	paths.
2008-06-11 14:06:05 +00:00
Corinna Vinschen abe2834a49 * include/cygwin/version.h (CYGWIN_VERSION_MOUNT_REGISTRY): Bump.
(CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME): Remove.
	(CYGWIN_INFO_CYGDRIVE_FLAGS): Remove.
	(CYGWIN_INFO_CYGDRIVE_PREFIX): Remove.
	(CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX): Add comment to differ from the
	registry related defines.
2008-06-11 09:43:59 +00:00
Corinna Vinschen 373a7e22e2 * fhandler_procnet.cc (dad_to_flags): Fix comment. 2008-06-11 08:38:39 +00:00
Corinna Vinschen c9227bf8a7 * fhandler_procnet.cc (get_scope): New static function to evaluate
scope.
	(dad_to_flags): New static array to convert Windows DAD state to
	Linux values.
	(format_procnet_ifinet6): Drop asking for IfIndex, just use Ipv6IfIndex.
	Use get_scope and dad_to_flags to generate more accurate linux-like
	output.
2008-06-10 19:58:58 +00:00
Corinna Vinschen bbfcc68ad2 * net.cc (if_nametoindex): Fix typo in call to get_adapters_addresses.
(if_indextoname): Prefer IPv6 loopback device name over IPv4 loopback
	device name on pre-Vista systems.
	(if_nameindex): Ditto.
2008-06-10 18:15:57 +00:00
Corinna Vinschen 7a2c0a0d6b * fhandler_procnet.cc (format_procnet_ifinet6): Use sprintf rather than
__small_sprintf.
	* net.cc (if_nametoindex): Prefer IPv6IfIndex over IfIndex for
	consistency with /proc/net/if_inet6.
	(if_indextoname): Ditto.
	(if_nameindex): Ditto.
2008-06-10 17:24:00 +00:00
Corinna Vinschen 58014a9b46 * mount.cc (mount_info::from_fstab): Read sizeof (buf) - 2 bytes.
Add code to handle overly long lines.
2008-06-10 17:17:44 +00:00
Corinna Vinschen 93e9098f7c * sec_auth.cc (lsaauth): Make returned token inheritable. 2008-06-10 15:16:01 +00:00
Corinna Vinschen be5937cd97 * devices.cc: Regenerate. 2008-06-10 14:48:24 +00:00
Christopher Faylor 0498e171a5 * devices.in: Remove "Global" from tty device. 2008-06-09 14:01:40 +00:00
Christopher Faylor c230ba2a1c * signal.cc (abort): Only flush streams after signal handler. 2008-06-09 13:45:59 +00:00
Christopher Faylor 585cd03044 * cygwin.sc: Remove unrequired and erroneous definition. 2008-06-03 02:22:36 +00:00
Christopher Faylor 11a36faaa6 * select.cc (peek_pipe): Semi-reinstate pipe NT-special write detection. 2008-05-30 17:56:37 +00:00
Christopher Faylor 4f3af63913 add missing entry 2008-05-29 17:09:10 +00:00
Christopher Faylor 2bae7a19e4 * devices.in: Change mapping for /dev/ttyS* and /dev/com*. 2008-05-29 17:08:45 +00:00
Christopher Faylor 12cf19762d * mount.cc (mount_info::from_fstab): Use proper buffer size. 2008-05-25 23:51:32 +00:00
Christopher Faylor f524521aab * mount.cc (mount_info::init): Revert previous change.
(mount_info::from_fstab): Change system_printf to debug_printf.  Just use a
local NT_MAX_PATH sized temporary buffer.
2008-05-24 15:59:01 +00:00
Corinna Vinschen 0fd62c686d * mount.cc (mount_info::init): Recreate path when trying to read the
user fstab file.
2008-05-24 10:07:49 +00:00
Corinna Vinschen 362ce9fa99 * path.cc (symlink_info::check): Reorder test for nfs symlinks. 2008-05-24 09:54:32 +00:00
Corinna Vinschen 6afd630106 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Don't try to
use FileIdBothDirectoryInformation on NFS shares.  Fix comment to
	explain why.
	* path.cc (symlink_info::check): Reinstantiate no_ea.  Use in
	erroneously changed condition.
2008-05-23 17:22:18 +00:00
Christopher Faylor e765b3c0ad * mount.cc (find_root_from_cygwin_dll): New function factored from from_fstab.
Avoid use of tls since it isn't necessarily initialized when cygwin1.dll is
dynamically loaded.
(mount_info::create_root_entry): Ditto.
(mount_info::init): Calculate cygwin root once.  Use create_root_entry to
record it.  Pass fstab location to from_fstab.
(mount_info::from_fstab): Move root calculation stuff elsewhere, as per above.
* shared_info.h (mount_info::from_fstab_line): Make private.
(mount_info::fstab): Ditto.  Accommodate new arguments.
2008-05-23 16:38:51 +00:00
Christopher Faylor 7cd4542873 * mount.cc (mount_info::from_fstab): Use cygwin_hmodule rather than trying to
find handle based on cygwin1.dll.
* path.cc (symlink_info::check): Remove unused variable.
2008-05-23 15:33:03 +00:00
Corinna Vinschen 7075440208 * shared.cc (open_shared): Fix comments. Fix a condition which has
been overlooked to revert to its old state in change from 2008-04-18.
2008-05-23 11:59:37 +00:00
Corinna Vinschen 1870c68806 * path.cc (symlink_info::check): Define eabuf and easize outside of
loop.  Set to NULL on first STATUS_EAS_NOT_SUPPORTED.  Align comments.
	Fix formatting.
2008-05-23 11:00:35 +00:00
Corinna Vinschen b4ea313a85 * fhandler_disk_file.cc (fhandler_disk_file::readdir): Eliminate
compiler warning.
2008-05-23 10:01:34 +00:00
Christopher Faylor 81adfe2862 * path.cc (symlink_info::check): Don't pass EaBuffer to NtCreateFile if it has
indicated that it isn't appropriate.
* ntdll.h (STATUS_EAS_NOT_SUPPORTED): Define.
* winsup.h: Remove __builtin* defines.
2008-05-23 07:13:47 +00:00
Corinna Vinschen 8a179967e6 * grp.cc (internal_getgroups): Fix thinko. Only add enabled groups to
the group list.
2008-05-22 21:14:30 +00:00
Corinna Vinschen 2122048bd6 * grp.cc (internal_getgroups): Don't add deny-only groups to the group
list.
2008-05-22 21:03:54 +00:00
Corinna Vinschen c15121a287 * cygtls.h (struct san): Add two int values to store the current
tls_pathbuf counters.
	(return_from_fault): Restore tls_pathbuf counters.
	(setup_fault): Save tls_pathbuf counters.
	* tlsoffset.h: Regenerate.
2008-05-22 20:32:15 +00:00
Corinna Vinschen c1410a8d1e * sec_acl.cc (setacl): Set errno to EINVAL if user or group don't exist. 2008-05-22 12:43:18 +00:00
Corinna Vinschen b72918135c * path.cc (cygwin_conv_path): Define tp before setting up faul handler.
* syscalls.cc: Ditto, throughout.
	(gen_full_path_at): Add bool parameter to allow NULL pathname.
	(futimesat): Allow NULL pathname as GLIBC.
2008-05-22 11:18:46 +00:00
Christopher Faylor 9ea50a60e1 * string.h (strchr): Eliminate.
* syscalls.cc (rename): Work around inexplicable C++ warning.
2008-05-22 01:25:37 +00:00
Corinna Vinschen 380b8bac12 * fhandler_disk_file.cc (get_ino_by_handle): Rename pfai to fai.
(fhandler_base::fstat_by_handle): Drop fai_size and pfai in favor of
	static struct fai_buf.  Restructure.
	(fhandler_base::fstat_by_name): Drop fvi_size and pfvi.  Drop fdi_size
	and pfdi in favor of static struct fdi_buf.  Drop redundant test for
	existance.  Use FileDirectoryInformation class instead of
	FileBothDirectoryInformation.  Drop call to NtQueryVolumeInformationFile
	in favor of using pc.fs_serial_number ().  Fix FileId information given
	to fstat_helper.
	(fhandler_disk_file::fstatvfs): Drop fvi_size, pfvi, fai_size and pfai.
	Drop getting FileFsVolumeInformation and FileFsAttributeInformation in
	favor of using the related path_conv info.
	(fhandler_disk_file::opendir): Fix comment.
	(fhandler_disk_file::readdir): Ditto.  Use FileDirectoryInformation
	class instead of FileBothDirectoryInformation.
	* path.cc (fs_info::update): Store MaximumComponentNameLength in new
	member name_len.
	* path.h (struct fs_info): Use ULONG rather than DWORD.  Add member
	name_len to store MaximumComponentNameLength.  Add accessor methods.
	(path_conv::fs_name_len): New method.
2008-05-21 10:23:19 +00:00
Corinna Vinschen 0d3f365881 * fhandler.h (dirent_states): Add dirent_nfs_d_ino state and add it to
dirent_info_mask.
	* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set
	dirent_nfs_d_ino flag for NFS shares.  Explain why.
	(fhandler_disk_file::readdir): Use FileNamesInformation instead of
	FileBothDirectoryInformation info class on NFS clients not supporting
	the FileIdBothDirectoryInformation info class.  Use local pointers to
	accommodate different offsets.
	* path.cc (symlink_info::check): Don't test directories for symlinks
	on NFS shares.  Enhance comment.
2008-05-21 09:02:42 +00:00
Corinna Vinschen 2762ac6c19 * syscalls.cc (FILTERED_MODE): Define valid chmod mode mask.
(chmod): Call fh->fchmod with filtered mode.
	(fchmod): Ditto.
2008-05-21 08:05:53 +00:00
Corinna Vinschen 6e961ccc7e * fhandler_disk_file.cc (fhandler_disk_file::fchmod): Fix test for
S_IFSOCK in mode bits.
2008-05-20 21:08:39 +00:00
Corinna Vinschen 28259ba2dd * path.cc (symlink_worker): Fix EA buffer size info given to
NtCreateFile.
	(symlink_info::check_nfs_symlink): Get 64K buffer for EA buffer.
	Change EA buffer size info given to NtQueryEaFile accordingly.
2008-05-20 18:26:45 +00:00
Corinna Vinschen c44e0ba1f5 * path.cc (symlink_info::check_shortcut): Minimize requested file
access flags.
	(symlink_info::check_sysfile): Ditto.  Add missing `else'.
	(symlink_info::check): Only retry to open file if first try failed
	with access denied.
2008-05-20 18:19:32 +00:00
Corinna Vinschen 4c5627e7e2 * path.cc (fs_info::update): Re-add opening the unsplitted path
for fillout_mntent's sake.
2008-05-20 17:18:08 +00:00
Corinna Vinschen ec0165f29c * fhandler_disk_file.cc (fhandler_disk_file::mkdir): Create directories
on NFS shares with correct mode bits.
2008-05-20 16:24:06 +00:00
Corinna Vinschen 316d9cabfe * winsup.h (cygwin_inet_addr): Fix type of declaration. 2008-05-20 15:39:26 +00:00
Corinna Vinschen fe6934da14 * Makefile.in (DLL_OFILES): Add nfs.o.
* fhandler.cc (fhandler_base::open): Open files on NFS shares with
	correct access flags and EAs.
	* fhandler.h (fhandler_base::fstat_by_nfs_ea): Declare.
	* fhandler_disk_file.cc (fhandler_base::fstat_by_nfs_ea): New method.
	(fhandler_base::fstat_by_handle): Call fstat_by_nfs_ea for files on
	NFS shares.
	(fhandler_disk_file::fchmod): Use NFS specific method to set mode for
	files on NFS shares.  Don't overrule errno from call to
	set_file_attribute with errno from NtSetInformationFile call.
	(fhandler_disk_file::fchown): Add comment.
	* mount.cc (fillout_mntent): Accommodate change in second parameter
	to fs_info::update.
	* nfs.cc: New file.
	* nfs.h: New file.
	* path.cc (fs_info::update): Take handle instead of bool as second
	parameter.  Use that handle if it's not NULL.  Only close handle if
	it has been opened here.  Use static defined buffers instead of
	alloca'd buffers.
	(path_conv::check): Call symlink_info::check with reference to fs.
	Don't call fs.update here if file exists.
	(conv_path_list): Prefer tmp_pathbuf buffer over using alloca.
	(symlink_worker): Use NFS specific method to create symlinks on NFS
	shares.  Prefer tmp_pathbuf buffer over using alloca.
	(symlink_info::check_shortcut): Reopen file from incoming handle
	with necessary FILE_GENERIC_READ flag.  Prefer tmp_pathbuf buffer over
	using alloca.
	(symlink_info::check_sysfile): Ditto.
	(symlink_info::check_reparse_point): Use tmp_pathbuf buffer to
	allocate REPARSE_DATA_BUFFER.
	(symlink_info::check_nfs_symlink): New method.
	(enum symlink_t): Remove.
	(symlink_info::check): Don't use NtQueryAttributesFile.  Rather, open
	file with necessary access flags and call NtQueryInformationFile.  Fix
	error handling in case file can't be opened.  For existing files, call
	fs_info::update here.  Restructure symlink checking to accommodate the
	fact that the file is already open.  Add case for NFS symlinks.
	* path.h (fs_info::update): Take handle instead of bool as second
	parameter.
2008-05-20 15:11:23 +00:00
Corinna Vinschen 2f33b79950 * syscalls.cc (rename): Fix condition when to start a transaction. 2008-05-20 10:24:25 +00:00
Corinna Vinschen c211f8eb24 * path.cc (path_conv::check): Free wide_path and normalized_path if
necessary.
	* path.h (path_conv::path_conv): Set wide_path, normalized_path and
	normalized_path_size to 0 in all constructors.
2008-05-20 10:18:12 +00:00
Corinna Vinschen 78ee2ae11f * syscalls.cc (rename): Allocate temporary path buffers using
tmp_pathbuf.  Don't try to unset R/O attribute on dstpc if a
	removepc exists.  dstpc is a non-existant file in that case.
2008-05-19 20:22:29 +00:00
Christopher Faylor a4e3764e51 * include/stdint.h: Use int rather than long for {u,}int32_t. 2008-05-17 21:34:05 +00:00
Corinna Vinschen 3ba70bba2f * CYGWIN_LICENSE: Remove duplicate file here. 2008-05-16 08:40:07 +00:00