Commit Graph

1391 Commits

Author SHA1 Message Date
Corinna Vinschen 6bfca3cca5 * fhandler_dsp.cc (fhandler_dev_dsp::open): Set errno to EACCES if
requested mode isn't supported.
2002-06-04 11:18:46 +00:00
Christopher Faylor e02f1e9c81 * fhandler.cc (fhandler_base::open): Don't set binmode if already set. Don't
check for file.  Files should already be set.  Report on binary mode for
debugging.
(fhandler_base::fhandler_base): Don't set default binmode here.  That's for
later.
* fhandler_console.cc (fhandler_console::output_tcsetattr): Don't set binmode,
ever, for console.
* fhandler_disk_file.cc (fhandler_disk_file::open): Always set the binary mode
to the value derived from mount table.
* path.cc (mount_info::conv_to_win32_path): Default to binmode if path does not
translate into anything in the mount table.
2002-06-04 01:40:53 +00:00
Corinna Vinschen 31b98a623c * external.cc (cygwin_internal): Add CW_EXTRACT_DOMAIN_AND_USER
handling to call extract_nt_dom_user() from applications.
	* include/sys/cygwin.h (cygwin_getinfo_types): Add
	CW_EXTRACT_DOMAIN_AND_USER.
2002-06-03 17:56:10 +00:00
Corinna Vinschen b3c2973142 * syscalls.cc (stat64_to_stat32): Transform st_dev correctly.
(fstat64): Add evaluating st_ino and st_dev.
	(stat_worker): Evaluate st_dev as 32 bit value.
	* include/cygwin/stat.h: Use new dev_t definition throughout.
	* include/cygwin/types.h: Define __dev16_t and __dev32_t.  Define
	dev_t according to __CYGWIN_USE_BIG_TYPES__ setting.
	* include/sys/sysmacros.h: Define major, minor and makedev
	according to __CYGWIN_USE_BIG_TYPES__ setting.
2002-06-03 17:44:09 +00:00
Corinna Vinschen 656c31920b * syscalls.cc (setegid32): Verify the correctness of the gid
of the group returned by getgrgid32.
2002-06-03 17:11:14 +00:00
Corinna Vinschen 1eb934b7c5 * security.cc (lsa2wchar): Suppressed.
(get_lsa_srv_inf): Suppressed.
	(get_logon_server_and_user_domain): Suppressed.
	(get_logon_server): Essentially new.
	(get_user_groups): Add "domain" argument. Only lookup the
	designated server and use "domain" in LookupAccountName.
	(is_group_member): Simplify the arguments.
	(get_user_local_groups): Simplify the arguments. Do only a
	local lookup. Use "BUILTIN" and local domain in LookupAccountName.
	(get_user_primary_group). Only lookup the designated server.
	(get_group_sidlist): Remove logonserver argument. Do not lookup
	any server for the SYSTEM account.
	(create_token): Delete logonserver and call to get_logon_server.
	Adjust arguments of get_group_sidlist, see above.
	* security.h: Delete declaration of get_logon_server_and_user_domain
	and add declaration of get_logon_server.
	* uinfo.cc (internal_get_login): Call get_logon_server instead of
	get_logon_server_and_user_domain.
2002-06-03 17:04:03 +00:00
Christopher Faylor 37be5a67c9 * dtable.cc (handle_to_fn): Use largest match for device. Correctly
(?) deal with remote drive weirdness.
2002-06-02 17:48:05 +00:00
Christopher Faylor 97478fe6b4 * fhandler_disk_file.cc (fhandler_disk_file::fstat_by_name): Check specifically
for non-existent file, first.
(fhandler_disk_file::fstat): Perform fd open on files with funny characters.
2002-06-02 16:53:29 +00:00
Christopher Faylor 47413f8473 * fhandler_process.cc (fhandler_process::open): Set fileid. 2002-06-02 16:42:02 +00:00
Christopher Faylor 6b7cd251c7 Remove unneeded sigproc.h includes throughout.
* fhandler.h (fhandler_proc::fill_filebuf): Take a pinfo argument.
* fhandler_proc.cc (fhandler_proc::get_proc_fhandler): Simplify search for
given pid.
(fhandler_proc::readdir): Assume that pid exists if it shows up in the winpid
list.
* fhandler_process.cc (fhandler_process::open): Simplify search for given pid.
Call fill_filebuf with pinfo argument.
(fhandler_process::fill_filebuf): Pass pinfo here and assume that it exists.
* pinfo.h (pinfo::remember): Define differently if sigproc.h is not included.
* dll_init.cc (dll_list::detach): Don't run destructor on exit.
2002-06-02 06:07:01 +00:00
Christopher Faylor e065a187ab * fhandler.cc (fhandler_base::fstat): Move dev and ino calculation into caller.
* syscalls.cc (stat_worker): Calculate dev and ino calculation here, if zero.
* fhandler_proc.cc (fhandler_proc::fhandler_proc): Minor reorg for debugging.
* fhandler_process.cc (fhandler_process::exists): Return 0 on nonexistence.
(fhandler_process::fstat): Simplify pid logic.
* fhandler_tape.cc (fhandler_dev_tape::fstat): Minor reformatting.
2002-06-02 03:13:22 +00:00
Christopher Faylor 60abf1c4b8 * path.cc (chdir): Don't allow cd'ing to a non-directory virtual path. 2002-06-01 18:20:51 +00:00
Christopher Faylor 28af03faed * fhandler_disk_file.cc (readdir): Move inode calculation into caller.
(fhandler_cygdrive::readdir): Add "." and "..".
* dir.cc (readdir): Move inode calculation here so that fhandler readdirs can
benefit.
2002-06-01 02:45:38 +00:00
Christopher Faylor 548e208b82 remove accidentally checked in test version. 2002-06-01 02:31:53 +00:00
Christopher Faylor dd892d50a2 oops 2002-05-31 23:00:18 +00:00
Christopher Faylor 30478f15d4 (add the rest of the ChangeLog)
* dtable.cc (dtable::init_std_file_from_handle): Default to using binmode
derived from path_conv, when required.
* fhandler.h (fhandler_base::get_w_binary): Default to binmode if nothing else
is specified.
* fhandler.h (fhandler_base::get_r_binary): Ditto.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_by_handle): Work around g++
warning.
* path.cc (path_conv::check): Remove a debugging statement.
2002-05-31 22:59:57 +00:00
Christopher Faylor 8e74c3207f * fhandler_console.cc (fhandler_console::open): Reinstate setting of flags. 2002-05-31 22:53:25 +00:00
Christopher Faylor de86e35bc4 * fhandler_console.cc (fhandler_console::open): Always default to binmode.
(fhandler_console::write_normal): Don't honor binmode setting.  There is
already a termios setting for this.
(fhandler_console::init): Correct argument order in init call.
2002-05-31 22:35:57 +00:00
Christopher Faylor 8461f41ec0 * fhandler.cc (fhandler_base::open): Make default open mode == binmode.
(fhandler_base::init): Set open flags based on derived binmode argument.
2002-05-31 20:48:14 +00:00
Christopher Faylor bcd0ed9f6a * dll_init.cc (dll_list::init): Eliminate unneeded debugging statement. 2002-05-31 20:34:40 +00:00
Christopher Faylor 18c04cc4b2 * fhandler_proc.cc (fhandler_proc::readdir): Set errno when no more files.
* fhandler_process.cc (fhandler_process::readdir): Ditto.
* fhandler_registry.cc (fhandler_registry::readdir): Ditto.
2002-05-31 20:30:36 +00:00
Christopher Faylor 69be001cea * path.cc (path_conv::check): Set fileattr to INVALID_FILE_ATTRIBUTES for
nonexistent virtual device path.
(chdir): Set correct errno when attempt is made to cd to nonexistent virtual
device path.
2002-05-31 03:11:21 +00:00
Christopher Faylor 5d8c7a56c2 * fhandler_disk_file.cc (fhandler_disk_file::fstat): Always call fstat_by_name
if fd is not opened to allow fstat_by_name to properly set errno.
* fhandler.cc (binmode): Default to binmode when mode is not known.
2002-05-31 00:15:22 +00:00
Corinna Vinschen d74eced5d5 * autoload.cc: Replace autoload statments for ZwXXX by NtXXX.
Drop ZwQuerySystemInformation since NtQuerySystemInformation was
	already available.
	* fhandler_proc.cc (format_proc_uptime): Replace call to
	ZwQuerySystemInformation by call to NtQuerySystemInformation.
	(format_proc_stat): Ditto.
	* fhandler_process.cc (format_process_stat): Replace call to
	ZwQueryInformationProcess by call to NtQueryInformationProcess.
	(get_process_state): Ditto.
	(get_mem_values): Ditto.  Replace call to ZwQueryVirtualMemory by
	call to NtQueryVirtualMemory.
	* ntdll.h: Cleanup.  Drop ZwQuerySystemInformation since
	NtQuerySystemInformation was already available.  Replace declarations
	of ZwXXX functions by declarations of NtXXX.
	* pinfo.cc (winpids::enumNT): Replace call to ZwQuerySystemInformation
	by call to NtQuerySystemInformation.
2002-05-30 07:45:30 +00:00
Christopher Faylor d4000bc4c6 speling fxi 2002-05-30 03:14:04 +00:00
Christopher Faylor 186637a508 * include/sys/cygwin.h (EXTERNAL_PINFO_VERSION): Reinstate.
* external.cc (fillout_pinfo): Use it.
2002-05-29 21:00:55 +00:00
Corinna Vinschen 3a571063b3 * external.cc (fillout_pinfo): Use new version define.
* include/sys/cygwin.h (external_pinfo): Define
	EXTERNAL_PINFO_VERSION_16_BIT and EXTERNAL_PINFO_VERSION_32_BIT
	instead of just EXTERNAL_PINFO_VERSION.
2002-05-29 20:07:54 +00:00
Christopher Faylor 9fef0139c2 * external.cc (fillout_pinfo): Set new version field in external_pinfo
structure.
* include/sys/cygwin.h (external_pinfo): Replace strace_file with version
field.
2002-05-29 17:12:07 +00:00
Corinna Vinschen a8d7ae61e7 Change internal uid datatype from __uid16_t to __uid32_t
throughout.
	* cygwin.din: Export new symbols getpwuid32, getpwuid_r32, getuid32,
	geteuid32, setuid32, seteuid32.
	* passwd.cc (getpwuid32): New function.
	(getpwuid_r32): Ditto.
	* syscalls.cc (seteuid32): Ditto.
	(setuid32): Ditto.
	* uinfo.cc (getuid32): Ditto.
	(geteuid32): Ditto.
	* winsup.h (uid16touid32): New macro, correclt casting from __uid16_t
	to __uid32_t.
	(gid16togid32): Ditto fir gids.
	(getuid32): Declare.
	(geteuid32): Ditto.
	(getpwuid32): Ditto.
	* include/sys/cygwin.h (struct external_pinfo): Add members uid32 and
	gid32.
2002-05-29 15:04:29 +00:00
Corinna Vinschen 9854c44c43 * include/cygwin/socket.h: Protect some symbols against multiple
definition.
	* include/netinet/ip.h: Ditto.
	* include/netinet/tcp.h: Ditto.

	* include/netinet/ip.h: Replace by BSD derived version of the file.
	* include/netinet/tcp.h: Ditto.
	* include/netinet/udp.h: New file.
	* include/cygwin/ip.h: Remove.
2002-05-29 07:38:54 +00:00
Christopher Faylor cef6955910 * dtable.cc (dtable::init_std_file_from_handle): Attempt stronger detection of
invalid handle.
(handle_to_fn): Detect pathological condition where NT resets the buffer
pointer to NULL on an invalid handle.
2002-05-29 05:15:43 +00:00
Christopher Faylor 654783b62f clarify changelog 2002-05-29 03:42:12 +00:00
Christopher Faylor a761ad8200 * fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Properly check for
whether we should be opening the file to search for #! characters.  Set
path_conv structure execability, too, if found.
2002-05-29 03:06:37 +00:00
Corinna Vinschen 7ea70e9970 * security.cc (set_security_attribute): Call getegid32() instead of
getegid().
	* include/cygwin/grp.h: Declare getegid32().
2002-05-28 14:58:13 +00:00
Corinna Vinschen 5719640581 Change internal gid datatype from __gid16_t to __gid32_t
throughout.
	* cygwin.din: Export new symbols chown32, fchown32, getegid32,
	getgid32, getgrgid32, getgrnam32, getgroups32, initgroups32, lchown32,
	setgid32, setegid32, getgrent32.
	* grp.cc (grp32togrp16): New static function.
	(getgrgid32): New function.
	(getgrnam32): Ditto.
	(getgrent32): Ditto.
	(getgroups32): Change name of internal function from getgroups.
	(getgroups32): New function.
	(initgroups32): Ditto.
	* syscalls.cc (chown32): Ditto.
	(lchown32): Ditto.
	(fchown32): Ditto.
	(setegid32): Ditto.
	(setgid32): Ditto.
	* uinfo.cc (getgid32): Ditto.
	(getegid32): Ditto.
	* include/cygwin/grp.h: Remove declaration of getgrgid() and getgrnam().
	Declare getgrgid32() and getgrnam32() instead.  Declare getgid32().
2002-05-28 14:10:55 +00:00
Christopher Faylor 0c12979b72 * autoload.cc (noload): Properly mask low order word for determining number of
bytes to pop.
2002-05-28 02:09:15 +00:00
Christopher Faylor 57e2ae682c * fhandler_disk_file.cc (fhandler_disk_file::fstat): Minor logic cleanup. 2002-05-28 02:00:55 +00:00
Christopher Faylor 2402700d07 * autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro.
(LoadFuncEx2): Adapted from LoadFuncEx.  Provides control of return value for
nonexistent function.
(NtQueryObject): Declare.
(IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not
available.
* debug.h (being_debugged): Just rely on IsDebuggerPresent return value.
* dtable.cc (handle_to_fn): New function.
(dtable::init_std_file_from_handle): Attempt to derive std handle's name via
handle_to_fn.
(dtable::build_fhandler_from_name): Fill in what we can in path_conv structure
when given a handle and path doesn't exist.
* fhandler.cc (fhandler_base::open): Don't set the file pointer here.  Use
pc->exists () to determine if file exists rather than calling GetFileAttributes
again.
* fhandler.h (fhandler_base::exec_state_isknown): New method.
(fhandler_base::fstat_helper): Add extra arguments to declaration.
(fhandler_base::fstat_by_handle): Declare new method.
(fhandler_base::fstat_by_name): Declare new method.
* fhandler_disk_file (num_entries): Make __stdcall.
(fhandler_base::fstat_by_handle): Define new method.
(fhandler_base::fstat_by_name): Define new method.
(fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate.
(fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat
structure.  Move handle or name specific stuff to new methods above.
(fhandler_disk_file::open): Use real_path->exists rather than calling
GetFileAttributes again.
* ntdll.h (FILE_NAME_INFORMATION): Define new structure.
(OBJECT_INFORMATION_CLASS): Partially define new enum.
(OBJECT_NAME_INFORMATION): Define new structure.
(NtQueryInformationFile): New declaration.
(NtQueryObject): New declaration.
* path.cc (path_conv::fillin): Define new method.
* path.h (path_conv::fillin): Declare new method.
(path_conv::drive_thpe): Rename from 'get_drive_type'.
(path_conv::volser): Declare new method.
(path_conv::volname): Declare new method.
(path_conv::root_dir): Declare new method.
* syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 01:55:40 +00:00
Corinna Vinschen 74b2f73ea4 * security.cc (lsa2str): New function.
(get_priv_list): Call lsa2str instead of sys_wcstombs.
2002-05-27 11:58:49 +00:00
Corinna Vinschen 75bf293153 * syscalls.cc (seteuid): Do not take allow_ntsec into account.
Attempt to use an existing or new token even when the uid
	matches orig_uid, but the gid is not in the process token.
	Major reorganization after several incremental changes.
	(setegid): Do not take allow_ntsec into account. Minor
	reorganization after several incremental changes.
2002-05-27 11:48:15 +00:00
Christopher Faylor 918a268c80 * debug.h (being_debugged): New macro.
* dtable.cc (dtable::extend): Use new macro.
* exceptions.cc (try_to_debug): Ditto.
* strace.cc (strace::hello): Only output debugging info when we think we're
being debugged.
2002-05-27 02:25:28 +00:00
Christopher Faylor 0cfbfc249f * winsup.h: Remove duplicate declarations of malloc_lock and malloc_unlock. 2002-05-27 02:09:19 +00:00
Christopher Faylor 149965f73c update comment 2002-05-27 02:06:16 +00:00
Christopher Faylor d7b4a30001 Remove unneeded sync.h, where appropriate, throughout. Remove unneeded heap.h,
where appropriate, throughout.  Remove unneeded exceptions.h, where
appropriate, throughout.  Remove unneeded perprocess.h, where appropriate,
throughout.
2002-05-25 02:22:50 +00:00
Corinna Vinschen 908f9b653b * security.cc (create_token): Call __sec_user() instead of
sec_user() to remove dependence on allow_ntsec. Verify that
	the returned sd is non-null.
2002-05-24 14:44:05 +00:00
Robert Collins a6247be998 2002-05-25 Robert Collins <rbtcollins@hotmail.com>
* gmon.c (fake_sbrk): Correctly return -1 on failed malloc's.
2002-05-24 14:24:33 +00:00
Christopher Faylor ff93854697 * dtable.cc (dtable::build_fhandler_from_name): Just pass posix path along to
set_name via return_and_clear_normalized_path.
(dtable::build_fhandler): New method with const char * argument.
(dtable::reset_unix_path_name): Eliminate.
(dtable::dup_worker): Use correct build_fhandler method.
* mmap.cc (mmap_record::alloc_fh): Ditto.
* dtable.h (dtable::build_fhandler): New method.
(dtable::reset_unix_path_name): Eliminate.
* fhandler.cc (fhandler_base::set_name): Assume that unix_name has already been
cmalloced.
(fhandler_base::reset_unix_path_name): Eliminate.
(fhandler_base::~fhandler_base): Coercion for cfree.
* fhandler.h (fhandler_base::unix_path_name): Make const char *.
(fhandler_base::win32_path_name): Ditto.
(fhandler_base::reset_unix_path_name): Eliminate.
* fhandler_disk_file.cc (fhandler_cygdrive::set_drives): Accommodate const char
*ness of win32_path_name.
* fhandler_socket.cc (fhandler_socket::fstat): Accommodate new set_name
requirements.
* path.cc (path_conv::return_and_clear_normalized_path): New method.
(path_conv::clear_normalized_path): Eliminate.
(path_conv::~path_conv): Ditto.
(path_conv::check): Accommodate new build_fhandler method.
* path.h (path_conv::~path_conv): Eliminate.
(path_conv::clear_normalized_path): Ditto.
(path_conv::return_and_clear_normalized_path): Declare new method.
2002-05-24 05:44:10 +00:00
Christopher Faylor b4bb31ad55 * path.cc (path_conv::check): Make sure any trailing path component is part of
potential normalized posix path.
2002-05-23 20:01:46 +00:00
Christopher Faylor b2f338e9a9 * smallprint.c (__small_vsprintf): Implement '%o' after all these years. 2002-05-23 06:00:49 +00:00
Christopher Faylor fc240f584b * fhandler.h (fhandler_virtual::exists): Eliminate path argument.
(fhandler_proc::exists): Ditto.
(fhandler_registry::exists): Ditto.
(fhandler_process::exists): Ditto.
* fhandler_proc.cc (fhandler_proc::exists): Ditto.  Use built-in name.
* fhandler_process.cc (fhandler_process::exists): Ditto.
(fstat): Ditto.
* fhandler_registry.cc (fhandler_registry::exists): Ditto.
(fhandler_registry::fstat): Ditto.
* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
* path.cc (path_conv::check): Ditto.  Add debugging.
* syscalls.cc (dup): Always call dup2 for error handling.
2002-05-22 22:09:58 +00:00