Commit Graph

2164 Commits

Author SHA1 Message Date
Corinna Vinschen ea3ba11499 * cygheap.h (class cygheap_user): Use INVALID_HANDLE_VALUE as invalid
value for tokens.
	* syscalls.cc (seteuid32): Ditto.  Set new_token to process token if
	process token is suitable.
	* uinfo.cc (uinfo_init): Initialize tokens in cygheap user info
	to INVALID_HANDLE_VALUE.

	* cygheap.h (enum impersonation): Delete.
	(cygheap_user::impersonation_state): Delete.
	(cygheap_user::current_token): New.
	(cygheap_user::issetuid): Modify to use current_token.
	(cygheap_user::token): Ditto.
	(cygheap_user::deimpersonate): Ditto.
	(cygheap_user::reimpersonate): Ditto.
	(cygheap_user::has_impersonation_tokens): Ditto.
	(cygheap_user::close_impersonation_tokens): Ditto.
	* security.cc (cygwin_set_impersonation_token): Always set the token.
	(verify_token): Change type of gsid to cygpsid.
	(get_file_attribute): Use the effective ids.
	* syscalls.cc (seteuid32): Modify to use cygheap_user::current_token.
	* uinfo.cc (uinfo_init) Do not set cygheap->user.impersonation_state.
2003-07-14 17:04:21 +00:00
Christopher Faylor 9e8ac0ae35 * pinfo.cc (_pinfo::commune_send): Fix bounds test so that poll of
communicating pid actually stops eventually.
2003-07-12 21:37:07 +00:00
Christopher Faylor e47d564835 * path.cc (get_device_number): Remove special com? consideration.
(special_chars): Make static.
(special_introducers): New.
(special_char): Allow specified valid_chars args.
(fnunmunge): Handle aux-like filenames correctly.
(special_name): Add con, conin$, conout$.
(mount_item::fnmunge): Use __small_sprintf return value to calculate
increments.
2003-07-11 00:54:46 +00:00
Christopher Faylor 30811232c7 * include/cygwin/version.h: Bump DLL minor number to 1. 2003-07-10 02:33:27 +00:00
Christopher Faylor 2f5cab7bb2 * fhandler_proc.cc (format_proc_stat): Use correctly sized constants for
filling in zeros on 98.
2003-07-10 02:09:24 +00:00
Christopher Faylor f1a4b6b59a * include/cygwin/version.h: Bump DLL minor number to 1. 2003-07-10 01:58:39 +00:00
Christopher Faylor cf38615c3b * fhandler_proc.cc (fhandler_proc::fill_filebuf): Allocate more space for stat
buffer.
(format_proc_stat): Reorganize to accumulate and report on all cpus.
2003-07-10 01:09:24 +00:00
Christopher Faylor ab3dc80d9e * sysconf.cc (sysconf): Return processors online rather than bitmask for
_SC_NPROCESSORS_ONLN.
2003-07-09 23:59:47 +00:00
Christopher Faylor 4d782b426a * cygheap.cc (creturn): Set appropriate errno when out of memory.
(ccalloc): Only issue system_printf when debugging.
* dtable.cc (dtable::extend): Only allocate 100 * the incremental growth size
max.  Set errno appropriately.
(dtable::build_fhandler): Check for error from set_name.
* fhandler.cc (fhandler_base::set_name): Set errno and return error on OOM.
* fhandler.h (fhandler_base::set_name): Change to bool.
* fhandler_process.cc (format_process_stat): Fix formatting.
* resource.cc (getrlimit): Return greater of OPEN_MAX or fd table size.
* sysconf.cc (sysconf): Ditto.
2003-07-09 01:33:06 +00:00
Christopher Faylor a711a5af45 * rmsym: Don't use ranlib. 2003-07-07 05:32:24 +00:00
Christopher Faylor c0a6fcd75b * newsym: Reenable removal of tmp directory. Just use ar to generate archive
index.
* Makefile.in: Don't send ranlib to newsym.
2003-07-07 05:30:33 +00:00
Christopher Faylor 0e5db0bfe8 * newsym: Create objects that are closer to those created by dlltool so as not
to confuse --export-all-symbols.
* rmsym: Be a little more accepting of object filenames now that dlltool can
create different format files.
2003-07-07 05:23:35 +00:00
Christopher Faylor c522b9078c * newsym: Oops. Revert below change. 2003-07-07 00:14:58 +00:00
Christopher Faylor 88a628163e * newsym: Use correct prefix for generating imports.
* pinfo.cc (_pinfo::commune_send): Don't wait forever for a response from
another process.
2003-07-06 23:24:13 +00:00
Christopher Faylor 0d043e9aac white space 2003-07-06 20:13:48 +00:00
Christopher Faylor b671715358 * syscalls.cc (gethostid): Set thread affinity so that results are predictable. 2003-07-06 20:08:42 +00:00
Corinna Vinschen f2d3c47b14 * mmap.cc (list::match): Add parameters to return valid address and
length back to munmap().  Evaluate intersection between given
	area and mapped area and return it, if any.
	(mmap64): On regular files, don't allow mappings beginning beyond
	EOF.  Return with errno set to ENXIO instead.
	(munmap): Rewrite SUSv3 conformant.  Check if given memory area is
	valid.  Unmap all maps inside given memory area.  Don't return error
	if no mapping has been unmapped.
2003-07-05 18:59:35 +00:00
Corinna Vinschen 4b2cbaeefd * fhandler.h (fhandler_socket::get_connect_state): New method to
return socket connection state.
	* fhandler_socket.cc (dup): Copy socket connect state to new file
	handle.
	* net.cc (cygwin_rcmd): Mark file handles of sockets returned by
	rcmd() as CONNECTED state.
	(cygwin_rexec): Similarly for rexec().
	(socketpair): Mark both ends of a new socket pair as CONNECTED.
2003-07-05 18:20:13 +00:00
Christopher Faylor 49806b9b06 fix typo 2003-07-04 17:37:59 +00:00
Corinna Vinschen 6694f3054e * mmap.cc (fhandler_disk_file::mmap): Fix address test. 2003-07-04 09:06:54 +00:00
Christopher Faylor d108f312f9 * path.cc (fillout_mntent): Change "posix" to "managed". 2003-07-04 03:08:26 +00:00
Christopher Faylor 3f21478315 * fhandler.h (FH_ENC): New enum.
(fhandler_base::get_encoded): New function.
(fhandler_base::set_encoded): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::opendir): Set encoded flag in
fhandler, as appropriate.
(fhandler_disk_file::readdir): Unmunge filename as appropriate based on new
encoding flag.
* path.cc (normalize_posix_path): Don't punt on files with colons.
(special_char): New function.
(mount_item::fnmunge): Ditto.
(fnunmunge): Ditto.
(special_name): Ditto.
(mount_item::build_win32): Avoid drive considerations when file is encoded.
(mount_info::conv_to_win32_path): Handle encoded filenames.
(mount_info::conv_to_posix_path): Ditto.
(fillout_mntent): Add posix string when directory is encoded.
* path.h (fnunmunge): Declare.
(path_conv::is_encoded): Declare.
2003-07-04 03:07:01 +00:00
Christopher Faylor 3d8a75bdbe * fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize a little more of
the cygserver stuff so that ttys actually work.
2003-07-03 21:22:17 +00:00
Corinna Vinschen 6556178009 * mmap.cc (mmap64): Allow MAP_FIXED with pagesize granularity (4K).
If a non-zero addr is given, align it to the next lower 64K boundary.
	(fhandler_disk_file::mmap): If a non-zero address is given, try
	mapping using the given address first.  If it fails and flags is not
	MAP_FIXED, try again with NULL address.
2003-07-03 20:53:26 +00:00
Christopher Faylor f3ff0ca9ed * thread.cc: Remove _MT_SAFE conditional. 2003-07-02 03:50:05 +00:00
Christopher Faylor 6a59d15696 fix typo 2003-07-02 03:32:04 +00:00
Christopher Faylor 8fb2df196d * configure.in: Fix --enable-server option. 2003-07-02 03:29:40 +00:00
Christopher Faylor 3872e9a419 * Makefile.in: Remove cygserver stuff.
* acconfig.h: Add USE_CYGSERVER define.
* config.h.in: Regenerate.
* configure.in: Add --enable-server setting.
* configure: Regenerate.
* fhandler_tty.cc (fhandler_tty_slave::open): Conditionalize compilation of
cygserver stuff.
* fork.cc (fork_child): Ditto.
* shm.cc: Ditto.
* tty.cc (tty::common_init): Ditto.
* dcrt0.cc: Use bool rather than BOOL for CYGWIN environment variable
definitions.
* environ.cc: Ditto.
* ntea.cc: Ditto.
* security.cc: Ditto.
* security.h: Ditto.
* syscalls.cc (check_posix_perm): Remove externs that were already declared in
a header.
* winsup.h: Ditto.  Declare _MT_SAFE here.  Delete it someday since cygwin
should always be _MT_SAFE.
2003-07-02 03:16:00 +00:00
Corinna Vinschen 70249d5687 * cygheap.h (enum impersonation): New enum.
(cygheap_user::token): Delete.
	(cygheap_user::impersonated): Delete.
	(cygheap_user::external_token): New member.
	(cygheap_user::internal_token): New member.
	(cygheap_user::impersonation_state): New member.
	(cygheap_user::issetuid): Modify.
	(cygheap_user::token): New method.
	(cygheap_user::deimpersonate): New method.
	(cygheap_user::reimpersonate): New method.
	(cygheap_user::has_impersonation_tokens): New method.
	(cygheap_user::close_impersonation_tokens): New method.
	* dtable.cc (dtable::vfork_child_dup): Use new cygheap_user methods.
	* fhandler_socket.cc (fhandler_socket::dup): Ditto.
	* fork.cc (fork_child): Ditto.
	(fork_parent): Ditto.
	* grp.cc (internal_getgroups): Ditto.
	* security.cc (verify_token): Ditto.
	(check_file_access): Ditto.
	(cygwin_set_impersonation_token): Detect conflicts. Set
	user.external_token.
	* spawn.cc (spawn_guts): Use new cygheap_user methods.
	* syscalls.cc (seteuid32): Rearrange to use the two tokens
	in cygheap_user.
	(setegid32): Use new cygheap_user methods.
	* uinfo.cc: (internal_getlogin): Ditto.
2003-06-30 13:07:36 +00:00
Christopher Faylor b06d4a0881 * Makefile.in: Use INSTALL_PROGRAM to install the cygwin DLL. 2003-06-25 19:12:01 +00:00
Thomas Pfaff e1e196a225 * thread.cc (MTinterface::fixup_after_fork): Fix thread list after fork.
(pthread::threads): Instantiate.
(pthread::pthread): Initialize running and suspendend.
Initialize next with NULL.
Add thread to thread list if it is not the null_pthread.
(pthread::~pthread): Remove thread from thread list if it is not the null_pthread.
(pthread::postcreate): Set running flag.
(pthread::exit): Reset running flag.
(pthread::cancel): Try to cancel thread only if still running.
(pthread::_fixup_after_fork): Implement.
(pthread::detach): Check if thread is still running before detach.
* thread.h (pthread::running): New member.
(pthread::next): Ditto.
(pthread::fixup_after_fork): New static method.
(pthread::threads): New static method.
(pthread::_fixup_after_fork): New method.
2003-06-24 20:14:01 +00:00
Christopher Faylor 6c6f70947d * pinfo.cc (_pinfo::commune_send): Don't attempt to communicate with a pure
windows process.
2003-06-21 00:08:02 +00:00
Pierre Humblet c9a5cfa0d3 2003-06-18 Pierre Humblet <pierre.humblet@ieee.org>
* autoload.cc (GetNetworkParams): Add.
        * net.cc (getdomainname): Call GetNetworkParams and read the
        DhcpDomain registry value if warranted.
2003-06-19 00:57:26 +00:00
Christopher Faylor 0d58ef9dac * path.cc (mount): Do more strict checking on posix path arguments. 2003-06-17 16:52:18 +00:00
Christopher Faylor c433f4617f Throughout, remove "include <errno.h>" from files which already include
cygerrno.h.
* include/cygwin/config.h (__DYNAMIC_REENT__): Define.
* include/cygwin/version.h: Bump API minor version.
* cygwin.din: Export __getreent
* cygerrno.h: Include errno.h.  Fix places where _impure_ptr is used directly
to store the errno value.
* debug.cc (__set_errno): Ditto.
* errno.cc: Remove _RRENT_ONLY define to get errno.cc compiled.
* signal.cc: Rename _reent_clib to _REENT throughout.
* thread.h (reent_clib): Remove prototype.
* thread.cc (reent_clib): Rename reent_clib to __getreent.  Return _impure_ptr
until MTinterface is initialized.
(reent_winsup): Fix a possible SEGV when _r == NULL.  Return NULL instead.
* MTinterface::fixup_after_fork: Switch reent back to _impure_ptr to keep
signal handling running when fork is called from a thread other than the
mainthread.
2003-06-16 03:24:13 +00:00
Thomas Pfaff 1c80421cb4 * thread.cc (pthread_attr_init): Revert change from 2003-06-11
to return 0 if attribute is already initialized back to EBUSY.
(pthread_condattr_init): Ditto.
(pthread_rwlockattr_init): Ditto.
(pthread_mutexattr_init): Ditto.
2003-06-12 18:15:34 +00:00
Corinna Vinschen 5bdb56f061 * exceptions.cc (ctrl_c_handler): Don't send a signal on
CTRL_SHUTDOWN_EVENT.  Add a comment to rationalize the patch.
2003-06-12 12:36:07 +00:00
Thomas Pfaff 00e6660b0d * thread.cc (pthread_attr_init): Return 0 if attribute is already initialized.
Fix return code if out of memory.
(pthread_condattr_init): Ditto.
(pthread_rwlockattr_init): Ditto.
(pthread_mutexattr_init): Return 0 if attribute is already initialized.
2003-06-11 19:08:42 +00:00
Corinna Vinschen 271c1935b3 * spawn.cc (spawn_guts): Call CreateProcess while impersonated,
when the real {u,g}ids and the groups are original.
	Move RevertToSelf and ImpersonateLoggedOnUser to the main line.
	* uinfo.cc (uinfo_init): Reorganize. If CreateProcess was called
	while impersonated, preserve the uids and gids and call
	ImpersonateLoggedOnUser. Preserve the uids and gids on Win9X.

	* exceptions.cc (error_start_init): Quote the pgm in the command.
2003-06-09 13:29:12 +00:00
Christopher Faylor 32173f7ec4 fix typo 2003-06-07 15:37:35 +00:00
Christopher Faylor 42a737d0a4 * poll.cc: Define FD_SETSIZE to ridiculously large number so that there will be
no artificially large limits.
2003-06-07 15:36:47 +00:00
Christopher Faylor 9501a0a1c7 * fhandler_tty.cc (fhandler_tty_slave::close): Free the console when last tty
closes.
2003-06-07 15:12:23 +00:00
Thomas Pfaff f496071c40 * fhandler_socket.cc (fhandler_socket::connect): Change error
handling for nonblocking connects to return EALREADY when
connect is called more than once for the same socket.
2003-06-07 11:05:35 +00:00
Corinna Vinschen 54152c7e7e * cygwin.din: Add vsyslog.
* fhandler.cc (fhandler_base::write): Only make file sparse if the
	seeked area is >= 128K.
	* syslog.cc (vsyslog): New function, overtaking functionality from
	syslog.
	(syslog): Just call vsyslog.
	* include/cygwin/version.h: Bump API minor.
	* include/sys/syslog.h: Add vsyslog declaration.
2003-06-06 08:11:19 +00:00
Christopher Faylor 979233a51a * cygthread.cc (cygthread::terminate_thread): Change system_printf to
debug_printf.
2003-06-05 19:18:33 +00:00
Christopher Faylor f51e42acc8 * shared.cc (shared_info::heap_chunk_size): Be really defensive about making
sure that heap_chunk is set.
2003-06-05 02:56:27 +00:00
Christopher Faylor 7b17543fb2 * path.cc (conv_path_list): Use correct value when calculating length to avoid
a potential SEGV.
2003-06-04 22:59:55 +00:00
Pierre Humblet 9f033c223c 2003-06-03 Pierre Humblet <pierre.humblet@ieee.org>
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Mark the pc
        as non-executable if the file cannot be opened for read. Retry query
        open only if errno is EACCES. Never change the mode, even if it is 000
        when query open() fails.
2003-06-04 01:57:44 +00:00
Christopher Faylor 1e61337ccf * configure.in: Allow any i?86 variant.
* configure: Regenerate.
2003-06-04 01:44:07 +00:00
Christopher Faylor 14963df6be * configure.in: Allow any i?86 variant.
* configure: Regenerate.
2003-06-03 17:32:03 +00:00