Jeff Johnston [Sat, 8 Feb 2003 04:30:58 +0000 (04:30 +0000)]
2003-02-07 Jeff Johnston <jjohnstn@redhat.com>
* acinclude.m4 (--disable-newlib-supplied-syscalls): New configuration
option to allow disabling of syscalls being supplied in newlib.
* aclocal.m4: Regenerated.
* configure: Ditto.
* configure.host: Add support of new configuration option and add
-D__NO_SYSCALLS__ if newlib supplied syscalls are disabled.
* doc/aclocal.m4: Regenerated.
* doc/configure: Ditto.
* libc/*aclocal.m4: Ditto.
* libc/*configure: Ditto.
* libm/*aclocal.m4: Ditto.
* libm/*configure: Ditto.
* libc/sys/arm/Makefile.am: Don't build syscalls.o if new option
is disabled.
* libc/sys/arm/Makefile.in: Regenerated.
* dump_setup.cc (compar): Use case insensitive comparisons.
(dump_setup): Calculate package_len based on already used "len". Don't bother
with version_len.
* 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'.
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.
* 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.
Jeff Johnston [Wed, 5 Feb 2003 17:10:43 +0000 (17:10 +0000)]
2003-02-05 Chris Demetriou <cgd@broadcom.com>
* mips/configure.in (mipsisa32el-*-*): Handle in the same way
as mipsisa32-*-*.
(mipsisa32r2-*-*, mipsisa32r2el-*-*): New, handled in the same
way as mipsisa32-*-*.
* mips/configure: Regenerate.
Jeff Johnston [Wed, 5 Feb 2003 16:52:34 +0000 (16:52 +0000)]
2003-02-05 Jonathan Larmour <jifl@eCosCentric.com>
* libc/stdio/vsprintf.c (vsprintf, _vsprintf_r): Set _file fd to
-1 to be sure it cannot later match a valid file fd causing
isatty() to return 1.
* libc/stdio/asprintf.c (asprintf, _asprintf_r): Ditto.
* libc/stdio/sprintf.c (sprintf, _sprintf_r): Ditto.
* libc/stdio/vasprintf.c (vasprintf, _vasprintf_r): Ditto.
* 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.
* 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.
Thomas Pfaff [Tue, 4 Feb 2003 19:49:39 +0000 (19:49 +0000)]
* 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.
* path.cc (symlink): Create security attributes so that only the
user can modify the symlink.
* security.cc (set_security_attribute): Remove symlink special
handling.
* 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.
Jeff Johnston [Mon, 3 Feb 2003 21:29:45 +0000 (21:29 +0000)]
2003-02-03 Jeff Johnston <jjohnstn@redhat.com>
* libc/stdlib/ldtoa.c (_ldtoa_r): Fix code to allocate the format
buffer based on the precision, after we have processed the input value
in a local buffer and know its relative magnitude.
* 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.
* fhandler_socket.cc (fhandler_socket::recvfrom): Return buffer
length and don't set errno in case of WSAEMSGSIZE error.
(fhandler_socket::recvmsg): Ditto.
* 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.
* 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.
Jeff Johnston [Fri, 31 Jan 2003 20:44:26 +0000 (20:44 +0000)]
2003-01-31 Michael Snyder <msnyder@redhat.com>
* libc/sys/h8300hms/_exit.c (_exit, __exit): Slip a magic cookie
into registers r1 and r2, so that the simulator can distinguish
this trap from a breakpoint trap. Copied from libgloss.
* 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.
* uinfo.cc (pwdgrp::next_num): Remove check for NULL since it is no longer a
valid return from next_str.
(pwdgrp::add_line): Duh. Revert to use strchr.
* strings.h (strechr): New function.
* uinfo.cc (pwdgrp::next_str): Search only for input char in string. Return
EOS on failure. Don't check for NULL since it shouldn't be possible.
(pwdgrp::add_line): Revert to replacing '\n' in input line with '\0'.
(pwdgrp::next_num): Pass explicit separator character to next_str.
* grp.cc (pwdgrp::parse_group): Ditto.
* passwd.cc (pwdgrp::parse_passwd): Ditto. Revamp test for garbage input.
* pwdgrp.h (pwdgrp::next_str): Don't use default parameter.
* passwd.cc (pwdgrp::parse_passwd): Eliminate use of memset. The structure
should always be completely filled out.
* grp.cc (pwdgrp::parse_group): Ditto.
* grp.cc (pwdgrp::parse_group): Fix off-by-one problem in allocating
* include/sys/strace.h (paranoid_printf): Define as not being part of "all"
output.
* pwdgrp.h (pwdgrp::next_num): Rename from next_int. Returns true/false if
parse operation succeeded.
(pwdgrp::reparse): Remove.
(pwdgrp::raw_ptr): New function. Returns pointer in line.
(pwdgrp::next_num): New functions for parsing other than unsigned long.
* grp.cc (pwdgrp::parse_group): Reinstate previous parsing behavior. Don't
fill in fields with NULL and assign empty gr_mem to known pointer rather than
doing a pointless calloc. Streamline gr_mem parsing. Don't increment
curr_lines here.
* passwd.cc (pwdgrp::parse_passwd): Use new behavior of next_num. Don't
increment curr_lines here.
* uinfo.cc (pwdgrp::next_str): Keep returning EOL if out of data.
(pwdgrp::reparse): Remove.
(pwdgrp::next_num): Rename from next_int. Return bool indicating success of
parse, argument returns value parsed.
(pwdgrp::add_line): Increment curr_lines here on successful parse.
(pwdgrp::load): (from Pierre Humblet) Don't return status. Just report it
here.
Corinna Vinschen [Sat, 25 Jan 2003 10:36:46 +0000 (10:36 +0000)]
* syscalls.cc (seteuid32): On Win95 get the pw entry. If it exists
update the euid and call cygheap->user.set_name. Remove special
handling of ILLEGAL_UID.
(setgid32): Add a debug_printf. On Win95, always set the egid.
Remove special handling of ILLEGAL_GID. Do not compare gid and gr_gid.
* child_info.h (class cygheap_exec_info): Remove uid.
* spawn.cc (spawn_guts): Do not set ciresrv.moreinfo->uid.
* dcrto.cc (dll_crt0_1): Always call uinfo_init.
* uinfo.cc (uinfo_init): Reorganize and close handle if needed.
(cygheap_user::ontherange): Do not call internal_getpwnam if pw is NULL.
* libltp/include/usctest.h: Add externs to some variables that need it.
* winsup.api/ltp/mmap05.c (main): Make file_content volatile to avoid
optimization glitch.