summaryrefslogtreecommitdiffstats
path: root/usr.bin/rwho
Commit message (Collapse)AuthorAgeFilesLines
* Change the cap_rights_t type from uint64_t to a structure that we can extendpjd2013-09-051-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the future in a backward compatible (API and ABI) way. The cap_rights_t represents capability rights. We used to use one bit to represent one right, but we are running out of spare bits. Currently the new structure provides place for 114 rights (so 50 more than the previous cap_rights_t), but it is possible to grow the structure to hold at least 285 rights, although we can make it even larger if 285 rights won't be enough. The structure definition looks like this: struct cap_rights { uint64_t cr_rights[CAP_RIGHTS_VERSION + 2]; }; The initial CAP_RIGHTS_VERSION is 0. The top two bits in the first element of the cr_rights[] array contain total number of elements in the array - 2. This means if those two bits are equal to 0, we have 2 array elements. The top two bits in all remaining array elements should be 0. The next five bits in all array elements contain array index. Only one bit is used and bit position in this five-bits range defines array index. This means there can be at most five array elements in the future. To define new right the CAPRIGHT() macro must be used. The macro takes two arguments - an array index and a bit to set, eg. #define CAP_PDKILL CAPRIGHT(1, 0x0000000000000800ULL) We still support aliases that combine few rights, but the rights have to belong to the same array element, eg: #define CAP_LOOKUP CAPRIGHT(0, 0x0000000000000400ULL) #define CAP_FCHMOD CAPRIGHT(0, 0x0000000000002000ULL) #define CAP_FCHMODAT (CAP_FCHMOD | CAP_LOOKUP) There is new API to manage the new cap_rights_t structure: cap_rights_t *cap_rights_init(cap_rights_t *rights, ...); void cap_rights_set(cap_rights_t *rights, ...); void cap_rights_clear(cap_rights_t *rights, ...); bool cap_rights_is_set(const cap_rights_t *rights, ...); bool cap_rights_is_valid(const cap_rights_t *rights); void cap_rights_merge(cap_rights_t *dst, const cap_rights_t *src); void cap_rights_remove(cap_rights_t *dst, const cap_rights_t *src); bool cap_rights_contains(const cap_rights_t *big, const cap_rights_t *little); Capability rights to the cap_rights_init(), cap_rights_set(), cap_rights_clear() and cap_rights_is_set() functions are provided by separating them with commas, eg: cap_rights_t rights; cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FSTAT); There is no need to terminate the list of rights, as those functions are actually macros that take care of the termination, eg: #define cap_rights_set(rights, ...) \ __cap_rights_set((rights), __VA_ARGS__, 0ULL) void __cap_rights_set(cap_rights_t *rights, ...); Thanks to using one bit as an array index we can assert in those functions that there are no two rights belonging to different array elements provided together. For example this is illegal and will be detected, because CAP_LOOKUP belongs to element 0 and CAP_PDKILL to element 1: cap_rights_init(&rights, CAP_LOOKUP | CAP_PDKILL); Providing several rights that belongs to the same array's element this way is correct, but is not advised. It should only be used for aliases definition. This commit also breaks compatibility with some existing Capsicum system calls, but I see no other way to do that. This should be fine as Capsicum is still experimental and this change is not going to 9.x. Sponsored by: The FreeBSD Foundation
* Few more style nits.pjd2013-07-031-13/+10
| | | | MFC after: 1 month
* Sandbox rwho(1) using capability mode and Capsicum capabilities.pjd2013-07-031-3/+23
| | | | | | | | | rwho(1) gets only read-only access to /var/rwho/ directory. Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org> Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after: 1 month
* Style cleanups.pjd2013-07-031-45/+53
| | | | | | | Submitted by: Mariusz Zaborski <oshogbo@FreeBSD.org> Sponsored by: Google Summer of Code 2013 Reviewed by: pjd MFC after: 1 month
* Add missing static keywords to rwho(1)ed2011-11-061-8/+8
|
* Build rwho(1) with WARNS=6.ed2011-10-162-4/+3
| | | | | | | The only reason why it didn't build with WARNS=6, is because of some simple to fix string formatting bugs. MFC after: 3 months
* Remove the advertising clause from UCB copyrighted files in usr.bin. Thisjoel2010-12-112-8/+0
| | | | | | | | | 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
* Build usr.bin/ with WARNS=6 by default.ed2010-01-021-0/+3
| | | | Also add some missing $FreeBSD$ to keep svn happy.
* Let the width of the username column depend on the rwho file format.ed2009-12-251-2/+1
| | | | | Right now the code uses UT_NAMESIZE, but this makes little sense, because rwho(1) parses files generated by rwhod(8). Not utmp(5) files.
* It's actually 11 minutes when the machine is assumed to be down and removedssouhlal2005-08-071-1/+1
| | | | | | from the output. Obtained from: DragonFlyBSD
* Expand *n't contractions.ru2005-02-131-1/+1
|
* Modernise; ISOify, use __FBSDID(), use headers instead of hand-declaring.markm2002-07-011-12/+13
| | | | Fix easy warnings.
* remove __Pimp2002-03-221-2/+2
|
* I've been meaning to do this for a while. Add an underscore to thedillon2002-01-191-1/+1
| | | | | | | | time_to_xxx() and xxx_to_time() functions. e.g. _time_to_xxx() instead of time_to_xxx(), to make it more obvious that these are stopgap functions & placemarkers and not meant to create a defacto standard. They will eventually be replaced when a real standard comes out of committee.
* Fix time_t == int assumption, convert protocol int to time_t.dillon2001-10-281-1/+2
|
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-101-1/+1
|
* Don't attempt to parse %cache2001-03-211-3/+9
|
* Get rid of hard sentence breakcharnier2000-03-271-2/+3
| | | | Asked by: Sheldon
* Add section number to .Xr references. Enumerate flags the standard way.charnier2000-03-261-8/+9
|
* $Id$ -> $FreeBSD$peter1999-08-282-2/+2
|
* Add $Id$, to make it simpler for members of the translation teams tonik1999-07-121-0/+1
| | | | | | | | | | | | | | | | | 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
* Fixed typo.foxfair1998-12-201-1/+1
|
* Be picky about the format of the commandline and cleanupsteve1998-05-031-6/+16
| | | | | | | a warning related to qsort. PR: 6420 Submitted by: Ruslan Ermilov <ru@ucb.crimea.ua>
* Use err(3). Add usage() and prototypes. Add Xr to who(1).charnier1997-08-082-20/+34
|
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-291-1/+1
| | | | posix standard on the topic.
* Fix my error from previous commit with mixing rwhod protocolache1996-12-051-7/+8
| | | | | and utmp sizes. Replace hardcoded constants by sizeofs or symbolic constants
* Use UT_* contstants when possible instead of harcoded 8ache1996-12-051-8/+9
| | | | 2.2 candidate
* Eliminated includes of the "temporary" backwards compatibility headerbde1996-09-241-2/+2
| | | | | | <sys/dir.h> in applications. Maintained existing (inadequate) ifdefs for dir.h vs dirent.h in libdialog, amd and rarpd, but didn't add any new ones.
* Fix some incorrect locations in the FILES sections of some man pages.mpp1996-02-021-1/+1
|
* Add setlocale LT_TIMEache1995-10-241-0/+3
|
* Change ctime to strftime %c to use national date/time representation.ache1995-08-081-3/+5
|
* Remove trailing whitespace.rgrimes1995-05-301-1/+1
|
* My prevoius commit missed some things. The out_line didn't needats1994-12-271-2/+3
| | | | | | | | | | to be padded to 8 chars. Simply make sure that never more than 8 chars are printed ( %-.8s ). The former commit otherwise hosed the width calculation and landed on different positions for the time output. Also the strlen(xx_out_line) hoses the wide calculation, so that it sometimes make it much larger than necessary. Simply use always 8 chars for the out_line calculation now. Looks good this way.
* The out_line doesn't need to be zero terminated, so print it not with %sats1994-12-261-1/+1
| | | | | but with a %-8.8s instead. this prevents funny output, if the out_line contains a long hostname that is larger than 8 chars.
* BSD 4.4 Lite Usr.bin Sourcesrgrimes1994-05-273-0/+269
OpenPOWER on IntegriCloud