openbsd
9 years agoPledge "stdio rpath" requests for nologin.
doug [Tue, 13 Oct 2015 07:10:38 +0000 (07:10 +0000)]
Pledge "stdio rpath" requests for nologin.

ok deraadt@
"reads ok" semarie@

9 years agoObvious pledge "stdio" for yes.
doug [Tue, 13 Oct 2015 07:03:26 +0000 (07:03 +0000)]
Obvious pledge "stdio" for yes.

ok deraadt@

9 years agorevert previous. changes the behaviour of:
daniel [Tue, 13 Oct 2015 04:30:53 +0000 (04:30 +0000)]
revert previous. changes the behaviour of:
rm -f ""

9 years agoAdd some newer DT_* and DF_* constants
guenther [Tue, 13 Oct 2015 04:29:50 +0000 (04:29 +0000)]
Add some newer DT_* and DF_* constants

ok kettenis@ miod@

9 years agoTighten the ranges in wcrtomb(3).
bentley [Tue, 13 Oct 2015 02:17:46 +0000 (02:17 +0000)]
Tighten the ranges in wcrtomb(3).

By definition, the range of valid Unicode code points is the union of
U+0000..U+D7FF and U+E000..U+10FFFF (see Unicode 8.0.0, chapter 3.9).

In UTF-16, the encoded values that would represent U+D800..U+DFFF are
used for surrogate pairs. UTF-8 has no concept of surrogate pairs;
attempting to treat them as regular code points violates the standard
and makes no sense besides.

ok stsp@

9 years agofree the correct IV length, don't assume it's always the cipher
djm [Tue, 13 Oct 2015 00:21:27 +0000 (00:21 +0000)]
free the correct IV length, don't assume it's always the cipher
blocksize; ok dtucker@

9 years agoPledge "fattr" request should allow fchflags().
doug [Tue, 13 Oct 2015 00:03:42 +0000 (00:03 +0000)]
Pledge "fattr" request should allow fchflags().

"add it" deraadt@

9 years agosatisfy jmc!
deraadt [Mon, 12 Oct 2015 23:32:55 +0000 (23:32 +0000)]
satisfy jmc!

9 years agopledge "proc" request should allow setsid()
deraadt [Mon, 12 Oct 2015 23:16:23 +0000 (23:16 +0000)]
pledge "proc" request should allow setsid()

9 years agoplegde(2) for apropos(1), help(1), man(1), mandoc(1), and whatis(1):
schwarze [Mon, 12 Oct 2015 22:41:18 +0000 (22:41 +0000)]
plegde(2) for apropos(1), help(1), man(1), mandoc(1), and whatis(1):
Always needed: stdio rpath (to open multiple files and for .so)
In addition after starting the pager: tmppath (to clean up the temp files)
In addition before starting the pager: proc exec
Looks good to deraadt@.

9 years agopledge(2) for makewhatis(8):
schwarze [Mon, 12 Oct 2015 22:30:27 +0000 (22:30 +0000)]
pledge(2) for makewhatis(8):
Always needed: stdio rpath.
In addition when writing to an existing db: wpath cpath fattr.
In addition when creating a new db: proc exec.
Based on work by and OK bentley@, "get moving" deraadt@.

9 years agodo not call sync() when committing a message, it's not helping in any way
gilles [Mon, 12 Oct 2015 22:29:49 +0000 (22:29 +0000)]
do not call sync() when committing a message, it's not helping in any way

9 years agosurprisingly, this can pledge "stdio rpath exec" right at start. once
deraadt [Mon, 12 Oct 2015 22:01:08 +0000 (22:01 +0000)]
surprisingly, this can pledge "stdio rpath exec" right at start. once
the config file is opened, it can pledge "stdio exec", and be on its
merry way to start the real MTA

9 years agoRemove the "cmsg" attribute, as promised. Use "sendfd" or "recvfd",
deraadt [Mon, 12 Oct 2015 21:43:20 +0000 (21:43 +0000)]
Remove the "cmsg" attribute, as promised.  Use "sendfd" or "recvfd",
depending on what you need.  inet/inet6 cmsg's come through unmolested --
that is something to consider later.

9 years agoAdd details about a variety of semantics; going to keep adding and then
deraadt [Mon, 12 Oct 2015 21:40:38 +0000 (21:40 +0000)]
Add details about a variety of semantics; going to keep adding and then
reevaluate the direction of this manual page a bit later.

9 years agoAdd missing checks for write errors; OK eric@
millert [Mon, 12 Oct 2015 21:32:27 +0000 (21:32 +0000)]
Add missing checks for write errors; OK eric@

9 years agoDelete an assignment that is unconditionally overwritten two lines later;
schwarze [Mon, 12 Oct 2015 21:25:36 +0000 (21:25 +0000)]
Delete an assignment that is unconditionally overwritten two lines later;
found by Svyatoslav Mishyn <juef at openmailbox dot org>
with the clang static analyzer.

9 years agoGarbage collect an unused variable, no functional change;
schwarze [Mon, 12 Oct 2015 21:16:32 +0000 (21:16 +0000)]
Garbage collect an unused variable, no functional change;
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.

9 years agoCheck the right pointer against NULL;
schwarze [Mon, 12 Oct 2015 21:09:08 +0000 (21:09 +0000)]
Check the right pointer against NULL;
fixing a pasto introduced in the previous commit;
found by Svyatoslav Mishyn <juef at openmailbox dot org> with cppcheck.

9 years agoCheck that the disk specified on the command line is the disk that
krw [Mon, 12 Oct 2015 20:52:20 +0000 (20:52 +0000)]
Check that the disk specified on the command line is the disk that
files are copied to. Error out with 'cross-device install' if not.

ok millert@, ok deraadt@ & jsing@ for previous version

9 years agoadd Date header when a session iniated locally doesn't add one
gilles [Mon, 12 Oct 2015 20:16:31 +0000 (20:16 +0000)]
add Date header when a session iniated locally doesn't add one

ok millert@, ok eric@

9 years agothese callers of ttyname() no longer need to pledge "tty"
deraadt [Mon, 12 Oct 2015 20:03:24 +0000 (20:03 +0000)]
these callers of ttyname() no longer need to pledge "tty"

9 years agottyname() no longer does ioctl TIOCGETA, so pledge("tty") is no longer
naddy [Mon, 12 Oct 2015 19:56:47 +0000 (19:56 +0000)]
ttyname() no longer does ioctl TIOCGETA, so pledge("tty") is no longer
needed here.  ok deraadt@

9 years agoWhen isatty() was switched to F_ISATTY, the inline copy in ttyname()
naddy [Mon, 12 Oct 2015 19:53:58 +0000 (19:53 +0000)]
When isatty() was switched to F_ISATTY, the inline copy in ttyname()
was forgotten.  Just call isatty().  ok deraadt@

9 years agoMaintain a list of files marked for deletion while refreshing a dired
lum [Mon, 12 Oct 2015 19:08:39 +0000 (19:08 +0000)]
Maintain a list of files marked for deletion while refreshing a dired
buffer. Previously, when refreshing the buffer the files marked for
deletion would be lost.

Since the relationship between the files that have been marked for
deletion and those that exist on disk is volatile, I have chosen to
implement the discovery of marked files during the refresh function as
opposed to maintaining a dired buffer specific list.

9 years agodeprecate & remove -W option; ok florian
deraadt [Mon, 12 Oct 2015 18:32:18 +0000 (18:32 +0000)]
deprecate & remove -W option; ok florian

9 years agoReverse the sm_error call in sm_trap.
ajacoutot [Mon, 12 Oct 2015 18:25:16 +0000 (18:25 +0000)]
Reverse the sm_error call in sm_trap.

pointed out by semarie@... I need some sleep :/

9 years agoOnly remove existing sum files on trap handlers.
ajacoutot [Mon, 12 Oct 2015 18:13:59 +0000 (18:13 +0000)]
Only remove existing sum files on trap handlers.

req. by semarie@

9 years agoMake it clear that umask ignores everything but the rwx bits.
millert [Mon, 12 Oct 2015 17:51:55 +0000 (17:51 +0000)]
Make it clear that umask ignores everything but the rwx bits.
OK deraadt@

9 years agoMake wcrtomb() more readable by weeding out range errors up front,
schwarze [Mon, 12 Oct 2015 17:50:51 +0000 (17:50 +0000)]
Make wcrtomb() more readable by weeding out range errors up front,
doing ASCII handling once rather than twice, and using <= rather
than ((&~)==) obfuscation (which already caused a bug in the past).
No functional change.
Joint work with and OK stsp@ semarie@ bentley@

9 years agoParentheses are useless after "return", it's not a function.
schwarze [Mon, 12 Oct 2015 17:20:53 +0000 (17:20 +0000)]
Parentheses are useless after "return", it's not a function.
There is no need to mop this up everywhere, but at least style(9)
should show modern rather than historic style.
OK millert@ tedu@

9 years agoCall pledge(2) after initial getsockname(2) to avoid "inet" addition.
uebayasi [Mon, 12 Oct 2015 16:54:30 +0000 (16:54 +0000)]
Call pledge(2) after initial getsockname(2) to avoid "inet" addition.

From & OK deraadt@

9 years agoftp(1) was static for years, as a recovery seatbelt. These days
deraadt [Mon, 12 Oct 2015 16:39:07 +0000 (16:39 +0000)]
ftp(1) was static for years, as a recovery seatbelt.  These days
reliability has improved, and other repair methods are easier from
bsd.rd or whatnot.  As a static binary ftp has limited ASLR, yet it has
7 libraries...  Making it non-static means the ASLR picture improves.
Let's see who moans first.
ok miod daniel

9 years agokvm_mkdb & dev_mkdb are quite similar. pledge "stdio rpath wpath cpath"
deraadt [Mon, 12 Oct 2015 16:01:53 +0000 (16:01 +0000)]
kvm_mkdb & dev_mkdb are quite similar.  pledge "stdio rpath wpath cpath"
except kvm_mkdb also does "getpw".

9 years agopledge wasn't called pledge in 5.8, and it was disabled;
schwarze [Mon, 12 Oct 2015 15:59:26 +0000 (15:59 +0000)]
pledge wasn't called pledge in 5.8, and it was disabled;
issue noticed by tim@, solution suggested by deraadt@

9 years agopledge "stdio rpath wpath cpath"; all the path options are used
deraadt [Mon, 12 Oct 2015 15:56:58 +0000 (15:56 +0000)]
pledge "stdio rpath wpath cpath"; all the path options are used
until the bitter end.

9 years agoUse "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.
schwarze [Mon, 12 Oct 2015 15:27:53 +0000 (15:27 +0000)]
Use "-" rather than "\(hy" for the heads of .Bl -dash and -hyphen lists.
In UTF-8 output, that renders as ASCII HYPHEN-MINUS (U+002D)
rather than HYPHEN (U+2010), which looks better and matches groff.
In ASCII output, it makes no difference.
Suggested by naddy@.

9 years agoAnnotate an pretty obvious signal race... no time to fix it now.
deraadt [Mon, 12 Oct 2015 15:12:44 +0000 (15:12 +0000)]
Annotate an pretty obvious signal race... no time to fix it now.

9 years agoPledge "stdio wpath tty"; "awesome" deraadt@
tim [Mon, 12 Oct 2015 14:33:13 +0000 (14:33 +0000)]
Pledge "stdio wpath tty"; "awesome" deraadt@

9 years agoin fuser mode with -k or -s mode, kill(2) might be called and
deraadt [Mon, 12 Oct 2015 14:09:32 +0000 (14:09 +0000)]
in fuser mode with -k or -s mode, kill(2) might be called and
route lookups won't be needed; so expand the pledge setup to handle
3 codepaths.
from theo buehler

9 years agoreenable pledge(2) on pax, but only if pmode isn't in use or if action
semarie [Mon, 12 Oct 2015 14:01:06 +0000 (14:01 +0000)]
reenable pledge(2) on pax, but only if pmode isn't in use or if action
shouldn't do things with filesystem.

ok deraadt@ millert@

9 years agoThese no longer need to be static. The ramdisk's no longer reach-around
deraadt [Mon, 12 Oct 2015 13:53:40 +0000 (13:53 +0000)]
These no longer need to be static.  The ramdisk's no longer reach-around
and use the one in the base install, but have their own copy.
ok millert sthen miod daniel

9 years agothe pattr argument to IFQ_ENQUEUE is unused, so let's get rid of it.
dlg [Mon, 12 Oct 2015 13:17:58 +0000 (13:17 +0000)]
the pattr argument to IFQ_ENQUEUE is unused, so let's get rid of it.

also the comment above IFQ_ENQUEUE that says the pattr argument is unused.

ok mpi@

9 years agoFix a copy-pasto: Check the correct bit for STBC beacon in HT OP element.
stsp [Mon, 12 Oct 2015 13:01:50 +0000 (13:01 +0000)]
Fix a copy-pasto: Check the correct bit for STBC beacon in HT OP element.
ok sthen@

9 years agoindent the builtin text a little, for naddy;
jmc [Mon, 12 Oct 2015 12:34:42 +0000 (12:34 +0000)]
indent the builtin text a little, for naddy;

9 years agotwo leftovers string missed in tame->pledge conversion
semarie [Mon, 12 Oct 2015 12:17:36 +0000 (12:17 +0000)]
two leftovers string missed in tame->pledge conversion

ok jsg@

9 years agoUnify link state change notification.
mpi [Mon, 12 Oct 2015 11:32:39 +0000 (11:32 +0000)]
Unify link state change notification.

ok mikeb@

9 years agodont need to do suser checks in ioctl paths cos if.c does them for us.
dlg [Mon, 12 Oct 2015 10:51:49 +0000 (10:51 +0000)]
dont need to do suser checks in ioctl paths cos if.c does them for us.

ok mikeb@ mpi@

9 years agoprotect SIOCSLIFPHYTTL, SIOCSVNETID so only root can call them, and
dlg [Mon, 12 Oct 2015 10:49:40 +0000 (10:49 +0000)]
protect SIOCSLIFPHYTTL, SIOCSVNETID so only root can call them, and
return EPNOTSUPP for SIOCGLIFPHYTTL and SIOCGVNETID. all so drivers
dont have to do these checks themselves.

ok mikeb@ mpi@

9 years agofix case of PACkAGE_REPOSITORY; remco at dpub nl
sthen [Mon, 12 Oct 2015 10:27:22 +0000 (10:27 +0000)]
fix case of PACkAGE_REPOSITORY; remco at dpub nl
               ^

9 years agoIntroduce bridge_ifinput() to handle some repeated logic before
reyk [Mon, 12 Oct 2015 10:03:25 +0000 (10:03 +0000)]
Introduce bridge_ifinput() to handle some repeated logic before
if_input() and to have a counterpart for bridge_ifenqueue() that helps
to understand the traffic/code flow in bridge better.  The bridge
currently only puts a single packet on the input mbuf list, and
changing will need to undo part of this commit, but it still makes
sense to have a well-defined call for the ports receive path.
No functional change.

OK mpi@

9 years agoAlways initialise the index into iwm's tx queue array, fixing a
stsp [Mon, 12 Oct 2015 10:01:27 +0000 (10:01 +0000)]
Always initialise the index into iwm's tx queue array, fixing a
potential crash. This must have somehow been working by magic.
Fruther cleanup of QoS support in this driver is very much needed.
ok mpi@

9 years agoRevert the pledge() call on pax/ar_io.c for now.
semarie [Mon, 12 Oct 2015 09:28:54 +0000 (09:28 +0000)]
Revert the pledge() call on pax/ar_io.c for now.

A pledged program is not allowed to change user/group for others.

"I think that makes the most sense" @sthen

9 years agodo not umask() [with the wrong umask] around mkstemp() calls, no matter
deraadt [Mon, 12 Oct 2015 07:58:19 +0000 (07:58 +0000)]
do not umask() [with the wrong umask] around mkstemp() calls, no matter
how broken other systems are.
ok guenther gilles

9 years agoCorrectly mark-up some recent additions. ok jmc@
lum [Mon, 12 Oct 2015 07:55:52 +0000 (07:55 +0000)]
Correctly mark-up some recent additions. ok jmc@

9 years agopledge "stdio" after opening files, code is very similar to mkuboot
deraadt [Mon, 12 Oct 2015 07:45:48 +0000 (07:45 +0000)]
pledge "stdio" after opening files, code is very similar to mkuboot

9 years agoMove execution of the constraints from the ntp to the parent process.
reyk [Mon, 12 Oct 2015 06:50:08 +0000 (06:50 +0000)]
Move execution of the constraints from the ntp to the parent process.
This helps the ntp process to a) give a better pledge(2) and to b)
keep the promise of "saving the world again... on time" by removing
the delays that have been introduced by expensive constraint forks.
The new design offers better privsep but introduces a few more imsgs
and runs a little bit more code in the privileged parent.  The
privileged code is minimal, carefully checked, and does not attempt to
"parse" any contents; the forked constraints instantly drop all
privileges and pledge to "stdio inet".

OK beck@ deraadt@

9 years agoGahamas -> Bahamas;
jmc [Mon, 12 Oct 2015 06:33:21 +0000 (06:33 +0000)]
Gahamas -> Bahamas;
from pgoyette (netbsd -r1.26)

9 years agopledge "stdio" after opening up the input & output files.
deraadt [Mon, 12 Oct 2015 06:24:28 +0000 (06:24 +0000)]
pledge "stdio" after opening up the input & output files.
ok jsg

9 years agounifdef EVP_CHECK_DES_KEY: Ben Kaduk noticed it has a syntax error; that
guenther [Mon, 12 Oct 2015 06:05:52 +0000 (06:05 +0000)]
unifdef EVP_CHECK_DES_KEY: Ben Kaduk noticed it has a syntax error; that
error was present in the original 2004 commit, so it hasn't been used in
over 11 years, thus exceeding our deprecation requirements by over a decade.
OpenSSL has chosen to *fix it*; we'll gladly watch it burn

ok jsing@

9 years agosame thing as biff, pledge "stdio rpath fattr tty"
deraadt [Mon, 12 Oct 2015 06:00:57 +0000 (06:00 +0000)]
same thing as biff, pledge "stdio rpath fattr tty"

9 years agobiff pledges to only do "stdio rpath fattr tty". (very small program..
deraadt [Mon, 12 Oct 2015 05:59:43 +0000 (05:59 +0000)]
biff pledges to only do "stdio rpath fattr tty".  (very small program..
the actual order of use is tty, rpath, stdio or fattr)

9 years agofstat() of opened fd, rather than stat(), to avoid TOCTOU
deraadt [Mon, 12 Oct 2015 05:54:18 +0000 (05:54 +0000)]
fstat() of opened fd, rather than stat(), to avoid TOCTOU
ok jsg

9 years agopreservation modes can adjust setugid bits, so no pledge is possible.
deraadt [Mon, 12 Oct 2015 05:05:24 +0000 (05:05 +0000)]
preservation modes can adjust setugid bits, so no pledge is possible.
Otherwise, lay the groundwork for whether a gzip program may be run or not.
After such a gzip program is started, pledge the program will not exec
again.  Took a few iterations to get this going... it is looking good.
with guenther.

9 years agodoes not need ioctl.h
deraadt [Mon, 12 Oct 2015 04:43:30 +0000 (04:43 +0000)]
does not need ioctl.h

9 years agowith the RPATH enforcement, acpidump(1) don't work anymore...
semarie [Mon, 12 Oct 2015 04:02:57 +0000 (04:02 +0000)]
with the RPATH enforcement, acpidump(1) don't work anymore...

it needs rpath for reading /dev/mem (at least):
  kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL)

ok doug@
fix the regression deraadt@

9 years agopledge to only use "stdio rpath"; rpath is for readig the wtmp files.
deraadt [Mon, 12 Oct 2015 02:02:00 +0000 (02:02 +0000)]
pledge to only use "stdio rpath"; rpath is for readig the wtmp files.
ok doug

9 years agotunefs can pledge to only use "stdio", after it has opened the device.
deraadt [Mon, 12 Oct 2015 02:01:15 +0000 (02:01 +0000)]
tunefs can pledge to only use "stdio", after it has opened the device.
ok doug

9 years agopledge "stdio" right after opening the device. The remainder is
deraadt [Mon, 12 Oct 2015 01:43:52 +0000 (01:43 +0000)]
pledge "stdio" right after opening the device.  The remainder is
is just read, write, fsync, and close.
ok doug

9 years agopledge() "stdio" includes trusting open&read of the root-owned timezone
deraadt [Mon, 12 Oct 2015 01:40:09 +0000 (01:40 +0000)]
pledge() "stdio" includes trusting open&read of the root-owned timezone
databases located at system paths (a reasonable bar had to be chosen; in
the future we can replace the interfaces, since this effort is identifying
them and placing their paths in a visble place), so this program only
needs "stdio"
ok doug

9 years agomake description of ERRORS more complete;
schwarze [Mon, 12 Oct 2015 01:17:08 +0000 (01:17 +0000)]
make description of ERRORS more complete;
diff from Benny Lofgren <bl dash lists at lofgren dot biz>;
ok nicm@

9 years agoremove useless quoting from .Fo arguments; forgotten diff found in my tree
schwarze [Mon, 12 Oct 2015 00:49:34 +0000 (00:49 +0000)]
remove useless quoting from .Fo arguments; forgotten diff found in my tree

9 years agoClear dform and dsec when exiting a first-level directory in treescan().
schwarze [Mon, 12 Oct 2015 00:32:37 +0000 (00:32 +0000)]
Clear dform and dsec when exiting a first-level directory in treescan().
Fixes a segfault reported by bentley@.
While here, do some style cleanup in the same function.

9 years agoFix an obvious bug found during the /* FALLTHROUGH */ cleanup:
schwarze [Mon, 12 Oct 2015 00:14:41 +0000 (00:14 +0000)]
Fix an obvious bug found during the /* FALLTHROUGH */ cleanup:
ASCII_NBRSP has to be rendered as "&nbsp;", not "-".

9 years agoTo make the code more readable, delete 283 /* FALLTHROUGH */ comments
schwarze [Mon, 12 Oct 2015 00:07:27 +0000 (00:07 +0000)]
To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

9 years agoPass unsigned char to isdigit(3).
bluhm [Sun, 11 Oct 2015 23:51:26 +0000 (23:51 +0000)]
Pass unsigned char to isdigit(3).
From Michael McConville; OK guenther@

9 years agofix regression: ttyname() failure not handled right
deraadt [Sun, 11 Oct 2015 23:29:56 +0000 (23:29 +0000)]
fix regression: ttyname() failure not handled right

9 years agopledge_ioctl_check() will do the killing if neccessary; if it returns,
deraadt [Sun, 11 Oct 2015 23:13:02 +0000 (23:13 +0000)]
pledge_ioctl_check() will do the killing if neccessary; if it returns,
that is an errno to pass up to the calling system call instead. test
case is "who < /dev/null", via ttyname().

9 years agonow that tsort has a clean structure, do more specific pledge() calls.
espie [Sun, 11 Oct 2015 23:01:32 +0000 (23:01 +0000)]
now that tsort has a clean structure, do more specific pledge() calls.
okay deraadt@

9 years agoDrop tags containing a blank character:
schwarze [Sun, 11 Oct 2015 21:59:48 +0000 (21:59 +0000)]
Drop tags containing a blank character:
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.

9 years agoDo not insert whitespace into syntax displays, it's just confusing,
schwarze [Sun, 11 Oct 2015 21:30:02 +0000 (21:30 +0000)]
Do not insert whitespace into syntax displays, it's just confusing,
except at the one place where it is indeed helpful.
Add some missing .Cm macros.
Remove some useless escaping, one needless .Xo, and an empty .No.
Triggered by a much smaller patch from guenther@.
OK jmc@ guenther@

9 years agoFix empty .No macros, use .Pf to prefix delimiters to macros.
schwarze [Sun, 11 Oct 2015 21:23:24 +0000 (21:23 +0000)]
Fix empty .No macros, use .Pf to prefix delimiters to macros.
Based on a patch from guenther@, tweaked by me.
OK jmc@ guenther@

9 years ago-version options on commands like this make no sense; the version number
deraadt [Sun, 11 Oct 2015 21:23:15 +0000 (21:23 +0000)]
-version options on commands like this make no sense; the version number
makes no promises about compatibility nor the lack of compatibility.
suggestion & diff from micheal reed

9 years agoFinally use __progname, err(3) and warn(3).
schwarze [Sun, 11 Oct 2015 21:06:59 +0000 (21:06 +0000)]
Finally use __progname, err(3) and warn(3).
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.

9 years agoUserspace doesn't need to use SUN_LEN(): connect() and bind() must accept
guenther [Sun, 11 Oct 2015 20:23:49 +0000 (20:23 +0000)]
Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing.
Also convert some strncpy() to strlcpy()

ok deraadt@

9 years agoDon't return errno from main()
guenther [Sun, 11 Oct 2015 20:17:49 +0000 (20:17 +0000)]
Don't return errno from main()

ok beck@ doug@ deraadt@ tedu@

9 years agoHandle the blackhole well-known community in bgpctl as well (print it
sthen [Sun, 11 Oct 2015 19:53:57 +0000 (19:53 +0000)]
Handle the blackhole well-known community in bgpctl as well (print it
symbolically, and don't deny its use in 'bgpctl sh rib comm 65535:6666').
ok phessler@

9 years agostandardize a community that has been independently created by nearly
phessler [Sun, 11 Oct 2015 19:30:12 +0000 (19:30 +0000)]
standardize a community that has been independently created by nearly
every single AS on the planet: the blackhole

OK benno@, claudio@, sthen@

9 years agosome peers are following an expired draft RFC and are sending "unknown"
phessler [Sun, 11 Oct 2015 19:25:06 +0000 (19:25 +0000)]
some peers are following an expired draft RFC and are sending "unknown"
error codes to OPEN messages.  make them "known", and show them.

OK benno@, claudio@, sthen@

9 years agoadd "best" as an alias for "selected"
phessler [Sun, 11 Oct 2015 19:21:44 +0000 (19:21 +0000)]
add "best" as an alias for "selected"
Helps finger memory for people used to Junipers

OK benno@, claudio@

9 years agoPledge that ncheck_ffs only uses "stdio" after opening the device.
doug [Sun, 11 Oct 2015 19:00:40 +0000 (19:00 +0000)]
Pledge that ncheck_ffs only uses "stdio" after opening the device.

ok deraadt@

9 years agoMention that the first argument of .Pf does not need escaping.
schwarze [Sun, 11 Oct 2015 18:56:08 +0000 (18:56 +0000)]
Mention that the first argument of .Pf does not need escaping.
While here, make the first sentence regarding .Pf more concise.
OK jmc@

9 years agowith the RPATH enforcement, csplit(1) don't work anymore on stdin...
semarie [Sun, 11 Oct 2015 17:43:03 +0000 (17:43 +0000)]
with the RPATH enforcement, csplit(1) don't work anymore on stdin...

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@

9 years agoreorg code to have an array with all the files used apparent.
espie [Sun, 11 Oct 2015 17:39:50 +0000 (17:39 +0000)]
reorg code to have an array with all the files used apparent.
okay millert@

9 years agoadd a missed check for PLEDGE_RPATH when reading a file.
semarie [Sun, 11 Oct 2015 16:19:48 +0000 (16:19 +0000)]
add a missed check for PLEDGE_RPATH when reading a file.

ok deraadt@

9 years agosigaltstack is directly used by setjmp on some architectures. it only
deraadt [Sun, 11 Oct 2015 16:01:06 +0000 (16:01 +0000)]
sigaltstack is directly used by setjmp on some architectures. it only
refers to the process itself.  pledge should allow it.

9 years agoput TIOCSWINSZ in the right block "tty", not in "ioctl". this happened
deraadt [Sun, 11 Oct 2015 15:40:48 +0000 (15:40 +0000)]
put TIOCSWINSZ in the right block "tty", not in "ioctl".  this happened
because the "route' tests were placed between the two, creating
confusion.  fix that while here.

9 years agoneeds at least some include love; choosing <stdlib.h>
deraadt [Sun, 11 Oct 2015 15:36:58 +0000 (15:36 +0000)]
needs at least some include love; choosing <stdlib.h>

9 years agopledge "stdio tty" works once the kernel allows TIOCGWINSZ. Do the pledge
deraadt [Sun, 11 Oct 2015 15:27:19 +0000 (15:27 +0000)]
pledge "stdio tty" works once the kernel allows TIOCGWINSZ.  Do the pledge
after TIOCGETD, which the kernel is unlikely to support (does not feel like
a good idea for a program to switch line disc, and therefor not worth allowing
the program to ask either)

9 years agoIn pledge "tty", allow TIOCSWINSZ. stty(1) is the obvious silly use.
deraadt [Sun, 11 Oct 2015 15:25:39 +0000 (15:25 +0000)]
In pledge "tty", allow TIOCSWINSZ.  stty(1) is the obvious silly use.
The more important use will be tmux(1) and other active window size
controlling programs. There seems little risk in exposing this small
tty setting alongside the tcsetattr() family.
ok millert