Commit Graph

22 Commits

Author SHA1 Message Date
bapt
e1089ea7ad Do not die on system built without CAPSICUM 2017-03-15 15:57:11 +00:00
imp
7e6cabd06e 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
bapt
3137dcd013 Better fix for r314098
The actual issue was the fact that if - was used then some restriction were
already set to stdin when we were applying caph_limit_stdio which was failing
due to the fact the fd was the fd was already restricted to lower rights.

Restricting stdio before actually opening the files prevent trying to raise the
right and fixes the issue.

And this allows to keep failing the program if restriction failed

Approved by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D9723
2017-02-22 16:37:45 +00:00
allanjude
bfa1974608 lam(1): Failing to restrict stdin/stdout/stderr should not be fatal
When fed from a pipe, lam(1) would sometimes fail:
lam: unable to limit stdio: Capabilities insufficient

fixed regression in portsnap(8) introduced in r313938

This broke portsnap(8), the app that the capsicumization of lam(1) was
meant to secure.

# portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Tue Feb 21 16:05:39 MSK 2017 to Tue Feb 21 16:59:30 MSK 2017.
Fetching 5 metadata patches.lam: unable to limit stdio: Capabilities insufficient
 done.
Applying metadata patches... done.
Fetching 5 metadata files... lam: unable to limit stdio: Capabilities insufficient
/usr/sbin/portsnap: cannot open 8c94d2c3f8fcea20eb1fd82021566c99c63a010e6b3702ee11e7a491795bcfb8.gz: No such file or directory
metadata is corrupt.

Reported by:	Vladimir Zakharov <zakharov.vv@gmail.com>, Ben Woods <woodsb02@gmail.com>
2017-02-22 15:30:57 +00:00
allanjude
0e5c0d0d6d Capsicum-ize lam(1)
lam(1) is used in portsnap(8), so lock it down

Reviewed by:	emaste, cem, jonathan
Sponsored by:	ScaleEngine Inc.
Differential Revision:	https://reviews.freebsd.org/D8076
2017-02-19 06:02:41 +00:00
ed
fb0088d7d0 Mark global functions and/or variables in lam(1) static where possible.
This allows compilers and static analyzers to more thorough analysis.
2011-11-06 18:49:41 +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
b2f1332428 ANSIfy various tools in usr.bin/.
Most of these tools properly build at WARNS=6, except for their K&R
function declarations. Fix this, so we can bump WARNS as well.
2010-01-02 10:09:20 +00:00
jmallett
8334e41609 Call usage() instead of being insolent. 2005-08-05 01:04:36 +00:00
tjr
a83177cdc3 Avoid passing negative values to tolower() on machines with signed chars. 2004-07-19 12:57:24 +00:00
jmallett
617eb0d7c2 Back out my minorly disputed and possibly not well thought out changes to how
arguments are processed, at least temporarily.
2002-07-01 18:03:30 +00:00
obrien
bc61fc95d8 Consistently use FBSDID 2002-06-30 05:25:07 +00:00
jmallett
fd8dc1333d Increment morefiles, balance braces. This should really be using getopt(3). 2002-06-27 21:11:19 +00:00
jmallett
3e36f9e3d9 Instead of not using argc and doing other great evil, check for no arguments
in main() and print usage, or if there are too many arguments, handle that
there, too.
2002-06-27 21:01:32 +00:00
mike
b0dfeae7a3 Constify, staticize, and set WARNS=2.
MFC after:	3 days
2001-08-06 23:20:06 +00:00
mikeh
4ec3558a81 Fix style(9) bugs from previous commit: remove space after function
names and revert to char *[].

bde by:	bde, imp
2001-02-08 20:15:59 +00:00
mikeh
6510c5af82 De-__P()-ify, convert K&R style declarations to ANSI ones 2001-02-08 05:58:55 +00:00
mikeh
71e073a651 Prevent string overflows by using safer string functions
Use tolower() rather than bit or-ing
Sanity check user specified printf() format
Exit when too many input files are given
Remove register from variables

Reviewed by:	markm, imp
2001-02-08 05:33:19 +00:00
kris
74a1be3402 Don't call err() with no format string. 2000-07-10 09:14:15 +00:00
peter
3b842d34e8 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
charnier
7cb730f7e3 Use err(3) instead of local redefintion. Add usage() as a separate
function. Rewrote man page in mdoc format.
1997-07-18 06:43:15 +00:00
rgrimes
f9ab90d9d6 BSD 4.4 Lite Usr.bin Sources 1994-05-27 12:33:43 +00:00