summaryrefslogtreecommitdiff
path: root/usr.bin
AgeCommit message (Collapse)Author
2015-10-11fix regression: ttyname() failure not handled rightTheo de Raadt
2015-10-11now that tsort has a clean structure, do more specific pledge() calls.Marc Espie
okay deraadt@
2015-10-11Drop tags containing a blank character:Ingo Schwarze
They don't work, they break other tags in weird ways, and even if they could be made to work, they would be mostly useless. Issue reported by naddy@, thanks.
2015-10-11-version options on commands like this make no sense; the version numberTheo de Raadt
makes no promises about compatibility nor the lack of compatibility. suggestion & diff from micheal reed
2015-10-11Finally use __progname, err(3) and warn(3).Ingo Schwarze
That's more readable and less error-prone than fumbling around with argv[0], fprintf(3), strerror(3), perror(3), and exit(3). It also shortens the code by 50 lines. It's a bad idea to boycott good interfaces merely because standards committees ignore them. Instead, it's the job of the portable distribution to provide compatibility modules for archaic systems (like commercial Solaris) that still don't have them. Actually, the compat code for the portable distribution already exists and will be committed right after this.
2015-10-11with the RPATH enforcement, csplit(1) don't work anymore on stdin...Sebastien Marie
the newfile() function used for create files open files in "w+" (O_RDWR), and may occasionally do reading on the file (function toomuch()). ok deraadt@
2015-10-11reorg code to have an array with all the files used apparent.Marc Espie
okay millert@
2015-10-11handle comma separated list of arguments, i.e. pkg-config --exists ↵Jasper Lievisse Adriaanse
gcr-3,gcr-base-3
2015-10-11fix a regression spotted by chris@. the -f and -I arguments fetch processTheo de Raadt
arguments using kvm_getargs, after the pledge() has been made. someone brave should refactor this, hoisting the argument fetching to between kvm_getprocs() and pledge() - storing the argument data as neccessary. the current situation is also a race -- it fetches the data twice.
2015-10-11Userspace doesn't need to use SUN_LEN(): connect() and bind() must acceptPhilip Guenther
sizeof(struct sockaddr_un), so do the simple, portable thing ok beck@ deraadt@
2015-10-10Initial support for pledges in openssl(1) commands.Doug Hogan
openssl(1) has two mechanisms for operating: either a single execution of one command (looking at argv[0] or argv[1]) or as an interactive session than may execute any number of commands. We already have a top level pledge that should cover all commands and that's what interactive mode must continue using. However, we can tighten up the pledges when only executing one command. This is an initial stab at support and may contain regressions. Most commands only need "stdio rpath wpath cpath". The pledges could be further restricted by evaluating the situation after parsing options. deraadt@ and beck@ are roughly fine with this approach.
2015-10-10another pledge argument reorder for sake of re-auditTheo de Raadt
2015-10-10Fix YP user and group support in getent(1).Doug Hogan
These should have been "stdio getpw" before, but they worked for non-YP environments. With YP, it won't work without "getpw". Reported by semarie@ and confirmed as a problem by miod@. ok deraadt@
2015-10-10pledge "stdio rpath wpath cpath"Theo de Raadt
ok doug
2015-10-10env(1) is obviously a program falling into pledge "stdio exec". ItTheo de Raadt
does stdio, and it does a raw execve(). It is so obvious. It gets only _exit(2), kbind(2), and 46 system calls -- over half of which are deeply gutted in their functionality to only serve narrow libc needs for "stdio (includes malloc)". the other 161 system calls kill it.
2015-10-10pledge "stdio inet rpath" seems to be enough for a YP environment.Theo de Raadt
rpath is to access /etc/rpc, and inet to talk to portmap & local world. ok beck
2015-10-10pledge "stdio rpath wpath cpath proc exec"; this spawns cpp.Theo de Raadt
ok doug
2015-10-10normalize a few more tame request orderings, to help reviewTheo de Raadt
2015-10-10normalize the ordering of tame requests (particularily, "rpath wpath cpath",Theo de Raadt
which i have put in that order). this is not important, but helps look for outliers which might be strange. it hints that "ioctl" should be reassessed in a few places, to see if "tty" is better; that "unix" may be used in some places where "route" could now work.
2015-10-10Add pledge support in awk and make awk -safe actually safe.Doug Hogan
awk -safe was introduced back in 1997 to stop awk from doing file output, execute commands or access the environment. The lexer rejected programs when it saw awk commands that would write, exec or env. Beyond that, it wasn't safe from write/exec/env during program execution. With pledge "stdio rpath", the kernel is now enforcing the awk -safe mode restrictions at runtime (other than env). Based on a diff by deraadt@ ok deraadt@ beck@
2015-10-10Rather than invoking fork/execve of dc(1) on a pipe, compile in the dc(1)Theo de Raadt
code directly and use it as a subfunction. This refactoring allows use of pledge "stdio rpath proc tty" in the main bc(1) process before fork, pledge "stdio rpath tty" after fork, and fully reduced to "stdio" in the dc(1) child. This requires two recent to the kernel code (allowing sigsuspend(), and kill() self as pid 0). ok otto
2015-10-10since kdump may getprotobynumber() late, do not drop "rpath". We couldTheo de Raadt
potentially modify pledge() to permit /etc/protocols (/etc/rpc? /etc/services? etc) without requiring a rpath attribute.. but where would we draw the line for what /etc files libc functions need? At present, we draw that line closer to the minimum. issue found by theo@math.ethz.ch
2015-10-10pledge "stdio rpath wpath cpath"Theo de Raadt
ok doug
2015-10-10pledge "stdio getpw rpath wpath cpath tmppath proc exec". doug pointed outTheo de Raadt
the need for getpw. Not sure if I see ways to improve this program. ok doug
2015-10-10pledge "stdio rpath wpath cpath proc exec". there is some potentialTheo de Raadt
for dropping some path attributes in between, but i will let someone else do that. ok doug
2015-10-10pledge "stdio rpath"Theo de Raadt
ok beck doug
2015-10-10pledge "stdio getpw rpath wpath cpath fattr". doug pointed out getpw*Theo de Raadt
use, and fattr for chmod. doug
2015-10-10encrypt(1) also needs to pledge "wpath" for getpass().Doug Hogan
getpass() opens /dev/tty RW so it can write the prompt. ok deraadt@
2015-10-10pledge "stdio rpath tty". rpath for the configuration reading done byTheo de Raadt
login* subsystem, tty for readpassphase() ok beck
2015-10-10pledge "stdio proc exec" works.Theo de Raadt
ok doug
2015-10-10plege "stdio rpath tty". "tty" is for the curses code lurking in theTheo de Raadt
background. ok doug
2015-10-10pledge "stdio rpath proc exec". proc & exec because obviously itTheo de Raadt
spawns subprocesses. rpath is only needed for the -o (open /dev/tty) or no -o (open /dev/null) choice. ok beck
2015-10-10basic pledge "stdio rpath"Theo de Raadt
ok doug
2015-10-10pledge "stdio rpath" seems to work; ok dougTheo de Raadt
2015-10-10pledge "stdio proc exec". relies on two recent kernel fixes.Theo de Raadt
2015-10-10must also pledge "getpw", because it will use getpw* and getgr* functions.Theo de Raadt
discussed with doug and semarie
2015-10-10pledge "stdio rpath route" seems to be working. route is needed forTheo de Raadt
pretty printing some addresses.
2015-10-10pledge "stdio rpath wpath cpath". as a curses program, I expected thisTheo de Raadt
to maybe need "tty", but have not found a path which calls those kind of curses functions. ok doug
2015-10-10pkill has to get all the getopt, getpwuid, libkvm stuff out of the wayTheo de Raadt
first. it can pledge to "stdio" (pgrep case) or "stdio proc" (pkill case) before parsing and matching the expression. ok doug
2015-10-10fairly obvious pledges.Theo de Raadt
ok doug
2015-10-10fairly simple pledge to "stdio rpath wpath cpath"Theo de Raadt
2015-10-10Decide whether to use_pager as early as possible,Ingo Schwarze
in preparation for pledge(2); no functional change intended.
2015-10-10Make functions that accept multiple iterations via C-u N, honour 0.Mark Lumsden
Except C-k which has a defined behaviour. In mg, C-t doesn't complete n iterations if requested, but probably should, hence it has been included in this diff.
2015-10-10Call onlywind() properly.Mark Lumsden
2015-10-10Some of these large so easy to contain, with "stdio rpath".Theo de Raadt
ok doug
2015-10-10simple program using "stdio rpath"Theo de Raadt
ok doug
2015-10-10Add pledge support to cmp(1).Doug Hogan
This is a simple case of using "stdio rpath" until all files are opened and then dropping down to "stdio" since it includes "rw" on open fds. ok deraadt@
2015-10-10pledge to only use "stdio rpath"; ok dougTheo de Raadt
2015-10-10Add pledge support to getent(1).Doug Hogan
This pledges the superset of all requests for the various getent databases and then drops to the minimum for the chosen database. ok deraadt@
2015-10-09Remove telnet warnings. Civilization has reached a point where they are noTim van der Molen
longer relevant. OK millert@