Commit Graph

80 Commits

Author SHA1 Message Date
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
christos ade6fba604 add a crcmp() function. 2003-05-16 13:55:18 +00:00
jdolecek 479a3334a4 sys_setreuid(): parenthesize the ruid check in ?: condition, so that
it would be more difficult to mistake == for = when reading it
2003-03-27 17:47:45 +00:00
dsl 9be8ac5294 Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
2003-03-19 11:36:32 +00:00
dsl a5de203f9f Add do_setresuid() and do_setresgid() and implement sys_setuid, sys_seteuid,
sys_setreuid (and gid equivs) in terms of them.
2003-03-05 18:42:19 +00:00
enami 5bb41745ed Cosmetic changes. 2003-02-28 23:24:40 +00:00
wiz 9ceb9b4b15 Add newline character to logname change warning.
Noted missing by Sean Davis on tech-kern.
2003-02-18 19:26:23 +00:00
dsl b80a5f24c5 KNF kern_prot.c 2003-02-18 08:37:41 +00:00
dsl aed442201d Fix support of 15 and 16 character lognames.
Warn if the logname is changed within a session - usually a missing setsid.
(approved by christos)
2003-02-15 18:10:15 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
thorpej e0d8d366df Merge the nathanw_sa branch. 2003-01-18 10:06:22 +00:00
thorpej 7055457a98 Fix some signed/unsigned comparison warnings from GCC 3.3. 2002-08-25 21:30:40 +00:00
christos d343ff07bf remove diagnostic test checking for cr_ref = 0. It will never be, because
free() will stick 0xdeadbeef into it.
2001-12-06 23:11:59 +00:00
christos 2a73d40eab introduce crcvt() that converts from struct uucred to struct ucred. 2001-11-29 21:21:13 +00:00
jdolecek 577b809930 crfree(): add DIAGNOSTIC sanity check of cr_ref; unfortunately, if the memory
is freed prematurely the check won't be triggered immediatelly, probably
since the memory is likely to be reused fast; but it _would_ be triggered
eventually
2001-11-27 07:30:03 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
thorpej 4cb159296b Remove an splimp() that really has no purpose in life. 2001-04-12 03:08:42 +00:00
mycroft acbeba20e1 Fix compile glitch. 2000-12-09 07:17:32 +00:00
mycroft 02d8d5f9bf Define 3 new functions:
* sys_getpid_with_ppid()
* sys_getuid_with_euid()
* sys_getgid_with_egid()
that do the retval[1] hack.  Use them when COMPAT_43 is defined.
2000-12-09 07:04:47 +00:00
jdolecek fc181f91c6 use EMUL_GETPID_PASS_PPID or EMUL_GETID_PASS_EID to find out if one should
pass parent pid for getpid() or effective id for get[ug]id(), instead
of compile-time dependency
2000-12-01 20:34:17 +00:00
christos 0628f0a87e knf [from charles] 2000-10-17 23:38:55 +00:00
christos 23c15f1578 Don't set P_SUGID if the calls to set{e,}{u,g}id(), setreuid(),
setgroups() did not result in actual changes. This has the nice
side effect that we don't needlesly allocate new credential and
resource limit data structures.

This is so that non setuid programs that call seteuid(getuid()),
don't end up setting P_SUGID, resulting in broken behavior [i.e.
non setuid ssh, doesn't read ~/.hostaliases...].

This is a good candidate for a pullup, if someone reviews it.
2000-10-17 20:53:45 +00:00
sommerfeld 40339b39f9 Reduce use of curproc in several places:
- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

 - Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

 - Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

 - ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

 - move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

 - simplify interface to ktrwrite()
2000-05-27 00:40:29 +00:00
minoura f6051edef5 Add native issetugid() call.
Implementation from compat/freebsd.
2000-04-21 16:15:39 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
bouyer 52497e180a Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
1999-09-28 14:47:00 +00:00
cgd ee94a4dacb add checks for COMPAT_OSF1 in the appropriate places 1999-04-30 05:29:20 +00:00
kleink 2304549e9f Sync __getlogin()'s namelen argument with the libc-internal declaration
(u_int vs. size_t).
1999-03-28 17:34:33 +00:00
drochner 8ece294afc COMPAT_xxx option review: add missing opt_compat_linux.h
alpha -> __alpha__
1998-12-18 14:10:06 +00:00
christos bee9dafdf5 defopt COMPAT_43 1998-12-10 15:07:01 +00:00
erh 3affe03bf4 Alpha Linux compat tweak for getpid, getuid and getgid. 1998-09-25 06:04:48 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
perry 730baa7431 fix sizeofs so they comply with the KNF style guide. yes, it is pedantic. 1998-07-31 22:50:48 +00:00
thorpej 8aee7782f5 defopt COMPAT_SUNOS 1998-06-25 23:40:33 +00:00
thorpej 311bac3348 defopt COMPAT_IBCS2 1998-06-25 23:22:37 +00:00
thorpej 1a2cb1b9d4 defopt COMPAT_FREEBSD 1998-06-25 22:49:18 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
thorpej 50c9f48319 Implement getsid(2), as defined by XPG4.2: returns the process group ID
of the session leader of the specified process's session.
1998-02-14 01:17:51 +00:00
mycroft 402ecc3fed Clean up code from last commit. 1997-11-10 08:26:09 +00:00
thorpej 97d2a58201 Fix slight argument bogosity with getgroups(), setgroups(), select(),
and swapctl().  For the former three, they use an 'int' in their user-land
prototype which was a 'u_int' in the kernel, which screwed up automatic
generation/checking of lint syscall stubs.  For the latter, the user-land
prototype uses a "const char *", but the syscall just used "char *".

From Chris Demetriou <cgd@pa.dec.com>.
1997-11-04 21:24:14 +00:00
mycroft 1cf91041df Nuke the old COMPAT_09 truncation of UIDs, GIDs, process and process group IDs. 1997-04-23 18:59:53 +00:00
mikel 19fd4b60de make setpgid(pid, pgrp) return EINVAL if pgrp < 0 as required by POSIX.1;
from Klaus Klein in PR standards/3395.
1997-03-27 06:14:03 +00:00
cgd e7af2a8237 * catch up with system call argument type fixups/const poisoning.
* Fix arguments to various copyin()/copyout() invocations, to avoid
  gratuitous casts.
* Some KNF formatting fixes
1996-12-22 10:21:06 +00:00
jtc 16fe807b60 renamed sys_getlogin to sys___getlogin. required by libc namespace conventions 1996-09-19 04:52:12 +00:00
mrg 5abbf990f3 Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models.  It is currently silently ignored on all other
hardware now, however.  The MD function "boot()" has been changed to
also take a char *.
1996-08-09 10:30:23 +00:00
mycroft 351bdbd445 Implement setre[ug]id() compatibly with 4.3BSD, SunOS, and Linux. 1996-06-23 11:04:11 +00:00
mycroft 627bb9bd50 Remove bogus comment in setgid(). 1996-05-22 02:22:47 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
christos 8a5b1b92e2 First pass at prototyping 1996-02-04 02:15:01 +00:00
mycroft 2dd293d3c3 Add hooks for COMPAT_FREEBSD, from Noriyuki Soda. 1995-10-10 01:26:36 +00:00