Commit Graph

29 Commits

Author SHA1 Message Date
Mark Johnston
27ed53c311 Remove extraneous setutxent() calls in write(1).
We already call setutxent() once during initialization.  Furthermore,
the subsequent calls occur after the process has entered capability
mode, so they fail, and attempts to fetch database entries fail as
a result.

PR:		235096
Submitted by:	fullermd@over-yonder.net
MFC after:	3 days
2019-01-23 20:02:17 +00:00
Mariusz Zaborski
377421df96 capsicum: use a new capsicum helpers in tools
Use caph_{rights,ioctls,fcntls}_limit to simplify the code.
2018-11-04 19:24:49 +00:00
Mariusz Zaborski
7672a0148f Convert cap_enter() < 0 && errno != ENOSYS to caph_enter() < 0.
No functional change intended.
2018-06-19 23:43:14 +00:00
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Conrad Meyer
38adbfe6b2 write(1): Capsicumify
Enter Capsicum capability sandbox pretty early in this setuid program.

Some minor modifications were needed to cache directory fds and use
relative lookups.

Rights restriction of the stdio descriptors is unfortunately pretty messy
because we need an ioctl capability not present in the current libcapsicum
helpers (FIODGNAME).

Reviewed by:	ed
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D7999
2016-10-06 14:55:15 +00:00
Gleb Smirnoff
0de6400b1c Fix write(1) to support wide characters.
Submitted by:	amdmi3
PR:		bin/164317
2012-02-13 14:40:15 +00:00
Joel Dahl
da52b4caaf 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 Schouten
ab90a4d1e2 Perform all trivial ports to utmpx for usr.bin/.
They were already converted to use libulog, so it's easy to convert them
to utmpx.
2010-01-13 18:09:54 +00:00
Ed Schouten
5095053036 Let wall(1) use utmpx.
Because our implementation guarantees the strings inside struct utmpx to
be null terminated, we don't need to copy everything out, which makes
the code nicer to read.

Also set WARNS to 6 and add $FreeBSD$ to keep SVN happy.
2009-12-05 20:22:26 +00:00
John Baldwin
a4cc298ac9 write(1) needs to strip off the leading /dev/ from the tty name for the
current tty as returned from ttyname(3) so it can try to avoid writing to
the current tty if possible.  Previously, it did this by trimming off any
leading directory (effectively performing a basename(3) on the path
returned from ttyname(3)).  However, this chopped off too much of the path
for ttys who have directories in their name such as pts(4).  Instead, just
strip off the leading /dev/ from the path returned by ttyname(3).  This
fixes write(1) when using pts(4).

MFC after:	1 week
Reported by:	rwatson
2007-11-12 20:02:21 +00:00
Olivier Houchard
e4bac6b864 Fix a typo in comment.
Reviewed by:	mux (mentor)
2005-01-05 11:52:40 +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
Tim J. Robbins
759484bacd Use getopt() to reject any options and skip "--" arguments. 2002-05-29 13:14:51 +00:00
Warner Losh
3f330d7d1a remove __P 2002-03-22 01:42:45 +00:00
David Malone
421dfbcfdd 1) Move FreeBSD tag to after vendor ID, #if 0 vendor ID.
2) Add missing include of stdlib.h for exit(), spotted by gcc3.
2002-02-27 14:40:09 +00:00
Mark Murray
9ba3a235b1 WARNS=2 fixes, use __FBSDID(), kill register keyword. 2001-12-11 22:34:38 +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
Andrey A. Chernov
fe38e2f8f4 Allow backspace too 1997-09-15 00:42:04 +00:00
Andrey A. Chernov
07484d1f24 Oops, fix upper controls test 1997-09-15 00:17:38 +00:00
Andrey A. Chernov
77caf2118f Localize it. High controls disabled in any case.
Shut compiler warning about signal argument.
PR: 4466
1997-09-15 00:08:19 +00:00
Philippe Charnier
29909ffecc Use err(3). Add usage() and prototypes. 1997-08-26 11:23:37 +00:00
Alexander Langer
0adcbd83f1 Replace hardcoded length of "/dev/" with strlen(_PATH_DEV).
Pointed out by:	bde
1996-10-26 15:29:24 +00:00
Alexander Langer
2d754ac864 sprintf --> snprintf
Use _PATH_DEV instead of hard coded "/dev/"

Obtained from:	OpenBSD, Jason Downs <downsj@OpenBSD.ORG>
1996-10-26 04:08:57 +00:00
Andrey A. Chernov
dbc57b8da7 Do unctrl in right way
Handle '\377' properly
1995-11-05 09:02:10 +00:00
Andrey A. Chernov
b6c671c7ba Remove char->int promotion.
Fix uncontrol function for 8bit chars.
1995-10-29 10:33:26 +00:00
Andrey A. Chernov
ee15822acd Now works with 8bit chars... 1995-10-28 22:48:27 +00:00
Rodney W. Grimes
9b50d90275 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00