Commit Graph

65 Commits

Author SHA1 Message Date
ed
b8b9c31dd0 Correct the change made in r227166.
This function is only compiled in when building WITH_AUDIT.
2011-11-06 09:09:45 +00:00
ed
4261175970 Add missing static keywords to id(1) 2011-11-06 08:15:30 +00:00
trasz
62f6a13e39 Add two new system calls, setloginclass(2) and getloginclass(2). This makes
it possible for the kernel to track login class the process is assigned to,
which is required for RCTL.  This change also make setusercontext(3) call
setloginclass(2) and makes it possible to retrieve current login class using
id(1).

Reviewed by:	kib (as part of a larger patch)
2011-03-05 12:40:35 +00:00
joel
29af67e52c Remove the advertising clause from UCB copyrighted files in usr.bin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change

Also add $FreeBSD$ to a few files to keep svn happy.

Discussed with:	imp, rwatson
2010-12-11 08:32:16 +00:00
ed
9b380e30d4 Build usr.bin/ with WARNS=6 by default.
Also add some missing $FreeBSD$ to keep svn happy.
2010-01-02 10:27:05 +00:00
brooks
da4e70cf9a In preparation for raising NGROUPS and NGROUPS_MAX, change base
system callers of getgroups(), getgrouplist(), and setgroups() to
allocate buffers dynamically.  Specifically, allocate a buffer of size
sysconf(_SC_NGROUPS_MAX)+1 (+2 in a few cases to allow for overflow).

This (or similar gymnastics) is required for the code to actually follow
the POSIX.1-2008 specification where {NGROUPS_MAX} may differ at runtime
and where getgroups may return {NGROUPS_MAX}+1 results on systems like
FreeBSD which include the primary group.

In id(1), don't pointlessly add the primary group to the list of all
groups, it is always the first result from getgroups().  In principle
the old code was more portable, but this was only done in one of the two
places where getgroups() was called to the overall effect was pointless.

Document the actual POSIX requirements in the getgroups(2) and
setgroups(2) manpages.  We do not yet support a dynamic NGROUPS, but we
may in the future.

MFC after:	2 weeks
2009-06-19 15:58:24 +00:00
csjp
3a572f38ad Fix id -A when the subject has an extended subject token associated with
them (for example when they have logged in from an ip6 source).

- Stick with the initial call to getaudit(2), if it returns E2BIG, use
  getaudit_addr(2) instead and set the "extended" flag to indicate that
  we the calling credential has an extended subject state.
- Additionally, add the printing of the machine/at_addr (the ip/ip6
  addresses)

MFC after:	1 week
Obtained from:	TrustedBSD Project
2007-10-14 00:52:30 +00:00
stefanf
c383932a73 Fix SUSv3 compliance: Use a single comma instead of comma and space to separate
additional group entries.

PR:		107298
Submitted by:	Joost Bekkers
2006-12-29 12:28:34 +00:00
ru
05d1f24e02 Improve markup. 2006-12-23 17:14:01 +00:00
mpp
f458d34cdf Do not exit without printing the id information if the uid of the
user executing the command cannot be looked up in the password file.
2006-12-09 12:58:14 +00:00
ceri
f4747864d3 Add a -a option as a no-op for Solaris compatibility, as briefly
discussed on src-committers.  This is intentionally not included in the
usage() function as it would confuse the output too much.

Approved by:	jhb
MFC after:	1 week
2006-09-26 22:28:12 +00:00
ru
2b7fa83213 Fix both arguments to err(). 2006-09-26 05:46:55 +00:00
rwatson
2f0a02201d Rename "-a" flag to "-A" in order to avoid conflicting with the "-a" flag
as found on Solaris.

Requested by:	ceri
MFC after:	3 days
2006-09-23 15:43:29 +00:00
rwatson
fae2ccfa41 Add a -a argument to id(1), which causes id(1) to print out process
audit properties, including the audit user id.  This can be quite
helpful in debugging audit problems.

Obtained from:	TrustedBSD Project
MFC after:	3 days
2006-09-23 12:30:31 +00:00
stefanf
1996e53039 Print the euid after the gid as demanded by POSIX.
Submitted by:	Martin Nagy <nagy.martin@gmail.com>
PR:		96239
MFC after:	2 weeks
2006-05-28 12:32:30 +00:00
robert
a07b9094ad Add flag to choose whether to use getgrouplist(3) or getgroups(2)
to the id_print() function.

Use getgrouplist(3) for the case when an user was specified,
and getgroups(2) when no user was given.
That reverts to the expected behaviour and makes it easy to
implement an option later to force using getgrouplist(3).
2005-04-29 10:11:18 +00:00
robert
1695f34782 Fix spelling error. 2005-04-29 08:37:52 +00:00
robert
38dd7daaf5 We need to pass NGROUPS + 1 to getgrouplist(3) to display
NGROUPS groups.  getgrouplist(3) may put a duplicate group
id into the passed array (it sets [0] and [1] to the value
of the gid argument), but id_print() sorts them out.
2005-04-28 16:11:37 +00:00
robert
56db316aaa - Merge two functions for printing `id' output.
Showing the ids of both an user given by an argument to `id',
   and the current user, is now handled in a single function.
   Displaying the current user's ids was inaccurate because
   getgroups(2) had been used.  getgroups(2) returns the current
   kernel state of a user's groups, which may not always be
   correct if /etc/group was recently changed.
 - Fix a few style bugs.

PR:		bin/78085
2005-04-28 15:55:54 +00:00
stefanf
60b910d7c2 Remove unused variables. 2005-04-09 14:31:41 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
stefanf
d00a4eaaea Pass an array of gid_t rather than an array of int to getgroups().
PR:	56646
2004-10-02 11:40:48 +00:00
dwmalone
6ad6fb7431 Add missing %s so that all of the usage message gets printed.
Bump WARNS to 6 while I'm here.
2004-05-19 21:06:36 +00:00
ru
f87994f699 Bump document date on behalf of the -M option. 2004-05-18 20:36:54 +00:00
rwatson
bbf5b43ff8 Add "-M" argument to id(1), which permits the id command to be used
to print the MAC label of the current process.  "-M" selected as that's
what is used in Trusted IRIX.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, McAfee Research
2004-05-03 22:50:23 +00:00
dwmalone
b4339b74ad ANSIify function definitions.
Add some constness to avoid some warnings.
Remove use register keyword.
Deal with missing/unneeded extern/prototypes.
Some minor type changes/casts to avoid warnings.

Reviewed by:	md5
2002-09-04 23:29:10 +00:00
jmallett
2b6e4e1504 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
imp
74d826c7a6 remove __P 2002-03-22 01:22:50 +00:00
markm
ae2558974f Remove leaf node WARNS?=2 (that mainly I added). This should
help the GCC3 transition and CURRENT in general.
2002-02-08 22:31:43 +00:00
ru
e177b37bfd Fold groups(1) and whoami(1) into id(1). 2001-09-14 14:04:08 +00:00
ru
fcbb572f70 Now that we have it, replace `afterinstall' target with SCRIPTS. 2001-09-13 14:26:31 +00:00
ru
bde8ec1b70 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
ru
36f138439b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 14:16:33 +00:00
dd
ec2af058ec Silence warnings (most about constness) and clamp down with WARNS=2.
Tested on i386 and alpha.
2001-05-28 06:14:48 +00:00
dd
79b7ca8187 Print commas in the group list in user(). current() already did this.
Reviewed by:	ru, sheldonh
Inspired by:	OpenBSD, NetBSD
2001-05-20 20:32:13 +00:00
ru
89596e4538 MAN[1-9] -> MAN. 2001-03-27 10:52:19 +00:00
ru
0d1334ca0c mdoc(7) police: use the new features of the Nm macro. 2000-11-20 19:21:22 +00:00
ru
97db99868e .UC -> .Os 2000-11-06 09:27:03 +00:00
charnier
0a686ed3d8 DIAGNOSTICS section name missing and .Nm changes 2000-03-26 14:24:40 +00:00
billf
b6f5158016 Cast pw_change and pw_expire to long and fix the format specifier accordingly. 1999-09-06 20:07:12 +00:00
chris
1eef2252ef Remove unused variables. 1999-09-05 23:27:53 +00:00
chris
17831c333c Properly document -P and -p flags. 1999-09-01 22:56:44 +00:00
peter
3b842d34e8 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
nik
6578739ddb Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

     .\"    $Id$
     .\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by:            bde
1999-07-12 20:24:20 +00:00
billf
4822432874 Clean up some ambiguous nested if/elses. 1999-07-04 17:26:16 +00:00
obrien
64c7d46ad0 Add "-P" display the id as a password file entry.
Submitted by:	terry
1998-08-21 06:47:58 +00:00
alex
e3529c7a82 Use .Nm id' instead of .Nm' for the synopsis lines.
PR:		5876
1998-02-28 21:37:54 +00:00
steve
1e009eea0e Missing newline when euid != ruid.
PR:		5778
Submitted by:	Martin Kammerhofer <dada@sbox.tu-graz.ac.at>
1998-02-18 17:35:16 +00:00
charnier
793ad1484d Use err(3) instead of local redefinition. Silent -Wall. 1997-07-15 09:48:49 +00:00