Re: ksh "clear-screen" editing command

2018-06-17 Thread Todd C. Miller
On Sun, 17 Jun 2018 17:29:31 +0200, Mark Kettenis wrote: > If folks indeed think that this is a must-have feature, this is > certainly a better approach. I wonder though if the setupterm() call > should happen earlier when interactive mode is initialized? This turns out to be simpler than

Re: make process.ps_start an uptime instead of a realtime

2018-06-05 Thread Todd C. Miller
On Tue, 05 Jun 2018 16:30:14 -0500, Scott Cheloha wrote: > Because the system clock can jump around, process start times > should be recorded as offsets from boot and only converted to > a time of day on request. > > This keeps ps(1)'s etime accurate and ensures processes are > correctly sorted

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-02 Thread Todd C. Miller
On Tue, 01 May 2018 13:35:54 -0600, "Theo de Raadt" wrote: > > b) Their working space should be independent of each other. This > > isn't hard, just splitting kd->argbuf into kd->argbuf and > > kd->envbuf. Seems a bit saner. > > > > I think (b) would be the better solution, this seems

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Todd C. Miller
On Thu, 03 May 2018 13:58:35 +0300, Vadim Zhukov wrote: > Here is patch for libkvm that fixes a few memory handling problems. > Most changes are mechanical, with some exceptions: > > 1. Most notable: this splits argv buffer into argv-specific one > and environ-specific one. This makes ps

Re: libkvm requires kvm_getargv before kvm_getenv when both needed

2018-05-03 Thread Todd C. Miller
On Thu, 03 May 2018 17:59:39 +0200, Otto Moerbeek wrote: > Yes, looks good from reading. But all te extra checks before calling > free can go. That's idiom from a *long* time ago. There is more cleanup that can be done in this code. For example, the use of 0 instead of NULL. But that can be a

Re: close cron sockets in child processes

2017-10-20 Thread Todd C. Miller
On Fri, 20 Oct 2017 16:25:32 +0200, Florian Riehm wrote: > cron(8) opens /var/run/cron.sock for communication with crontab(1). > The forked cronjobs have the socked still open. > This prevents restarting cron while a job is running: > (CRON) DEATH (already running) > > I think cron's children

Re: close cron sockets in child processes

2017-10-23 Thread Todd C. Miller
On Mon, 23 Oct 2017 17:27:15 +0200, Jeremie Courreges-Anglas wrote: > Here it is. Liberal use of O_CLOEXEC except for poke_daemon() which is > more obvious (but I can add it there too if you prefer). cronSock > already uses SOCK_CLOEXEC. You can't set O_CLOEXEC for the fd in atrun.c as that

ksh: fix sign compare warnings

2017-12-27 Thread Todd C. Miller
Add WARNINGS=yes to ksh and fix the resulting sign compare warnings. Still passes regress. Note that gcc is pickier than clang in this respect as it requires a matching sign for ternary operations. I tried to limit the use of casts. - todd Index: Makefile

init(8): unifdef LOGIN_CAP

2018-01-06 Thread Todd C. Miller
There's no need for a compile-time knob to control the use of login.conf. - todd Index: sbin/init/Makefile === RCS file: /cvs/src/sbin/init/Makefile,v retrieving revision 1.9 diff -u -p -u -r1.9 Makefile --- sbin/init/Makefile 25

ksh: add missing bounds check in kb_add

2018-01-06 Thread Todd C. Miller
kb_add() counts the number of arguments passed via stdargs. This would make sense if the buffer was allocated dynamically but it is not. As such, there's no need to loop over the arguments twice. Also, the loop that fills in the line buffer (l) doesn't ensure that we stay within the bounds of

Re: realpath(3): some buffer overflows and conformance issues

2017-12-23 Thread Todd C. Miller
Here's a diff for libc and ld.so without the asserts. - todd Index: lib/libc/stdlib/realpath.c === RCS file: /cvs/src/lib/libc/stdlib/realpath.c,v retrieving revision 1.21 diff -u -p -u -r1.21 realpath.c ---

ksh: remove unused param from kb_add()

2018-01-07 Thread Todd C. Miller
In kb_add(), the args parameter is always NULL. Noticed by anton@ - todd Index: bin/ksh/emacs.c === RCS file: /cvs/src/bin/ksh/emacs.c,v retrieving revision 1.81 diff -u -p -u -r1.81 emacs.c --- bin/ksh/emacs.c 7 Jan 2018

Re: mg: extract child status with WEXITSTATUS

2018-01-09 Thread Todd C. Miller
On Tue, 09 Jan 2018 10:05:22 -0600, Scott Cheloha wrote: > After discussing it with jca@ and trying a few variations I've settled > on the attached diff. > > We indicate if sh(1) was signalled because we have that information at > hand. Otherwise we report the exit status as we always have.

Re: ksh: add missing bounds check in kb_add

2018-01-06 Thread Todd C. Miller
On Sat, 06 Jan 2018 13:25:37 -0700, "Todd C. Miller" wrote: > kb_add() counts the number of arguments passed via stdargs. > This would make sense if the buffer was allocated dynamically > but it is not. As such, there's no need to loop over the > arguments twice. > &g

Re: ksh: Fix compilation without job control

2018-01-05 Thread Todd C. Miller
On Fri, 05 Jan 2018 16:15:45 +0100, Jeremie Courreges-Anglas wrote: > Cool, here's the diff. unifdef gives me the same result on jobs.c, > except for the indentation change in two conditionals. ok? OK millert@ - todd

Re: Basic SHA3 support

2018-01-11 Thread Todd C. Miller
On Wed, 10 Jan 2018 22:06:37 +, Christian Weisgerber wrote: > I've had something like this on my to-do list for some time and > eventually dropped it because I couldn't think of a compelling use > case. > > "Maybe Skip SHA-3" > https://www.imperialviolet.org/2017/05/31/skipsha3.html That

Re: ksh: Fix compilation without job control

2018-01-05 Thread Todd C. Miller
On Fri, 05 Jan 2018 08:20:03 +0100, Jeremie Courreges-Anglas wrote: > I kinda take job control in my shell for granted. Todd, would it make > sense to just delete the #ifdefs? I doubt that we'll want to ship a ksh > with no job control in space-constrained installers. I don't see any reason to

Re: Basic SHA3 support

2018-01-10 Thread Todd C. Miller
On Wed, 10 Jan 2018 15:59:30 +0100, Jeremie Courreges-Anglas wrote: > Do we really want these? For SHA-2, sha256 and sha512 are enough IMHO. Does anyone actually use the sha512 command? I'd be fine with retiring the sha512 link and adding a sha3-256 one. - todd

Re: Basic SHA3 support

2018-01-09 Thread Todd C. Miller
On Tue, 09 Jan 2018 16:47:18 +0100, Daniel Loebenberger wrote: > Changes have been made to libc, and a suite of sha3 checksum tools > were added (sha3-224, sha3-256, sha3-384, sha-512), extending the > existing md5(1) checksum tool. > > The SHA3 implementation itself was taken from the reference

Re: jot: allow %F conversion?

2018-01-13 Thread Todd C. Miller
On Sat, 13 Jan 2018 09:28:42 +0100, Theo Buehler wrote: > while 'jot -w '%f' 11 0 1' works just fine. Granted, jot isn't going to > print inf or nan, so there is no visible difference between '%f' and > '%F', but the above command seems perfectly legitimate to me. I see no reason to disallow

Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote: > so, here is 4.1.19. I haven't gotten around to reading the diff yet. > But I tossed it in production. > > When trying to re-gen config.h.in autheader bombs out: > > [florian@openbsd-build:/usr/src/usr.sbin/nsd]$ autoheader-2.69 >

Re: nsd 4.1.19

2018-01-12 Thread Todd C. Miller
On Fri, 12 Jan 2018 18:20:58 +0100, Florian Obser wrote: > so, here is 4.1.19. I haven't gotten around to reading the diff yet. > But I tossed it in production. So far so good here. A note to others, you'll need to "make cleandir" in /usr/src/usr.sbin/nsd (or just remove /usr/obj/usr.sbin/nsd)

Re: init(8): check GETTY_SPACING against monotonic clock

2018-01-30 Thread Todd C. Miller
On Mon, 29 Jan 2018 19:32:05 -0600, Scott Cheloha wrote: > This ensures that the GETTY_SPACING check remains useful if > the system clock is set backwards. > > The time comparison is meaningless unless the timespec is set, > so there's no reason to go to the kernel to get the time unless > we

Re: syslog.conf(5): example about logging by sender

2018-02-01 Thread Todd C. Miller
OK millert@ for that version. - todd

Re: on-line kernel debugging

2018-01-27 Thread Todd C. Miller
On Sat, 27 Jan 2018 20:46:18 +0330, bijan wrote: > does OpenBSD support on-line kernel debugging as FreeBSD does[1]? Yes, see the ddb(4) manual page. - todd

Re: syslog.conf(5): example about logging by sender

2018-01-31 Thread Todd C. Miller
On Wed, 31 Jan 2018 20:44:10 +0100, Landry Breuil wrote: > the default etc/syslog.conf has a commented out example for by-prog > logging, but nothing for by-host logging. I fighted a bit with it; so > why not providing an example in the EXAMPLES section of the manpage ? I recently did the same

Re: syslog.conf(5): example about logging by sender

2018-01-31 Thread Todd C. Miller
On Thu, 01 Feb 2018 01:55:18 +0200, Kapetanakis Giannis wrote: > On 01/02/18 00:06, Todd C. Miller wrote: > > > > Shouldn't this be: > > > > # Log everything coming from host bastion to a separate file > > ++bastion /var/l

Re: cron: don't close crontab_fd twice

2018-02-04 Thread Todd C. Miller
On Mon, 05 Feb 2018 09:21:32 +1300, Theo Buehler wrote: > The load_user() function gets a file descriptor from process_crontab(). > It fdopen()s it directly and fclose()s the resulting stream. Then > process_crontab() closes the stream a second time before exiting. > > Since crontab_fd is not

Re: hostapd: normalize microsecond limit when parsing

2018-02-12 Thread Todd C. Miller
On Mon, 12 Feb 2018 10:08:25 -0600, Scott Cheloha wrote: > I'm unfamiliar with this code, but assigning the microsecond value > without normalizing it for the timeval looks off. That makes sense. There's nothing preventing the user from using values > 100. OK millert@ - todd

Re: date: atoll - > strtonum

2018-02-12 Thread Todd C. Miller
OK millert@ - todd

Re: rename arm64 memhook

2018-02-17 Thread Todd C. Miller
On Sat, 17 Feb 2018 20:10:45 +0100, Mark Kettenis wrote: > Not that vmmap is a much better name, but that's what we use on other > non-pmap-direct architectures. Consistency is good, OK millert@ - todd

Re: shutdown: fork+exec for wall(1) broadcasts

2018-02-22 Thread Todd C. Miller
On Thu, 22 Feb 2018 13:50:13 -0600, Scott Cheloha wrote: > I think setjmping from a signal handler to put a time limit on > pclose is too magical, especially when the alternative doesn't > require much more code. Agreed. > But I do think putting a time limit on our wait for wall to do its > job

Re: shutdown: fork+exec for wall(1) broadcasts

2018-02-22 Thread Todd C. Miller
On Thu, 22 Feb 2018 15:06:04 -0600, Scott Cheloha wrote: > Could that difference effect the behavior of the program in practice? I don't think so. > Attached diff is using the file stream functions still, for comparison. > > But the dprintf diff feels more natural; keeping the stream functions

Re: ksh: fix sign compare warnings

2017-12-28 Thread Todd C. Miller
On Wed, 27 Dec 2017 07:02:50 -0700, "Todd C. Miller" wrote: > Add WARNINGS=yes to ksh and fix the resulting sign compare warnings. > Still passes regress. Note that gcc is pickier than clang in this > respect as it requires a matching sign for ternary operations. > >

ksh: fix warnings produced by -Wshadow

2017-12-26 Thread Todd C. Miller
I was investigating what is needed to add WARNINGS=Yes to ksh's Makefile. There are a lot of shadowed variable warnings. Some are easy to fix, others are due to poorly chosen global variable names. Specifically, "options" and "path". I've renamed "options" to "sh_options" since it holds the

ksh: replace test_stat() with stat()

2017-12-26 Thread Todd C. Miller
We removed the hack for /dev/fd support on systems without it a long time ago. Update the comments and replace test_stat() calls with stat() since test_stat() now just calls stat() directly. Also rename the "mode" parameter to "amode" in test_eaccess() to match access(2) and make it clear that

Re: mg: extract child status with WEXITSTATUS

2018-01-01 Thread Todd C. Miller
On Mon, 01 Jan 2018 19:54:07 -0600, Scott Cheloha wrote: > Hey, > > In the mg(1) *compile* buffer, currently you get incorrect > output like: > > Command exited abnormally with code 256 at [...] > > Using the W* macros in corrects this: > > Command exited abnormally with code 1 at

Re: realpath(3): some buffer overflows and conformance issues

2017-12-22 Thread Todd C. Miller
On Fri, 22 Dec 2017 12:08:58 +0100, =?UTF-8?Q?Jan_Kokem=c3=bcller?= wrote: > I've found some buffer overflows in realpath(3). They are limited to > just two bytes though (one after the 'left' buffer and one before > 'symlink'), so the impact is minimal. > > Similar bugs in FreeBSD: >

Re: [1/3] acme-client - correct error message in parse.y

2018-08-03 Thread Todd C. Miller
On Fri, 03 Aug 2018 22:20:47 +1000, Ross L Richardson wrote: > [Previously submitted large diff now being sent in three more-readily > digestible pieces...] These all look fine to me, though I'm unusure how important the style fixes are. It may make merging changes from upstream more difficult

Re: nologin(8): write -> dprintf

2018-08-15 Thread Todd C. Miller
On Wed, 15 Aug 2018 09:27:24 -0500, Scott Cheloha wrote: > Use dprintf for the DEFAULT_MESG string instead of the more awkward > write+strlen combo. I don't object to this but I also wouldn't object to rewriting nologin.c to use stdio. - todd

Re: Remove dead assignment in login(1)

2018-08-07 Thread Todd C. Miller
On Tue, 07 Aug 2018 17:15:58 +0200, Frederic Cambus wrote: > Since rev 1.36, the instance variable is never read again so we can > simply drop the else clause with the assignment. OK millert@ - todd

Re: poll.2: don't encourage use as sleep

2018-08-17 Thread Todd C. Miller
On Fri, 17 Aug 2018 10:20:09 -0500, Scott Cheloha wrote: > I don't think we should encourage or even mention the possibility of the > use of poll(2) to effect millisecond timeouts. Even if the standard library > lacks such an interface. > > I'm pretty sure you can't use this hack portably,

Re: [patch] uvm_mmap / little change proposal

2018-08-21 Thread Todd C. Miller
On Tue, 21 Aug 2018 08:57:06 +0100, David CARLIER wrote: > For portability sake and to make it more "visible" I changed the > __MAP_NOREPLACE to MAP_EXCL, documented it in the man page and also > changed the errno to EEXIST instead (I thought it would reflect > better the error in case the

Re: drop getpw promise from pwd_mkdb(8)

2018-08-23 Thread Todd C. Miller
On Thu, 23 Aug 2018 10:43:21 +0100, Ricardo Mestre wrote: > After pledge(2) is called there are no getpw* associated functions that > get called so we can drop the promise. > > Although we manipulate files associated with getpw all the remaining > code is kept happy with "rpath wpath cpath fattr

Re: point to glob in section 7 not 3 for various base tools

2018-07-20 Thread Todd C. Miller
On Fri, 20 Jul 2018 14:10:09 +0200, Klemens Nanni wrote: > Looking at which programs use and document globbing patterns, it seems > odd that some manuals point at glob's C API in the "Library functions" > sections instead of the list of special characters in the > "Miscellaneous information"

Re: join(1): use getline instead of fgetln

2018-07-17 Thread Todd C. Miller
On Tue, 17 Jul 2018 19:39:16 +0300, Lauri Tirkkonen wrote: > while porting join(1) to Unleashed OS (which does not have fgetln(3)) I > came up with the following. Since the fgetln man page advises against > using it, I thought OpenBSD might want this diff too. Looks good. One minor comment

Re: join(1): use getline instead of fgetln

2018-07-17 Thread Todd C. Miller
On Tue, 17 Jul 2018 13:21:31 -0600, "Todd C. Miller" wrote: > It probably makes more sense to do the newline check (and decrement > len if one is present) before newsize is computed. Then you would > need to unconditionally NUL-terminate lp->line. Perhaps something like

Re: join(1): use getline instead of fgetln

2018-07-18 Thread Todd C. Miller
On Wed, 18 Jul 2018 19:07:21 +0200, Ingo Schwarze wrote: > I think it's more elegant to just break; when getline() returns -1, > you already have the free() at the end: > > if ((len = getline(, , F->fp)) == -1) > break; > > But you get to choose the colour of the bikeshed, OK

Re: newaliases.8: update to current reality

2018-07-16 Thread Todd C. Miller
On Mon, 16 Jul 2018 17:54:17 +0100, Jason McIntyre wrote: > > === > > RCS file: /cvs/src/usr.sbin/smtpd/newaliases.8,v > > retrieving revision 1.11 > > diff -u -p -u -r1.11 newaliases.8 > > --- usr.sbin/smtpd/newaliases.8 22 Dec

newaliases.8: update to current reality

2018-07-16 Thread Todd C. Miller
Now that aliases in smtpd.conf default to plain text files and not db files we don't want to tell people to run makemap instead of newaliases. - todd Index: usr.sbin/smtpd/newaliases.8 === RCS file:

Re: dd(1): don't cast malloc(3) size to u_int

2018-07-21 Thread Todd C. Miller
On Fri, 20 Jul 2018 18:51:33 -0500, Scott Cheloha wrote: > The block sizes sum to 1 when cast and malloc(3) breaks us off a byte. > read(2) then sees that it would be writing outside the valid address > space and fails. OK millert@ for the fix. > Maybe pedantic, but should we also be checking

Re: syslogd remove was_initialized

2018-08-31 Thread Todd C. Miller
On Fri, 31 Aug 2018 20:14:19 +0200, Alexander Bluhm wrote: > I don't understand why we should reset Initialized during syslogd > die(). It looks like it was needed when we had real signal handlers. > But we have switched to libevent for a long time. I agree, this is a relic from the

Re: relayd close 0

2018-09-01 Thread Todd C. Miller
On Sat, 01 Sep 2018 00:20:15 +0200, Alexander Bluhm wrote: > Accidentally relayd(8) closes file descriptor 0 in the pfe child > process. Usually this is a bad idea. > > snmp_init() does this: > > if (env->sc_snmp != -1) { > ... > close(env->sc_snmp); >

Re: syslogd log rotate documentation

2018-09-01 Thread Todd C. Miller
On Sat, 01 Sep 2018 11:58:25 +0200, Ingo Schwarze wrote: > When starting up, > .Nm > reads its configuration file, > .Xr syslogd.conf 5 , > and opens the configured logfiles and TCP and TLS connections. > The configured logfiles already have to exist > with the correct permissions. > When

Re: md5: convert from fgetln(3) to getline(3)

2018-09-05 Thread Todd C. Miller
On Thu, 23 Aug 2018 11:24:54 -0500, Scott Cheloha wrote: > On Tue, Aug 14, 2018 at 03:11:47PM -0500, Scott Cheloha wrote: > > This patch is ok cheloha@ and I can commit if someone else > > is ok, too. > > 1 week bump. Anyone else ok? OK millert@ - todd

add uid_from_user/gid_from_group [2/3]

2018-09-10 Thread Todd C. Miller
This removes cache.c from pax in favor of using the new uid_from_user() and gid_from_group() functions in libc. I've added explicit calls to setpassent() and setgroupent() since they are no longer implicitly called. - todd Index: bin/pax/Makefile

add uid_from_user/gid_from_group [1/3]

2018-09-10 Thread Todd C. Miller
This is a port of uid_from_user() and gid_from_group() from NetBSD (also present in FreeBSD). I did not port the pwcache_userdb() and pwcache_groupdb() functions which we have no use for. This is basically just the contents pax's cache.c moved to libc. It replaces the existing pwcache.c

add uid_from_user/gid_from_group [3/3]

2018-09-10 Thread Todd C. Miller
This diff replaces calls to getpwuid/getgrgid with uid_from_user/gid_from_group and fixes warnings caused by the user_from_uid/group_from_gid return value change to const char *. I've also changed some getpwnam/getgrnam to user_from_uid/group_from_gid where it makes sense. If desired, I can

Re: typos in unveil(2)

2018-07-13 Thread Todd C. Miller
On Fri, 13 Jul 2018 13:00:59 +0100, Ricardo Mestre wrote: > This one looks better OK millert@ - todd

awk: better support for \v and \a escapes

2018-01-23 Thread Todd C. Miller
POSIX says awk supports \v and \a escapes but ours does not. I used \007 for BEL since that is what awk's lex.c uses, though we could safely use '\a' there instead. See http://mm.icann.org/pipermail/tz/2018-January/025932.html for context. - todd Index: usr.bin/awk/b.c

Re: times(3): return monotonically increasing values

2018-02-27 Thread Todd C. Miller
On Mon, 26 Feb 2018 19:12:20 -0600, Scott Cheloha wrote: > Reading the latest POSIX description for times(3): > > > Upon successful completion, times() shall return the elapsed > > real time, in clock ticks, since an arbitrary point in the past > > (for example, system start-up time). This point

Re: binutils: build with LLVM 6.0.0

2018-03-15 Thread Todd C. Miller
On Thu, 15 Mar 2018 17:23:24 +0100, Patrick Wildt wrote: > diff --git a/gnu/usr.bin/binutils-2.17/include/obstack.h b/gnu/usr.bin/binuti > ls-2.17/include/obstack.h > index 88c2a264adc..8839c48e95f 100644 > --- a/gnu/usr.bin/binutils-2.17/include/obstack.h > +++

Re: video(1): don't use optarg as format string

2018-04-09 Thread Todd C. Miller
On Mon, 09 Apr 2018 11:56:46 -0500, Scott Cheloha wrote: > Always nifty: > > $ video -f '%d%d%d' > video: 31668978116843009-2139062144: No such file or directory > > So, use strlcpy and check for truncation. > > ok? OK millert@ - todd

Re: ksh: count $SECONDS with monotonic clock

2018-04-13 Thread Todd C. Miller
On Fri, 13 Apr 2018 11:11:04 -0500, Scott Cheloha wrote: > So that $SECONDS advances uniformly, independent of the system clock. Why are you including sys/time.h? For struct timespect you only need time.h which is already included. In general, you only need sys/time.h for struct timeval or for

Re: ksh: count $SECONDS with monotonic clock

2018-04-13 Thread Todd C. Miller
On Fri, 13 Apr 2018 19:42:51 +0200, Jeremie Courreges-Anglas wrote: > The diff uses timespecsub: Ah, OK. That's fine then. - todd

Re: patch(1): remove unused header

2018-04-07 Thread Todd C. Miller
On Sat, 07 Apr 2018 10:46:01 +0200, Anton Lindqvist wrote: > Since patch(1) no longer invokes ed(1), pathnames.h can be removed. > _PATH_TMP is still used inside patch.c but including paths.h is > sufficient. OK millert@ - todd

Re: fuse_opt.h and clang 6

2018-04-07 Thread Todd C. Miller
On Sat, 07 Apr 2018 21:33:24 +0200, Jeremie Courreges-Anglas wrote: > At least ports/archivers/fuse-zip fails to build with clang 6, because > of stricter diagnostics: > > -->8-- > c++ -c -O2 -pipe-I/usr/local/include main.cpp \ > -Ilib \ > -o main.o > main.cpp:138:5: error: constant

Re: FREF(9) in unp_internalize()

2018-04-17 Thread Todd C. Miller
On Tue, 17 Apr 2018 09:50:49 +0200, Martin Pieuchot wrote: > Sure, here's an updated diff. It also moves the FRELE(9) in the error > loop down as suggested by visa@. OK millert@ - todd

Re: FREF(9) in unp_internalize()

2018-04-16 Thread Todd C. Miller
On Mon, 16 Apr 2018 10:19:40 +0200, Martin Pieuchot wrote: > Diff below does FREF(9) earlier instead of incrementing `f_count' by hand. > > The error path is also updated to call FRELE(9) accordingly. Wouldn't it be less error prone to simply add: if (fp != NULL)

Re: dd(1): snprintf+writev -> dprintf

2018-04-02 Thread Todd C. Miller
On Sat, 31 Mar 2018 12:53:52 -0500, Scott Cheloha wrote: > Simpler. OK millert@ - todd

Re: Earlier FREF()s

2018-04-02 Thread Todd C. Miller
On Mon, 02 Apr 2018 12:34:27 +0200, Martin Pieuchot wrote: > Here's a diff to move FREF() just after fd_getfile() in sys_kevent(), > sys_lseek() and getvnode(). Looks fine. OK millert@ - todd

Re: dd(1): snprintf+writev -> dprintf

2018-04-02 Thread Todd C. Miller
On Mon, 02 Apr 2018 10:40:15 -0500, Scott Cheloha wrote: > What do you think about the signal race mentioned here: > > https://marc.info/?l=openbsd-tech=152260519904692=2 > > deraadt pointed out that blocking SIGINT while SIGINFO is in summary() > has the effect of making the process un-INTable

Re: Single FRELE() in sys_fstatfs()

2018-04-02 Thread Todd C. Miller
On Mon, 02 Apr 2018 12:51:06 +0200, Martin Pieuchot wrote: > I'd like to ease reviews of the FREF()/FRELE() dances by keeping their > number small. In the case of sys_fstatfs() it's easy to have a single > FRELE() for the corresponding getvnode(). Ok? I actually find the original easier to

Re: dd(1): snprintf+writev -> dprintf

2018-04-02 Thread Todd C. Miller
On Sat, 31 Mar 2018 13:41:00 -0600, "Theo de Raadt" wrote: > Let's see. SIGINFO starts. Imagine if the buffering is small (I > don't think it is). If it was small, there could be multiple writes > to the sequence. SIGINT arrives. This will result in stderr output > being a bit garbled. This

Re: mfs free

2018-04-02 Thread Todd C. Miller
On Sat, 31 Mar 2018 15:15:34 -0400, David Hill wrote: > Add the free size. (allocated in mfs_vfsops.c) > > mfsp = malloc(sizeof *mfsp, M_MFSNODE, M_WAITOK | M_ZERO); > devvp->v_data = mfsp; OK millert@ - todd

Re: plug a memory leak in diff(1)

2018-04-02 Thread Todd C. Miller
On Mon, 02 Apr 2018 21:17:59 +0200, Ingo Schwarze wrote: > * if (a <= b) for (i = a; i <= b; >doas not make sense to me. >If a > b, we have i > b right away, so the loop isn't entered. > * a > b || >does not make sense either, for the same reason: >The for loop itself takes care

Re: netinet memcpy/free

2018-04-02 Thread Todd C. Miller
On Sat, 31 Mar 2018 15:13:03 -0400, David Hill wrote: > memcpy can be used on freshly allocated memory. Fill in the free size > for it. OK millert@ - todd

Re: shutdown(8): disallow "++minutes"

2018-03-16 Thread Todd C. Miller
On Fri, 16 Mar 2018 14:23:29 -0500, Scott Cheloha wrote: > Because we increment the timearg pointer, shutdown(8) accepts > stuff like > > shutdown ++10 > > as strtonum(3) allows a single leading '+'. > > Not incrementing leaves the offset in a valid format for strtonum(3) > and disallows

Re: times(3): return monotonically increasing values

2018-02-28 Thread Todd C. Miller
On Wed, 28 Feb 2018 09:46:30 -0600, Scott Cheloha wrote: > I want to avoid giving the reader even the slightest impression that > the return value from times(3) can be used for anything but real-time > interval measurement. Mentioning that the value is relative to the > system start time seems

Re: times(3): return monotonically increasing values

2018-02-28 Thread Todd C. Miller
On Wed, 28 Feb 2018 10:23:24 -0600, Scott Cheloha wrote: > I know it's not customary to put extra details in RETURN VALUES, but > times(3) is a bit unwieldy. How does the attached read? OK by me. - todd

Re: sasyncd: remove redundant memset() call

2018-06-24 Thread Todd C. Miller
On Sun, 24 Jun 2018 01:50:49 -0300, Gleydson Soares wrote: > calloc() already filled all the memory block to 0, zap memset(). OK millert@ - todd

Re: odd condition/test in PF lexer

2018-10-05 Thread Todd C. Miller
On Fri, 05 Oct 2018 00:37:33 +0200, Alexandr Nedvedicky wrote: > because earlier line at 5279 grants the variable c holds backslash, > therefore it can't contain space or tab. The simple change is tempting, > but let's check the history first. That particular line has been > introduced 10+ years

Re: locate.mklocatedb broken with LC_ALL!=C

2018-10-07 Thread Todd C. Miller
On Sun, 07 Oct 2018 17:08:06 +0200, Marc Espie wrote: > Specifically, the only part that cares about > locale is sort, and it's definitely correct in fixing > it's not run on an utf-8 file. Agreed. How about the following? - todd Index: usr.bin/locate/locate/mklocatedb.sh

Re: user mod -u lead to segfault

2018-10-14 Thread Todd C. Miller
On Sat, 13 Oct 2018 21:16:10 -0600, "Todd C. Miller" wrote: > I think it is safest to use user_from_uid, uid_from_user, group_from_gid > and gid_from_group in all places where the return value of getpw* > and getgr* is unused. Updated diff that adds wrapper functions for i

Re: user mod -u lead to segfault

2018-10-13 Thread Todd C. Miller
On Sat, 13 Oct 2018 16:57:46 +0200, Moritz Buhl wrote: > I belief this is due to the changes to getpwnam etc. > Sadly I am unable to figure out, why exactly the call to getpwuid > segfaults. But replacing it with a call to user_from_uid helped. > I could not crash the program with other flags

Re: unveil spamlogd

2018-10-24 Thread Todd C. Miller
On Wed, 24 Oct 2018 08:05:11 +0100, Ricardo Mestre wrote: > The only file that spamlogd needs to access after calling pledge is > PATH_SPAMD_DB, so unveil it with O_RDWR permissions. Looks good. OK millert@ - todd

Re: odd condition/test in PF lexer

2018-10-29 Thread Todd C. Miller
OK millert@ - todd

Re: top: merge duplicate code into helper functions

2018-11-01 Thread Todd C. Miller
On Wed, 31 Oct 2018 23:38:58 +0100, Klemens Nanni wrote: > New diff free of side-effects in filteruser(), rest unchanged. OK millert@ - todd

Re: top: merge duplicate code into helper functions

2018-10-30 Thread Todd C. Miller
On Tue, 30 Oct 2018 21:09:29 +0100, Klemens Nanni wrote: > This introduces filteruser() and filterpid(), where the first one can > now easily be extended to support matching numeric UIDs. The latter one > is now used by the `highlight` command as well. I really dislike the side-effect in

Re: unveil getconf

2018-10-25 Thread Todd C. Miller
On Thu, 25 Oct 2018 11:19:34 +0100, Ricardo Mestre wrote: > The code path were we pass `pathname' in the arguments is already limited > with pledge(2), but since we know exactly what it is then we can go further > and also unveil(2) it with read permissions. OK millert@ - todd

Re: /bin/df align inode output

2018-10-25 Thread Todd C. Miller
With your patch the mount point is offset by a space from the "Mounted on" header. - todd

Re: top: accept UIDs

2018-11-01 Thread Todd C. Miller
On Thu, 01 Nov 2018 21:04:03 +0100, Klemens Nanni wrote: > Here's a diff that tries UIDs only if username lookup fails. OK millert@ - todd

Re: getent: prefer usernames over UIDs

2018-11-01 Thread Todd C. Miller
On Fri, 02 Nov 2018 00:45:06 +0100, Klemens Nanni wrote: > On Thu, Nov 01, 2018 at 06:37:15PM -0400, Ted Unangst wrote: > > yes, this is how it should be. please fix group lookup as well. > Was in the queue for a separate diff, here it goes together. Looks good. OK millert@ - todd

Re: lockf: consistent use of new debug macro

2018-11-11 Thread Todd C. Miller
On Sat, 10 Nov 2018 18:43:11 +0100, Anton Lindqvist wrote: > Make use of the new LFPRINT() debug macro. OK millert@ - todd

Re: ifconfig: remove unreachable strlcpy error checks

2018-11-14 Thread Todd C. Miller
Are you sure these checks cannot be hit? For example: % ifconfig lo0 group jkhaksudhkashdkashdkahdksahdkjhakjshdaksjhd ifconfig: setifgroup: group name too long sure looks like the check gets triggered. - todd

Re: ktrace: struct flock

2018-11-06 Thread Todd C. Miller
On Mon, 05 Nov 2018 08:12:57 +0100, Anton Lindqvist wrote: > Start tracing struct flock. I've been using this diff during lockf > development. OK millert@ - todd

Re: SEGV was occurred in libedit

2018-10-09 Thread Todd C. Miller
On Wed, 10 Oct 2018 08:00:14 +0900, Masato Asou wrote: > diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c > index f2d001d67cb..5f2d607d356 100644 > --- a/lib/libedit/refresh.c > +++ b/lib/libedit/refresh.c > @@ -1061,6 +1061,7 @@ re_fastputc(EditLine *el, wint_t c) > >

Re: pkill.1: clarify that patterns are EREs

2018-08-31 Thread Todd C. Miller
On Fri, 31 Aug 2018 17:12:50 +0200, Christian Weisgerber wrote: > In the pkill man page, clarify that the patterns are EXTENDED regular > expressions. I shouldn't have to guess, try, or look at the source > for this. OK millert@ - todd

csh: avoid using uninitialized stat buffer

2018-09-19 Thread Todd C. Miller
When getcwd() fails, the stat buffer 'swd' is used uninitialized by the else clause. Since it is used in both clauses we should perform the stat before the if(). However, fixing this causes 'cp' to be unitialized in some case so initialize cp to NULL and move the "cp == NULL" check out of the

Re: smtpd: force TLS when relaying

2018-09-21 Thread Todd C. Miller
That syntax makes sense to be and I didn't notice any problems in the diff. OK millert@ - todd

<    3   4   5   6   7   8   9   10   11   12   >