2021-01-02 19:32:25 +00:00
|
|
|
/* Copyright (C) 1991-2021 Free Software Foundation, Inc.
|
1997-02-15 04:31:36 +00:00
|
|
|
This file is part of the GNU C Library.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:58:11 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1997-02-15 04:31:36 +00:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1995-02-18 01:27:10 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
Prefer https to http for gnu.org and fsf.org URLs
Also, change sources.redhat.com to sourceware.org.
This patch was automatically generated by running the following shell
script, which uses GNU sed, and which avoids modifying files imported
from upstream:
sed -ri '
s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g
s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g
' \
$(find $(git ls-files) -prune -type f \
! -name '*.po' \
! -name 'ChangeLog*' \
! -path COPYING ! -path COPYING.LIB \
! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \
! -path manual/texinfo.tex ! -path scripts/config.guess \
! -path scripts/config.sub ! -path scripts/install-sh \
! -path scripts/mkinstalldirs ! -path scripts/move-if-change \
! -path INSTALL ! -path locale/programs/charmap-kw.h \
! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \
! '(' -name configure \
-execdir test -f configure.ac -o -f configure.in ';' ')' \
! '(' -name preconfigure \
-execdir test -f preconfigure.ac ';' ')' \
-print)
and then by running 'make dist-prepare' to regenerate files built
from the altered files, and then executing the following to cleanup:
chmod a+x sysdeps/unix/sysv/linux/riscv/configure
# Omit irrelevant whitespace and comment-only changes,
# perhaps from a slightly-different Autoconf version.
git checkout -f \
sysdeps/csky/configure \
sysdeps/hppa/configure \
sysdeps/riscv/configure \
sysdeps/unix/sysv/linux/csky/configure
# Omit changes that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines
git checkout -f \
sysdeps/powerpc/powerpc64/ppc-mcount.S \
sysdeps/unix/sysv/linux/s390/s390-64/syscall.S
# Omit change that caused a pre-commit check to fail like this:
# remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline
git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 05:40:42 +00:00
|
|
|
<https://www.gnu.org/licenses/>. */
|
1995-02-18 01:27:10 +00:00
|
|
|
|
|
|
|
#include <hurd.h>
|
|
|
|
#include <hurd/msg_server.h>
|
|
|
|
#include <hurd/id.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
_hurd_refport_secure_p (mach_port_t ref)
|
|
|
|
{
|
|
|
|
if (ref == __mach_task_self ())
|
|
|
|
return 1;
|
|
|
|
if (__USEPORT (AUTH, ref == port))
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
kern_return_t
|
|
|
|
_S_msg_add_auth (mach_port_t me,
|
|
|
|
auth_t addauth)
|
|
|
|
{
|
|
|
|
error_t err;
|
|
|
|
auth_t newauth;
|
1997-05-21 01:48:59 +00:00
|
|
|
uid_t *genuids, *gengids, *auxuids, *auxgids;
|
|
|
|
mach_msg_type_number_t ngenuids, ngengids, nauxuids, nauxgids;
|
|
|
|
uid_t *newgenuids, *newgengids, *newauxuids, *newauxgids;
|
|
|
|
mach_msg_type_number_t nnewgenuids, nnewgengids, nnewauxuids, nnewauxgids;
|
1995-02-18 01:27:10 +00:00
|
|
|
|
1997-05-21 01:48:59 +00:00
|
|
|
/* Create a list of ids and store it in NEWLISTP, length NEWLISTLEN.
|
|
|
|
Keep all the ids in EXIST (len NEXIST), adding in those from NEW
|
|
|
|
(len NNEW) which are not already there. */
|
|
|
|
error_t make_list (uid_t **newlistp, mach_msg_type_number_t *newlistlen,
|
|
|
|
uid_t *exist, mach_msg_type_number_t nexist,
|
|
|
|
uid_t *new, mach_msg_type_number_t nnew)
|
|
|
|
{
|
|
|
|
error_t urp;
|
|
|
|
int i, j, k;
|
|
|
|
vm_size_t offset;
|
|
|
|
|
2018-04-02 19:07:52 +00:00
|
|
|
urp = __vm_allocate (mach_task_self (), (vm_address_t *) newlistp,
|
|
|
|
nexist + nnew * sizeof (uid_t), 1);
|
1997-05-21 01:48:59 +00:00
|
|
|
if (urp)
|
|
|
|
return urp;
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
for (i = 0; i < nexist; i++)
|
|
|
|
(*newlistp)[j++] = exist[i];
|
|
|
|
|
|
|
|
for (i = 0; i < nnew; i++)
|
|
|
|
{
|
|
|
|
for (k = 0; k < nexist; k++)
|
|
|
|
if (exist[k] == new[i])
|
|
|
|
break;
|
|
|
|
if (k < nexist)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
(*newlistp)[j++] = new[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
offset = (round_page (nexist + nnew * sizeof (uid_t))
|
|
|
|
- round_page (j * sizeof (uid_t)));
|
|
|
|
if (offset)
|
2018-04-02 19:07:52 +00:00
|
|
|
__vm_deallocate (mach_task_self (),
|
|
|
|
(vm_address_t) (*newlistp
|
|
|
|
+ (nexist + nnew * sizeof (uid_t))),
|
|
|
|
offset);
|
1997-05-21 01:48:59 +00:00
|
|
|
*newlistlen = j;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find out what ids ADDAUTH refers to */
|
|
|
|
|
|
|
|
genuids = gengids = auxuids = auxgids = 0;
|
|
|
|
ngenuids = ngengids = nauxuids = nauxgids = 0;
|
|
|
|
err = __auth_getids (addauth,
|
|
|
|
&genuids, &ngenuids,
|
|
|
|
&auxuids, &nauxuids,
|
|
|
|
&gengids, &ngengids,
|
|
|
|
&auxgids, &nauxgids);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* OR in these ids to what we already have, creating a new list. */
|
|
|
|
|
|
|
|
HURD_CRITICAL_BEGIN;
|
|
|
|
__mutex_lock (&_hurd_id.lock);
|
|
|
|
_hurd_check_ids ();
|
|
|
|
|
|
|
|
#define MAKE(genaux,uidgid) \
|
|
|
|
make_list (&new ## genaux ## uidgid ## s, \
|
|
|
|
&nnew ## genaux ## uidgid ## s, \
|
|
|
|
_hurd_id.genaux.uidgid ## s, \
|
|
|
|
_hurd_id.genaux.n ## uidgid ## s, \
|
|
|
|
genaux ## uidgid ## s, \
|
|
|
|
n ## genaux ## uidgid ## s)
|
|
|
|
|
|
|
|
err = MAKE (gen, uid);
|
|
|
|
if (!err)
|
|
|
|
MAKE (aux, uid);
|
|
|
|
if (!err)
|
|
|
|
MAKE (gen, gid);
|
|
|
|
if (!err)
|
|
|
|
MAKE (aux, gid);
|
|
|
|
#undef MAKE
|
|
|
|
|
|
|
|
__mutex_unlock (&_hurd_id.lock);
|
|
|
|
HURD_CRITICAL_END;
|
|
|
|
|
|
|
|
|
|
|
|
/* Create the new auth port */
|
|
|
|
|
|
|
|
if (!err)
|
|
|
|
err = __USEPORT (AUTH,
|
|
|
|
__auth_makeauth (port,
|
|
|
|
&addauth, MACH_MSG_TYPE_MOVE_SEND, 1,
|
|
|
|
newgenuids, nnewgenuids,
|
|
|
|
newauxuids, nnewauxuids,
|
|
|
|
newgengids, nnewgengids,
|
|
|
|
newauxgids, nnewauxgids,
|
|
|
|
&newauth));
|
|
|
|
|
|
|
|
#define freeup(array, len) \
|
|
|
|
if (array) \
|
2018-04-02 19:07:52 +00:00
|
|
|
__vm_deallocate (mach_task_self (), (vm_address_t) array, \
|
|
|
|
len * sizeof (uid_t));
|
1997-05-21 01:48:59 +00:00
|
|
|
|
|
|
|
freeup (genuids, ngenuids);
|
|
|
|
freeup (auxuids, nauxuids);
|
|
|
|
freeup (gengids, ngengids);
|
|
|
|
freeup (auxgids, nauxgids);
|
|
|
|
freeup (newgenuids, nnewgenuids);
|
|
|
|
freeup (newauxuids, nnewauxuids);
|
|
|
|
freeup (newgengids, nnewgengids);
|
|
|
|
freeup (newauxgids, nnewauxgids);
|
|
|
|
#undef freeup
|
|
|
|
|
|
|
|
if (err)
|
1995-02-18 01:27:10 +00:00
|
|
|
return err;
|
|
|
|
|
1997-05-21 01:48:59 +00:00
|
|
|
/* And install it. */
|
|
|
|
|
1995-02-18 01:27:10 +00:00
|
|
|
err = __setauth (newauth);
|
|
|
|
__mach_port_deallocate (__mach_task_self (), newauth);
|
|
|
|
if (err)
|
|
|
|
return errno;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
kern_return_t
|
|
|
|
_S_msg_del_auth (mach_port_t me,
|
|
|
|
task_t task,
|
|
|
|
intarray_t uids, mach_msg_type_number_t nuids,
|
|
|
|
intarray_t gids, mach_msg_type_number_t ngids)
|
|
|
|
{
|
|
|
|
error_t err;
|
|
|
|
auth_t newauth;
|
|
|
|
|
|
|
|
if (!_hurd_refport_secure_p (task))
|
|
|
|
return EPERM;
|
|
|
|
|
|
|
|
HURD_CRITICAL_BEGIN;
|
|
|
|
__mutex_lock (&_hurd_id.lock);
|
|
|
|
err = _hurd_check_ids ();
|
|
|
|
|
|
|
|
if (!err)
|
|
|
|
{
|
|
|
|
size_t i, j;
|
|
|
|
size_t nu = _hurd_id.gen.nuids, ng = _hurd_id.gen.ngids;
|
|
|
|
uid_t newu[nu];
|
|
|
|
gid_t newg[ng];
|
|
|
|
|
|
|
|
memcpy (newu, _hurd_id.gen.uids, nu * sizeof (uid_t));
|
|
|
|
memcpy (newg, _hurd_id.gen.gids, ng * sizeof (gid_t));
|
|
|
|
|
|
|
|
for (j = 0; j < nuids; ++j)
|
|
|
|
{
|
|
|
|
const uid_t uid = uids[j];
|
|
|
|
for (i = 0; i < nu; ++i)
|
|
|
|
if (newu[i] == uid)
|
|
|
|
/* Move the last uid into this slot, and decrease the
|
|
|
|
number of uids so the last slot is no longer used. */
|
|
|
|
newu[i] = newu[--nu];
|
|
|
|
}
|
|
|
|
__vm_deallocate (__mach_task_self (),
|
|
|
|
(vm_address_t) uids, nuids * sizeof (uid_t));
|
|
|
|
|
|
|
|
for (j = 0; j < ngids; ++j)
|
|
|
|
{
|
|
|
|
const gid_t gid = gids[j];
|
|
|
|
for (i = 0; i < nu; ++i)
|
|
|
|
if (newu[i] == gid)
|
|
|
|
/* Move the last gid into this slot, and decrease the
|
|
|
|
number of gids so the last slot is no longer used. */
|
|
|
|
newu[i] = newu[--nu];
|
|
|
|
}
|
|
|
|
__vm_deallocate (__mach_task_self (),
|
|
|
|
(vm_address_t) gids, ngids * sizeof (gid_t));
|
|
|
|
|
|
|
|
err = __USEPORT (AUTH, __auth_makeauth
|
|
|
|
(port,
|
Update.
1997-03-08 05:30 Ulrich Drepper <drepper@cygnus.com>
* argp/Makefile (routines): Add argp-eexst.
* argp/argp-ba.c (argp_program_bug_address): Make `const'.
* argp/argp-eexst.c: New file. Define exit status variable.
* argp/argp-help.c (__argp_state_help): Use argp_err_exit_status
variable instead of always exiting with value 1.
* argp/argp-pv.c (argp_program_version): Make `const'.
* argp/argp.h: Declare argp_err_exit_status.
Patches by Miles Bader <miles@gnu.ai.mit.edu>.
* locale/programs/localedef.c: Use argp_err_exit_status to
terminate with correct value.
* inet/rcmd.c (iruserok): Use euidaccess instead of half-hearted
switching of UID before opening .rhosts.
* libio/vsnprintf.c: Change implementation to follow ISO C 9X
proposal. The return value now is always the number of characters
which would be written if enough space is available.
* manual/stdio.texi: Update description for new behaviour.
* locale/locale.h (__locale_t): Don't use __locale_t for struct
name and pointer to struct since old gccs cannot keep the namespaces
apart. Rename struct to __locale_struct.
* locale/duplocale.h: Likewise.
* locale/newlocale.h: Likewise.
* math/Makefile (headers): Add complex.h and cmathcalls.h.
(routines): Remove w_cabs. Add conj, cimag, creal, and cabs.
* math/math.h: Undefine __MATHDECL_1, __MATHDECL, and __MATHCALL
after use.
(signgam): Move declaration to here from mathcalls.h.
* math/mathcalls.h (cabs, __cabs_complex, signgam): Remove definition.
Correct comment for fmin and fmax.
Start implementing complex math function from ISO C 9X.
* math/complex.h: New file.
* math/cmathcalls.h: New file.
* math/cabs.c: New file.
* math/cabsf.c: New file.
* math/cabsl.c: New file.
* math/cimag.c: New file.
* math/cimagf.c: New file.
* math/cimagl.c: New file.
* math/conj.c: New file.
* math/conjf.c: New file.
* math/conjl.c: New file.
* math/creal.c: New file.
* math/crealf.c: New file.
* math/creall.c: New file.
* sysdeps/libm-ieee754/w_cabs.c: Removed.
* sysdeps/libm-ieee754/w_cabsf.c: Removed.
* sysdeps/libm-ieee754/w_cabsl.c: Removed.
* posix/regex.c: Merge with regex sources from Arnold Robbins'
version in GNU awk.
* posix/regex.h: Likewise.
Add regex test suite by Tom Lord.
* posix/Makefile (distribute): Add TESTS, TESTS2C.sed, and testcases.h.
(tests): Add runtests.
(before-compile): Add testcases.h.
(testcases.h): New rule to generate header with tests.
* posix/TESTS: New file.
* posix/TESTS2C.sed.: New file.
* posix/runtests.c: New file.
* posix/testcases.h: New file.
* sysdeps/unix/sysv/linux/poll.c: Test whether poll syscall is
available and use fall-back implementation if not.
* sysdeps/unix/sysv/linux/syscalls.list: Sort entries.
* time/ialloc.c: Update from tzcode1997c.
* time/private.h: Likewise.
* time/scheck.c: Likewise.
* time/tzselect.ksh: Likewise.
* time/zdump.c: Likewise.
* time/zic.c: Likewise.
* time/tzfile.c: Pretty print.
1997-03-06 07:37 Geoff Keating <geoffk@ozemail.com.au>
Port to powerpc-*-linux-gnu. Slightly tested, under MkLinux,
on a 601.
* sysdeps/powerpc/Implies: Added.
* sysdeps/powerpc/__longjmp.S: Added.
* sysdeps/powerpc/__math.h: Added.
* sysdeps/powerpc/bsd-_setjmp.S: Added.
* sysdeps/powerpc/bsd-setjmp.S: Added.
* sysdeps/powerpc/dl-machine.h: Added.
* sysdeps/powerpc/ffs.c: Added.
* sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added.
* sysdeps/powerpc/setjmp.S: Added.
* sysdeps/powerpc/strlen.s: Added.
* sysdeps/powerpc/elf/start.c: Added.
* sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added.
* sysdeps/unix/sysv/linux/powerpc/Dist: Added.
* sysdeps/unix/sysv/linux/powerpc/_exit.S: Added.
* sysdeps/unix/sysv/linux/powerpc/brk.c: Added.
* sysdeps/unix/sysv/linux/powerpc/clone.S: Added.
* sysdeps/unix/sysv/linux/powerpc/init-first.h: Added.
* sysdeps/unix/sysv/linux/powerpc/ioctl-types.h: Added.
* sysdeps/unix/sysv/linux/powerpc/profil.c: Added.
* sysdeps/unix/sysv/linux/powerpc/sigreturn.S: Added.
* sysdeps/unix/sysv/linux/powerpc/socket.S: Added.
* sysdeps/unix/sysv/linux/powerpc/syscall.S: Added.
* sysdeps/unix/sysv/linux/powerpc/syscalls.list: Added.
* sysdeps/unix/sysv/linux/powerpc/sysdep.c: Added.
* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Added.
* sysdeps/unix/sysv/linux/powerpc/termbits.h: Added.
* sysdeps/unix/sysv/linux/powerpc/sys/syscall.h: Added.
1997-03-05 05:24 Geoff Keating <geoffk@ozemail.com.au>
* elf/dl-runtime.c (fixup): Add ELF_FIXUP_RETURNS_ADDRESS switch,
because knowing the first instruction of a PowerPC PLT trampoline
is not very helpful.
1997-03-04 08:04 Geoff Keating <geoffk@ozemail.com.au>
* elf/dl-load.c (ELF_PREFERRED_ADDRESS, ELF_PREFERRED_ADDRESS_DATA,
ELF_FIXED_ADDRESS): Added. These are for dl-machine.h to indicate
a preference as to where executables should be loaded.
1997-02-28 08:50 Geoff Keating <geoffk@ozemail.com.au>
* elf/elf.h: Add in all those PowerPC reloc types.
1997-02-24 07:12 Geoff Keating <geoffk@ozemail.com.au>
* stdio-common/vfscanf.c: Use __va_copy if available.
1997-03-06 13:50 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* malloc/malloc.c (mprotect) [_LIBC]: Define as __mprotect to
clean up namespace.
1997-03-07 14:27 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/s_fpclassify.c (__fpclassify): Don't use
non-existing GET_WORDS macro, use EXTRACT_WORDS.
Reported by Andres Schwab <schwab@issan.informatik.uni-dortmund.de>.
1997-03-07 05:27 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/sigaction.c: The user- and
kernel-level sigaction structure is different. handle this
correctly.
Bug report by Andres Jaeger <jaeger@informatik.uni-kl.de>.
1997-03-06 05:55 David Engel <david@sw.ods.com>
* sysdeps/generic/dl-cache.c (_dl_load_cache_lookup): Also
recognize cache entries with flag == 3.
1997-03-06 01:05 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/generic/netinet/in.h (INADDR_NONE): Cast to unsigned int.
(INADDR_LOOPBACK): Likewise.
* sysdeps/unix/sysv/linux/netinet/in.h: Likewise.
* manual/socket.texi: Correct types of INADDR_* constants from
unsigned long to unsigned.
1997-03-05 23:14 Ulrich Drepper <drepper@cygnus.com>
* time/antarctica: Update from tzdata1997c.
* time/asia: Likewise.
* time/zone.tab: Likewise.
1997-03-05 00:43 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* configure.in (libc_cv_asm_symver_directive,
libc_cv_ld_version_script_option): Remove unknown instruction from
assembler test file.
1997-03-04 19:14 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/__math.h: Update feature tests to use
__USE_ISOC9X.
[__USE_ISOC9X]: Define __log2 and __exp2 inlines.
(fabs): Remove defininition, it is a gcc builtin.
(sqrt, __sqrt): Remove definition, they have wrappers in libm.
1997-03-04 10:11 H.J. Lu <hjl@lucon.org>
* sunrpc/Makefile ($(objpfx)rpc-proto.c): Create subdir before
generating file.
1997-03-05 03:59 Ulrich Drepper <drepper@cygnus.com>
* inet/rcmd.c (__ivaliduser): Don't use getline, but __getline
instead to avoid namespace problems.
Reported by David Mosberger-Tang <davidm@AZStarNet.COM>.
1997-03-03 19:01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* login/utmp_file.c: Fix previous change. Make portable by
checking the _HAVE_UT_* feature macros.
* libio/fileops.c (_IO_file_finish): Likewise.
1997-03-08 05:28:20 +00:00
|
|
|
NULL, MACH_MSG_TYPE_COPY_SEND, 0,
|
1995-02-18 01:27:10 +00:00
|
|
|
newu, nu,
|
|
|
|
_hurd_id.aux.uids, _hurd_id.aux.nuids,
|
|
|
|
newg, ng,
|
|
|
|
_hurd_id.aux.uids, _hurd_id.aux.ngids,
|
|
|
|
&newauth));
|
|
|
|
}
|
|
|
|
__mutex_unlock (&_hurd_id.lock);
|
|
|
|
HURD_CRITICAL_END;
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
err = __setauth (newauth);
|
|
|
|
__mach_port_deallocate (__mach_task_self (), newauth);
|
|
|
|
if (err)
|
|
|
|
return errno;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|