Commit Graph

1773 Commits

Author SHA1 Message Date
Pierre Humblet 1ffc44aaf7 2003-02-23 Pierre Humblet <pierre.humblet@ieee.org>
* syslog.cc (syslog): Do not unlock the file before closing it
       and remove debug_printf about stream errors.
2003-02-23 19:12:55 +00:00
Christopher Faylor a066f3645b * cygmalloc.h: Remove MORECORE_CANNOT_TRIM. It's not true. # cygwin.din:
Export mallinfo.  # malloc_wrapper.cc (mallinfo): New function.
2003-02-22 23:02:15 +00:00
Christopher Faylor 878e60c561 * syslog.cc (syslog): Do not print the Windows pid. Print the Cygwin pid as an
unsigned decimal.  On Win95 print a timestamp and attempt to lock the file up
to four times in 3 ms.
2003-02-22 19:35:03 +00:00
Corinna Vinschen b1d1e50d04 * fhandler_socket.cc (fhandler_socket::fhandler_socket): Fix compiler
warning.
	(fhandler_socket::fstat): Simplify.  Set st_uid/st_gid to effective
	uid/gid of current process in case of open sockets.
2003-02-21 14:59:35 +00:00
Corinna Vinschen cf762b08cf * dtable.cc (dtable::build_fhandler_from_name): Set some fhandler
data on sockets to evaluate AF_LOCAL sockets correctly.
	(dtable::build_fhandler): Set unit number on sockets.
	* fhandler.h (fhandler_socket): Add unit number.
	(fhandler_socket::get_unit): New method.
	* fhandler_socket.cc (fhandler_socket::fhandler_socket): Set unit
	number.
	(fhandler_socket::fstat): Reorganize to return more Linux-like
	values.
	* net.cc: include ctype.h.
	(fdsock): Set unit number when building fhandler.
	* path.cc (path_conv::check): Set device type to FH_SOCKET if file
	is a AF_UNIX socket.
	(get_devn): Evaluate unit for virtual socket devices.
	(win32_device_name): Set windows path for sockets to unix_path with
	just backslashes to keep the different names.
	* syscalls.cc (fstat64): Don't override st_ino, st_dev and st_rdev
	for sockets.
	(stat_worker): Ditto.

From Pierre Humblet:

	* autoload.cc (AccessCheck): Add.
	(DuplicateToken): Add.
	* security.h (check_file_access): Declare.
	* syscalls.cc (access): Convert path to Windows, check existence
	and readonly attribute. Call check_file_access instead of acl_access.
	* security.cc (check_file_access): Create.
	* sec_acl (acl_access): Delete.
2003-02-21 14:29:18 +00:00
Christopher Faylor 5cd8241242 * fhandler.cc (fhandler_base::open): Move some filesystem specific stuff.
(fhandler_disk_file::open): Accept some filesystem specific stuff.
* sigproc.cc (wait_for_sigthread): Become slightly more thread safe.
(sig_send): Don't assume that signal thread is ready.
2003-02-21 04:33:53 +00:00
Corinna Vinschen 892d896274 * wincap.h (wincap): Remove unnecessary definition of
supports_sparse_files.
	* wincap.cc: Ditto.
2003-02-20 15:58:55 +00:00
Corinna Vinschen 518f5d4935 * fhandler_disk_file.cc (fhandler_disk_file::opendir): Check descriptor
created by cygheap_fdnew constructor.
	* fhandler_virtual.cc (fhandler_virtual::opendir): Ditto.
	* fhandler_socket.cc (fhandler_socket::accept): Ditto and move
	creation of file descriptor behind blocking OS call.
	* net.cc (cygwin_socket): Ditto.
	(cygwin_rcmd): Ditto.
	(cygwin_rresvport): Ditto.
	(cygwin_rexec): Ditto.
	(socketpair): Ditto.
2003-02-20 14:14:37 +00:00
Corinna Vinschen 3a88cf1b10 * autoload.cc (GetCompressedFileSize): Add.
* fhandler_disk_file.cc (fhandler_disk_file::fstat_helper): Compute
	st_blocks value from GetCompressedFileSize() if available.
2003-02-20 11:12:44 +00:00
Corinna Vinschen 7920792369 w32api:
* include/winioctl.h (FSCTL_SET_SPARSE): Define.

cygwin:

        * wincap.h (wincaps::supports_sparse_files): New flag.
        (wincapc::supports_sparse_files): New method.
        * wincap.cc (wincap_unknown): Define value for the new flag.
        (wincap_95): Ditto.
        (wincap_95osr2): Ditto.
        (wincap_98): Ditto.
        (wincap_98se): Ditto.
        (wincap_me): Ditto.
        (wincap_nt3): Ditto.
        (wincap_nt4): Ditto.
        (wincap_nt4sp4): Ditto.
        (wincap_2000): Ditto.
        (wincap_xp): Ditto.
        * path.h (path_conv::fs_flags): New method.
        * fhandler_disk_file.cc: Include winioctl.h for DeviceIoControl.
        (fhandler_disk_file::open): Set newly created and truncated files as
        sparse on platforms that support it.
2003-02-20 10:14:53 +00:00
Corinna Vinschen afe13e8454 * grp.cc (internal_getgroups): Handle properly tokens with
no groups. Fix bug introduced on 2003-02-04.
2003-02-18 10:09:37 +00:00
Christopher Faylor 8fc16812e8 * cygwin.din: Export all appropriate newlibc libm functions. Sort.
* include/cygwin/version.h: Bump API minor number.
2003-02-16 19:31:07 +00:00
Christopher Faylor f655eadfb4 * cygwin.din: Export all appropriate newlib functions.
* include/cygwin/version.h: Bump API minor number.
2003-02-15 21:45:09 +00:00
Corinna Vinschen 4d9ba012a9 * mmap.cc (mprotect): Add missing break. 2003-02-14 21:15:16 +00:00
Christopher Faylor dff01e3aa8 * exceptions.cc (try_to_debug): Don't reset priority when returning from
non-waitloop call.
2003-02-14 02:52:29 +00:00
Christopher Faylor d1d1797eb7 * fhandler_console.cc (fhandler_console::write_normal): Use MessageBeep for
bell sound.
* autoload.cc (MessageBeep): Add.
2003-02-13 23:51:41 +00:00
Christopher Faylor 97c61aeba5 * include/cygwin/types.h: Use correct ifdef guard for u_ definitions. 2003-02-13 15:37:07 +00:00
Christopher Faylor a200c081f5 * environ.cc (environ_init): Use strechr. 2003-02-13 15:17:11 +00:00
Christopher Faylor 2858de3a00 * include/cygwin/in.h (sockaddr_in): Fix typo. 2003-02-13 15:15:32 +00:00
Christopher Faylor 75c8a70c95 * path.h (path_conv): Reorganize slightly. 2003-02-13 03:13:37 +00:00
Christopher Faylor 939d19b0da * fhandler_tty.cc (process_input): Add sanity check to ensure that console
typeahead is cleared on signal.
2003-02-13 02:56:36 +00:00
Christopher Faylor 7a44ba059b * spawn.cc (linebuf::~linebuf): Resurrect commented out (for debugging?) code. 2003-02-13 02:52:41 +00:00
Christopher Faylor 407b8df695 * include/cygwin/in.h (in_attr_t): Define new type.
* include/arpa/inet.h (inet_addr): Change return type to in_addr_t.
(inet_lnaof): Ditto.
(inet_netof): Ditto.
(inet_network): Ditto.
* include/cygwin/types.h: Move many *_t typedefs here.  Protect them with
ifdefs.
* fhandler_disk_file.cc (fhandler_disk_file::fstat): Change ntsec_atts to
mode_t.
* security.cc (get_attribute_from_acl): Accept mode_t attribute.
(get_nt_attribute): Ditto.
(get_file_attribute): Ditto.
(get_nt_object_attribute): Ditto.
(get_object_attribute): Ditto.
* security.h: Reflect above changes.
* syscalls.cc (chown_worker): Change attrib to mode_t.
2003-02-10 22:43:29 +00:00
Christopher Faylor 67c64e3b2e clarify 2003-02-08 17:13:46 +00:00
Christopher Faylor ad80bc4224 * include/cygwin/version.h: Bump DLL minor number.
* malloc.cc (DEFAULT_MMAP_THRESHOLD): Bump down to 16MB thanks to below
changes.
2003-02-08 17:03:34 +00:00
Corinna Vinschen 4136fdb16b * mmap.cc (mmap_record::alloc_map): De-inline. Add offset and length
parameter.  Only protect pages actually unused currently.  Do job
	of map_map() when initializing a map.
	(mmap_record::map_map): Reduce functionality for the reuse case
	of private anonymous mapping.
	(mmap_record::fixup_map): Format change.
	(list::add_record): Add offset and length parameter to call
	mmap_record::alloc_map() correctly.
	(mmap64): Rename `l' variable to `map_list'.  Accomodate above changes.
	(munmap): Rename `l' variable to `map_list'.
	(msync): Ditto.
	(fhandler_disk_file::mmap): Streamline code.
	(mprotect): Ditto.
	(fixup_mmaps_after_fork): Rename `l' variable to `map_list'.
2003-02-07 20:57:30 +00:00
Christopher Faylor 49b84ce441 Christopher Faylor <cgf@redhat.com>
* exceptions.cc (try_to_debug): Set priority of current thread rather than the
main thread.  Make busy waiting loop less busy.  Restore priority when function
returns.
2003-02-07 15:00:57 +00:00
Christopher Faylor bc5b63edab * malloc.cc (DEFAULT_MMAP_THRESHOLD): Set high to avoid mmaps.
* pipe.cc (fhandler_pipe::close): Avoid extraneous this->.
2003-02-07 06:15:10 +00:00
Christopher Faylor 1de8d16415 * heap.cc (heap_init): Remove debugging code. 2003-02-07 04:13:41 +00:00
Corinna Vinschen 565e80155b * security.h: Introduce names UNKNOWN_UID and UNKNOWN_GID and delete
declaration of is_grp_member.
	* uinfo.cc (internal_getlogin): Use UNKNOWN_GID.
	* passwd.cc (pwdgrp::read_passwd): Use UNKNOWN_UID.
	* grp.cc (pwdgrp::read_group): Change group name to provide better
	feedback.
	(getgrgid): Use gid16togid32.
	* sec_helper.cc (is_grp_member): Delete.
2003-02-06 14:01:54 +00:00
Christopher Faylor d238c1b453 * path.cc: Change 'to_posix_p' to 'to_posix' throughout.
(conv_path_list_buf_size): Accommodate relative paths.
2003-02-05 21:12:58 +00:00
Christopher Faylor b7f52fe81a * path.cc (etc::dir_changed): Fix debug printf. 2003-02-05 16:40:51 +00:00
Corinna Vinschen 62cd433e98 * sec_acl.cc (setacl): Move all permission settings to beginning of
loop.  Set default rights to same values as in alloc_sd().  Set DELETE
	for owner and default owner only if S_IWOTH is given.

	* sec_acl.cc: Change all  __aclent16_t to  __aclent32_t except in
	wrapper function definitions. Replace call to the aclXYZ functions by
	calls aclXYZ32.
	(searchace): Change type of third argument to __uid32_t and use
	ILLEGAL_UID instead of -1;
	(setacl): Remove some initializations. Only give STANDARD_RIGHTS_WRITE
	for S_IWOTH. Replace -1 by ILLEGAL_UID.
	(getacl): Change type of owner_sid, group_sid and ace_sid to cygpsid.
	In last else clause, suppress second call to ace_sid.get_id and use
	TRUE in first call. Replace EqualSid by ==.
	(acl_access): Call internal_getgroups in USER and GROUP cases.
	(acecmp: Define static.
	(acl32): Create from 16 bit type.
	(facl32): Ditto.
	(lacl32): Ditto.
	(aclcheck32): Ditto.
	(aclsort32): Ditto.
	(acltomode32): Ditto.
	(aclfrommode32): Ditto.
	(acltopbits32): Ditto.
	(aclfrompbits32): Ditto.
	(acltotext32): Ditto.
	(aclfromtext32): Ditto, and use strechr.
	(acl16to32): Create.
	(acl): Make it a wrapper function.
	(facl): Ditto.
	(lacl): Ditto.
	(aclcheck): Ditto.
	(aclsort): Ditto.
	(acltomode): Ditto.
	(aclfrommode): Ditto.
	(acltopbits): Ditto.
	(aclfrompbits): Ditto.
	(acltotext): Ditto.
	(aclfromtext): Ditto.
	* security.cc (write_sd): Call set_process_privilege and check
	ownership.
	(alloc_sd): Remove call to set_process_privilege and the owner check.
2003-02-05 16:15:22 +00:00
Christopher Faylor cadd065b63 * include/sys/cygwin.h: Use C-style comments. 2003-02-05 14:14:26 +00:00
Corinna Vinschen 0c8455c344 * sec_helper.cc (get_sids_info): New function.
* security.cc (extract_nt_dom_user): Simplify with strechr.
	(get_user_groups): Initialize glen to MAX_SID_LEN.
	(get_user_local_groups): Ditto.
	(get_attribute_from_acl): Define ace_sid as cygpsid.
	(get_nt_attribute): Define owner_sid and group_sid as cygpsid.
	Call get_sids_info instead of cygsid.get_{u,g}id and is_grp_member.
	(get_nt_object_attribute): Ditto.
	(alloc_sd): Define ace_sid as cygpsid.
2003-02-05 13:47:47 +00:00
Thomas Pfaff 5ae9331a32 * syscalls.cc (struct system_cleanup_args): New struct.
(system_cleanup): New function.
(system): Use pthread_cleanup_push and _pop to save and restore
signal handlers and sigprocmask.
2003-02-04 19:49:39 +00:00
Corinna Vinschen 3dbafd873e * path.cc (symlink): Create security attributes so that only the
user can modify the symlink.
	* security.cc (set_security_attribute): Remove symlink special
	handling.
2003-02-04 19:26:01 +00:00
Corinna Vinschen 0daf256192 * grp.cc (internal_getgroups): Do not return without closing
the process handle.
2003-02-04 17:53:08 +00:00
Corinna Vinschen 4a21c2d5c8 * security.h (class cygpsid): New class.
(class cygsid): Use cygpsid as base. Remove members psid, get_id,
	get_uid, get_gid, string, debug_printf and the == and != operators.
	(cygsidlist::clear_supp): Only do work if setgroups has been called.
	* sec_helper.cc: Define sid_auth NO_COPY.
	(cygpsid::operator==): New operator.
	(cygpsid::get_id): New function.
	(cygpsid::string): New function.
	(cygsid::string): Delete.
	(cygsid::get_id): Delete.
	* pwdgrp.h: Change arguments of internal_getpwsid,
	internal_getgrsid and internal_getgroups to cygpsid.
	* passwd.cc (internal_getpwsid): Change argument from cygsid to cygpsid.
	* grp.cc (internal_getgrsid): Ditto.
	(internal_getgroups): Ditto.
2003-02-04 14:58:04 +00:00
Christopher Faylor 335556d58b Eliminate most unneeded this-> pointers throughout. 2003-02-04 03:01:17 +00:00
Corinna Vinschen 153e83c605 * security.h: Add third argument to set_process_privilege.
* autoload.cc: Add OpenThreadToken.
	* sec_helper.cc (set_process_privilege): Add and use use_thread
	argument.
	* security.cc (alloc_sd): Modify call to set_process_privilege.
	Remember the result in each process. If failed and file owner is not
	the user, fail.
2003-02-03 15:55:20 +00:00
Corinna Vinschen f0f3ea68f3 * fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer
length and don't set errno in case of WSAEMSGSIZE error.
	(fhandler_socket::recvmsg): Ditto.
2003-02-03 15:34:52 +00:00
Christopher Faylor 6688a0618e * grp.cc (getgrent32): Only refresh group entries when at beginning.
(internal_getgrsid): Only refresh if uninitialized.
(internal_getgrent): Ditto.
* passwd.cc (getpwent): Only refresh passwd entries when at beginning.
(pwdgrp::read_passwd): linebuf *cannot* be NO_COPY.
(internal_getpwsid): Only refresh if uninitialized.
(getpass): No need to refresh passwd data here.
* pwdgrp.h (refresh): Eliminate default.
2003-02-01 18:41:29 +00:00
Christopher Faylor a5a93a62b2 * dlfcn.cc (dlerror): Only report load errors once per error. 2003-02-01 05:00:15 +00:00
Christopher Faylor b0a82a859d * fhandler_serial.cc (fhandler_serial::open): Avoid extraneous setting of res.
* termios.cc (tcsetattr): Correctly record errno after tcsetattr call.
* fhandler_serial.cc (fhandler_serial::tcsetattr): Add error-checking so that
if any Win32 SetComm*() calls fail, errno gets set to EINVAL and tcsetattr()
returns -1.  Catch invalid bitrates, mostly.  If baud rate setting is B0, just
drop DTR and leave Win32 DCB bitrate as-is since 0 is not a valid Win32
setting.
(fhandler_serial::tcgetattr): If DTR is low, populate the bitrate as B0,
otherwise get it from the DCB.
2003-02-01 04:48:03 +00:00
Christopher Faylor 949c3da11a * passwd.cc (pwdgrp::read_passwd): linebuf *must* be static (from Pierre
Humblet).
* pwdgrp.h (pwdgrp::refresh): Avoid calling read function if we already have
lock since that means we are in the process of reading the file.
2003-01-31 17:00:42 +00:00
Christopher Faylor 485d85bfa7 * shared.cc (shared_info::heap_chunk_size): Use correct variable when reading
HKLM.
2003-01-31 15:02:40 +00:00
Christopher Faylor 704ce46198 * fhandler_registry.cc (fhandler_registry::exists): Fix off-by-one error when
inspecting path.
2003-01-30 23:15:15 +00:00
Christopher Faylor ba6e108396 * lib/getopt.c: Allow environment variable control of POSIXLY_INCORRECT behavior. 2003-01-30 01:14:30 +00:00
Corinna Vinschen 01e3c89709 * fhandler_socket.cc (fhandler_socket::accept): On successful execution
set connection state of returned socket to CONNECTED.
2003-01-28 15:33:50 +00:00