Commit Graph

26 Commits

Author SHA1 Message Date
Robert Drehmel
7f31354152 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 Drehmel
58b6761db3 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 Drehmel
68b9b81e79 - 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
Stefan Farfeleder
6c97c3d1d3 Remove unused variables. 2005-04-09 14:31:41 +00:00
Stefan Farfeleder
950cc39559 Pass an array of gid_t rather than an array of int to getgroups().
PR:	56646
2004-10-02 11:40:48 +00:00
David Malone
f2ab33b6eb 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
Robert Watson
300b40af25 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
David Malone
f4ac32def2 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
Juli Mallett
3a7fc8ce59 Remove local prototypes for main(). 2002-08-19 03:07:56 +00:00
David E. O'Brien
e026a48c34 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
Warner Losh
f1bb2cd2aa remove __P 2002-03-22 01:22:50 +00:00
Ruslan Ermilov
4bf12cb91e Fold groups(1) and whoami(1) into id(1). 2001-09-14 14:04:08 +00:00
Dima Dorfman
da3082d4a9 Silence warnings (most about constness) and clamp down with WARNS=2.
Tested on i386 and alpha.
2001-05-28 06:14:48 +00:00
Dima Dorfman
387acdd9ff 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
Bill Fumerola
15b09e6540 Cast pw_change and pw_expire to long and fix the format specifier accordingly. 1999-09-06 20:07:12 +00:00
Chris Costello
45e46bb14a Remove unused variables. 1999-09-05 23:27:53 +00:00
Chris Costello
f72286af57 Properly document -P and -p flags. 1999-09-01 22:56:44 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Bill Fumerola
9ef5c48bef Clean up some ambiguous nested if/elses. 1999-07-04 17:26:16 +00:00
David E. O'Brien
bd7061056e Add "-P" display the id as a password file entry.
Submitted by:	terry
1998-08-21 06:47:58 +00:00
Steve Price
a81b76b3e8 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
Philippe Charnier
d48dbc786e Use err(3) instead of local redefinition. Silent -Wall. 1997-07-15 09:48:49 +00:00
Warner Losh
1c8af87873 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 04:34:07 +00:00
David Greenman
b5203ad098 Fixed bug where 'id <user>' output the wrong group name (the user name
was output instead). Pointed out by Chael Hall <nowhere@chaos.taylored.com>.
1995-08-28 10:23:58 +00:00
Rodney W. Grimes
7799f52a32 Remove trailing whitespace. 1995-05-30 06:41:30 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00