Commit Graph

4633 Commits

Author SHA1 Message Date
Corinna Vinschen 51303cbd0c * Makefile.in (DLL_OFILES): Add setlsapwd.o.
* cygserver.h (CYGWIN_SERVER_VERSION_API): Bump.
	(request_code_t): Define CYGSERVER_REQUEST_SETPWD request type.
	* cygserver_msg.h (client_request_msg::retval): Use default value of -1
	for retval if msglen is 0.
	* cygserver_sem.h (client_request_sem::retval): Ditto.
	* cygserver_shm.h (client_request_shm::retval): Ditto.
	* cygserver_setpwd.h: New file.
	* external.cc (cygwin_internal): Implement new CW_SET_PRIV_KEY type.
	* sec_auth.cc (open_local_policy): Make externally available.
	Get ACCESS_MASK as argument.
	(create_token): Accommodate change to open_local_policy.
	(lsaauth): Ditto.
	(lsaprivkeyauth): New function fetching token by retrieving
	password stored in Cygwin or Interix LSA private data area and
	calling LogonUser with it.
	* security.h (lsaprivkeyauth): Declare.
	(open_local_policy): Declare.
	* setlsapwd.cc: New file implementing setting LSA private data password
	using LsaStorePrivateData or by calling cygserver if available.
	* syscalls.cc (seteuid32): Add workaround to get the original token
	when switching back to the original privileged user, even if
	setgroups group list is still active.  Add long comment to explain why.
	Call lsaprivkeyauth first, only if that fails call lsaauth or
	create_token.
	* include/cygwin/version.h: Bump API minor number.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add CW_SET_PRIV_KEY.
2008-11-26 10:18:10 +00:00
Corinna Vinschen 99abc9526e * fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Drop
initialization of bytes_to_read.  Set bytes_to_read to len in
	non-buffered case.  Call read_bytes correctly with bytes_to_read
	instead of len.
2008-11-21 13:46:17 +00:00
Corinna Vinschen b007725e34 * mmap.cc (MapView): Add NT status to debug output. 2008-11-21 10:52:10 +00:00
Corinna Vinschen babd4a9c62 * autoload.cc (GetSystemDEPPolicy): Define.
(GetProcessDEPPolicy): Ditto.
	(SetProcessDEPPolicy): Ditto.
	* dcrt0.cc (disable_dep): New static function.
	(dll_crt0_0): Call disable_dep on platforms requiring it.  Add longish
	comment to explain the circumstances.
	* wincap.h (wincaps::ts_has_dep_problem): New element.
	* wincap.cc: Implement above element throughout.
	(wincapc::init): Set ts_has_dep_problem to true on 2008 Terminal
	Servers.
	* winsup.h (WINVER): Set to 0x0601.
2008-11-12 11:04:27 +00:00
Corinna Vinschen 2348e4f3c6 * mount.cc (mount_info::cygdrive_win32_path): Always upper case
DOS drive letter to accommodate case sensitivity.
	(cygdrive_getmntent): Ditto.
	* path.cc (path_conv::check): Invalidate wide_path after making path
	relative.
2008-11-11 11:45:05 +00:00
Corinna Vinschen 188fb31537 * environ.cc (create_upcaseenv): New static variable.
(renv_arr): New static array to keep track of environment variables
	which have to be always uppercased.
	(idx_arr): Ditto.
	(start_at): Ditto.
	(ucreqenv): New function to uppercase only the environment variables
	from renv_arr.
	(parse_thing): Add "upcaseenv" setting.
	(environ_init): Parse $CYGWIN before doing anything else.  Call
	ucreqenv instead of ucenv if CYGWIN=noupcaseenv is set.
2008-11-11 10:51:03 +00:00
Christopher Faylor 6865f89087 * path.cc (normalize_win32_path): Don't add a trailing '\' if the cwd returns a
path with a trailing '\'.
2008-11-11 03:51:55 +00:00
Christopher Faylor dc74da050c * pthread.cc (pthread_mutex::_unlock): Avoid unlocking a mutex if the
recursion_counter is already 0.
(pthread_mutex::_destroy): Don't consider a mutex busy if its recursion_counter
== 0.
(pthread_mutex::_fixup_after_fork): Set recursion_counter to 0 to flag that
we've just forked.  Don't reset the owner of this mutex since the forkee may
think it still owns the mutex.  Reinstate initialization of win32_obj_id.
* fhandler_floppy.cc (fhandler_dev_floppy::raw_read): Initialize a variable to
bypass a C++ warning.
2008-11-07 18:32:41 +00:00
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 30caac0569 add comments 2008-08-25 17:27:06 +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