Re: grep -R without directory argument

2015-04-30 Thread Todd C. Miller
On Thu, 30 Apr 2015 07:51:55 +0200, Martin Natano wrote: > grep reads from standard input when no files are specified. It also does > so when -R is used, which doesn't really make sense. I think using the > current working directory as a fallback when no directories are > specified would make sens

Re: grep -R without directory argument

2015-04-30 Thread Todd C. Miller
On Thu, 30 Apr 2015 05:58:57 -0600, "Todd C. Miller" wrote: > GNU grep warns in this case before reading from stdin which seems reasonable. > % grep -R foo > grep: warning: recursive search of stdin > ... > > I'd rather add a warning than change the behavior.

[no subject]

2015-04-30 Thread Todd C. Miller
Merge two identical if() statements. The change in ip_spd.c 1.59 makes it appear that there is a cut & pasto. We should merge the two identical and adjacent if() statements to avoid confusing people (and static analyzers). - todd Index: sys/netinet/ip_spd.c

Re:

2015-04-30 Thread Todd C. Miller
On Thu, 30 Apr 2015 10:21:13 -0600, "Todd C. Miller" wrote: > Merge two identical if() statements. The change in ip_spd.c 1.59 > makes it appear that there is a cut & pasto. We should merge the > two identical and adjacent if() statements to avoid confusing people

Re: seccomp system call

2015-05-04 Thread Todd C. Miller
On Mon, 04 May 2015 02:38:58 -0600, Theo de Raadt wrote: > Those policies will be wide open, or too strict. If we adopt this > into our world, the next step after that is going to be wide use of > #ifdef within bpf rulesets. I don't see how that follows. Security policies are going to be highly

Re: seccomp system call

2015-05-04 Thread Todd C. Miller
On Sun, 03 May 2015 20:44:25 -, Loganaden Velvindron wrote: > OpenBSD already has systrace. Last I checked, systrace doesn't work well with multi-threaded programs and was trivial to bypass. The basic design where you have a userland monitor process is flawed. Something where a policy is pu

Re: more precise O_ACCMODE handling

2015-05-04 Thread Todd C. Miller
On Sun, 03 May 2015 22:07:33 -0700, Philip Guenther wrote: > The flags passed to open(2) and openat(2) are not a simple bitset. > Instead, the bits in O_ACCMODE are effectively an enumeration, and the > other bits are or'ed onto that. > > For example, a function that wraps open(2), taking a fl

fifo_poll: use a_fflag to determine valid events

2015-05-04 Thread Todd C. Miller
Now that we have a_fflag in struct vop_poll_args we can handle things like POLLOUT on a read-only fd more sensibly. Previously, any poll events could be used regardless of the actual file flags of the descriptor. Rather than call soo_poll() I've created a real fifo_poll() that checks the socket s

Re: opensmtpd + acceptable mail

2015-05-08 Thread Todd C. Miller
On Fri, 08 May 2015 12:12:46 +0200, Gilles Chehade wrote: > Now the problem is that if the .forward references a "|/path" it forks > a mda (which prepends From), and if mda is sendmail then... it ends up > calling mail.local which prepends From again. > > I think the proper fix is to reconsider t

Re: bug/inconsistency in OpenBSD sed(1) vs. FreeBSD sed(1) [patch]

2015-05-09 Thread Todd C. Miller
On Sat, 09 May 2015 06:47:05 +0200, =?utf-8?Q?S=C3=A9bastien?= Marie wrote: > Here a small patch to sed to make 'i' and 'a' command to always append > "\n" after 'text'. > > While here, remove 'len' field from 'struct s_appends'. It was just used > for AP_STRING (used for 'a' command), and the sw

Re: /etc/daily /tmp purge mods; skip open files with fstat test

2015-05-14 Thread Todd C. Miller
On Thu, 14 May 2015 17:48:49 +0100, Stuart Henderson wrote: > On 2015/05/14 17:45, Craig Skinner wrote: > > $ fstat -u _squid -f /tmp > > Even not allowing for TOCTOU problems I'd be wary of running fstat > automatically. If it is only used to detect when a file is in use that we would otherwise

id: add -c option

2015-05-18 Thread Todd C. Miller
This adds "id -c" to display a user's login class. If no user is specified, it looks up the passwd entry based on the real uid and displays the corresponding login class. This is similar to "id -c" in FreeBSD (but they keep the login class in the kernel). - todd Index: usr.bin/id/id.1

chroot: add -c to use login class with -u

2015-05-18 Thread Todd C. Miller
Currently, "chroot -u" doesn't use the settings in /etc/login.conf. This adds a -c option to apply the via setusercontext(). We can't use LOGIN_SETALL since the uid change has to happen after chroot(2) and the groups may be specified via the -g option. Open questions: 1) Should this just be defa

Re: chroot: add -c to use login class with -u

2015-05-19 Thread Todd C. Miller
The consensus seems to be that "chroot -u" should apply the settings in /etc/login.conf by default. Since this is a non-standard flag we can do what we like with it. I should have used setusercontext() when I added -u to chroot in the first place. We can add a "-c class" option in the future if

Re: chroot: add -c to use login class with -u

2015-05-19 Thread Todd C. Miller
On Tue, 19 May 2015 09:56:53 -0600, Theo de Raadt wrote: > I think the consensus was easy to form. People using -u right now > collect root's giant limits, which is not sensible. Actually, they retain the invoking user's limits. But either way, it is surprising. - todd

from(1): don't warn for missing mail spool

2015-06-03 Thread Todd C. Miller
Some mail clients remove the user's spool file instead of truncating it. There's no reason to warn in this case unless the user specified a file with the -f flag. - todd Index: usr.bin/from/from.c === RCS file: /cvs/src/usr.bin/fro

Re: from(1): don't warn for missing mail spool

2015-06-03 Thread Todd C. Miller
On Wed, 03 Jun 2015 08:15:05 -0600, "Todd C. Miller" wrote: > Some mail clients remove the user's spool file instead of truncating > it. There's no reason to warn in this case unless the user specified > a file with the -f flag. Better version that uses the same e

Re: syslogd multiple listen addresses

2017-01-01 Thread Todd C. Miller
Now that syslogd supports multiple network sockets, does it still make sense to die if one of them cannot be bound? It seems like syslogd should still run as long as there is at least one address it can bind to. What do you think? - todd

Re: syslogd multiple listen addresses

2017-01-01 Thread Todd C. Miller
On Sun, 01 Jan 2017 21:05:58 +0100, Alexander Bluhm wrote: > Regular programs should die as early as possible when an error > occurs, then it can be fixed. But syslogd is special. If it dies, > you become blind and don't see any errors at all. An attacker could > exploit this. So I think syslo

Re: syslogd multiple listen addresses

2017-01-01 Thread Todd C. Miller
On Sat, 31 Dec 2016 01:18:16 +0100, Alexander Bluhm wrote: > Currently syslogd accepts network input only for either IPv4 or > IPv6. To overcome this limitation, allow to specify more than one > listen addresses. > > As multiple TLS contexts need more thought, implement it only for > TCP and UDP

Re: acme-client use configuration file [1 of 5]

2017-01-01 Thread Todd C. Miller
I think you also want something like the following. Also, acme-client.conf.5 has paths like: domain key /etc/ssl/private/example.com.key domain certificate /etc/ssl/example.com.crt instead of: domain key /etc/ssl/acme/private/example.com.key domain certificate /etc

Re: find -delete

2017-01-03 Thread Todd C. Miller
OK millert@ for the code. I'll defer to jmc@ on the man page bits. - todd

qsort.c: remove useless variable

2017-01-03 Thread Todd C. Miller
When qsort.c was de-registered, the register version of 'aa' was not removed. Since qsort() already contains casts of a to char * there's no need for a separate variable here. - todd Index: lib/libc/stdlib/qsort.c === RCS file: /cv

Re: find(1): pledge mayexecve codepath

2017-01-03 Thread Todd C. Miller
On Tue, 03 Jan 2017 23:52:46 +0100, Theo Buehler wrote: > tedu's -delete diff reminded me of a patch I've had in one of my trees > for quite a while: find(1) was tamed a few days before execve(2) was > added to kern_tame.c and I think it was simply forgotten that everything > was already prepared

Re: qsort.c: remove useless variable

2017-01-03 Thread Todd C. Miller
On Tue, 03 Jan 2017 21:51:12 +0100, Alexander Bluhm wrote: > I think it would be nicer to keep the char * a variable and remove > the (char *) casts instead. How about this? - todd Index: lib/libc/stdlib/qsort.c === RCS file: /cvs

Re: sort(1): fix segfault with -m flag

2017-01-04 Thread Todd C. Miller
On Wed, 04 Jan 2017 12:24:15 +0100, Julien Ramseier wrote: > sort segfaults when using the -m flag and no files. > It should default to stdin instead. Committed, thanks. - todd

Re: C11 max_align_t

2017-01-05 Thread Todd C. Miller
I think you need to also define __CLANG_MAX_ALIGN_T_DEFINED and perhaps _GCC_MAX_ALIGN_T to avoid libcxx from redefining max_align_t as a different type. E.g. in src/lib/libcxx/include/stddef.h // Re-use the compiler's max_align_t where possible. #if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !def

Re: C11 max_align_t

2017-01-06 Thread Todd C. Miller
On Fri, 06 Jan 2017 12:27:32 +0100, Mark Kettenis wrote: > Good point. I don't really see a reason to define _GCC_MAX_ALIGN_T as > libstdc++ doesn't try to define its own max_align_t like libc++ does. > We do need to make sure that we define max_align_t for C++11 and up > though. Fair enough. OK

Re: Move auth_approval in su.c before fork is lost due to pledge?

2017-01-13 Thread Todd C. Miller
On 07 Jan 2017 21:14:17 -0700, "Andy Bradford" wrote: > As it turns out, it is because I have an approve entry in > /etc/login.conf and this requires the ability to fork the approval > program. When su tries to run approve it fails and I find the following > in dmesg: > > su

Re: Move auth_approval in su.c before fork is lost due to pledge?

2017-01-13 Thread Todd C. Miller
One change with this diff is that the approval script will run as the invoking user, not the target user. I'm not sure that really makes a difference though. - todd

Re: traceroute(8): make progress on timeout

2017-01-13 Thread Todd C. Miller
On Fri, 13 Jan 2017 16:07:31 +, Florian Obser wrote: > traceroute(8) never sees a timeout when poll(2) returns when it receives > a packet not intended for us. E.g. a ping(8) is running in parallel. > In this case we need to account for the time we already waited. Looks good but please make w

xargs: fix -I when used with -0

2017-01-16 Thread Todd C. Miller
When using the -0 flag, a "line" is delimited by a NUL char, not a newline. This fixes things like: $ printf 'hello\00world\00' | xargs -n 1 -0 -I arg printf '>%s<\n' "arg" Before: >hello world< After: >hello< >world< This change is consistent with the behavior of GNU xargs, Free

Re: xargs: fix -I when used with -0

2017-01-16 Thread Todd C. Miller
On Mon, 16 Jan 2017 09:21:39 -0700, "Todd C. Miller" wrote: > When using the -0 flag, a "line" is delimited by a NUL char, not a > newline. This fixes things like: > > $ printf 'hello\00world\00' | xargs -n 1 -0 -I arg printf '>%s<\n'

Re: ld.so: don't use _dl_exit() for fatal errors

2017-01-24 Thread Todd C. Miller
On Tue, 24 Jan 2017 15:39:49 +1000, Philip Guenther wrote: I see this is already in but one minor nit below. > Index: dl_printf.c > === > RCS file: /cvs/src/libexec/ld.so/dl_printf.c,v > retrieving revision 1.18 > diff -u -p -r1.18 d

Re: Test wanted: free unix domain (a.k.a SOCKET_LOCK())

2017-02-09 Thread Todd C. Miller
On Thu, 09 Feb 2017 12:36:44 +0100, Martin Pieuchot wrote: > dtucker@ reported an interesting recursion [0]. His trace shows that > a thread executing unp_detach() MUST NOT be holding the NET_LOCK(). > > So here's a new version of my SOCKET_LOCK() diff that does exactly > that. That means sofree

Re: Test wanted: free unix domain (a.k.a SOCKET_LOCK())

2017-02-09 Thread Todd C. Miller
On Thu, 09 Feb 2017 08:27:51 -0700, "Todd C. Miller" wrote: > On Thu, 09 Feb 2017 12:36:44 +0100, Martin Pieuchot wrote: > > > dtucker@ reported an interesting recursion [0]. His trace shows that > > a thread executing unp_detach() MUST NOT be holding the NET_LOCK

Re: reduce the direct fd_ofileflags poking

2017-02-11 Thread Todd C. Miller
On Sat, 11 Feb 2017 01:29:08 -0800, Philip Guenther wrote: > To simplify the filedesc fd_ofileflags handling, how about if we make > falloc() take optional flags to OR into the new fd's ofileflags? That > eliminates a quarter of the references to fd_ofileflags. OK, this seems much better than f

Re: ksh(1): fix $RANDOM documentation

2017-02-19 Thread Todd C. Miller
On Sun, 19 Feb 2017 18:33:59 +0100, Ingo Schwarze wrote: > So, here is my suggestion. I don't think we need to say that ksh(1) > calls arc4random(3) indirectly via rand(3). From the perspective > of ksh(1) users, that's an implementation detail. OK millert@ - todd

Re: fmt(1) breaks at non-breaking spaces

2017-02-19 Thread Todd C. Miller
On Sun, 19 Feb 2017 21:21:55 +0100, Ingo Schwarze wrote: > While we cannot handle each and every corner case of arcane Unicode > characters and should not even try, U+00A0 NO-BREAK SPACE seems > common enough to me to be handled even in such a simple tool, in > particular given that the fix is tri

Re: sockaddr_union casts

2017-02-24 Thread Todd C. Miller
On Fri, 24 Feb 2017 19:11:21 +0100, Alexander Bluhm wrote: > We can avoid some casts by using the sa field of union sockaddr_union. OK millert@. I have a diff that eliminates the use of union sockaddr_union in gettdb() (and some others) that's been in my tree for a year or two. I should polish

Re: take PRU_ATTACH out of usrreq

2017-02-26 Thread Todd C. Miller
On Sun, 26 Feb 2017 10:56:16 +0100, Claudio Jeker wrote: > Attaching a PCB to a socket is currently done via PRU_ATTACH but in most > cases this does not need the network / socket lock since no packets can be > received or sent over this socket (needs a bind or connect first) > It also cleans up a

tcsetpgrp(3) can set errno to EINTR

2017-03-07 Thread Todd C. Miller
If tcsetpgrp() is called by a background process and there is a SIGTTOU handler installed without SA_RESTART set, tcsetpgrp() will return -1 and set errno to EINTR. Index: lib/libc/termios/tcsetpgrp.3 === RCS file: /cvs/src/lib/libc/t

Re: newsyslog timestamp

2017-03-13 Thread Todd C. Miller
How about we just eliminate the "logfile turned over" message entirely? It's kind of bogus for newsyslog to be writing to the log files directly. I don't think that message provides any useful info. - todd

whois: remove pointless realloc()

2017-03-15 Thread Todd C. Miller
There's no need to realloc() a chunk of memory when you don't care about the old contents, we don't want have to memcpy() the old contents to the new chunk only to throw it away. While here, use asprintf() to simplify things. - todd Index: usr.bin/whois/whois.c ==

Re: whois: remove pointless realloc()

2017-03-15 Thread Todd C. Miller
On Wed, 15 Mar 2017 09:57:26 -0600, "Todd C. Miller" wrote: > There's no need to realloc() a chunk of memory when you don't care > about the old contents, we don't want have to memcpy() the old > contents to the new chunk only to throw it away. > While he

Re: syslogd fd_tls variable

2017-03-16 Thread Todd C. Miller
On Thu, 16 Mar 2017 00:45:23 +0100, Alexander Bluhm wrote: > On Mon, Jan 09, 2017 at 10:46:42AM +0100, Alexander Bluhm wrote: > > To implement multiple tls listen sockets in syslogd, I have to get > > rid of the global variable fd_tls first. > > Looks like this diff got forgotten. Any ok? OK mi

Re: syslogd log.c

2017-03-16 Thread Todd C. Miller
On Thu, 16 Mar 2017 02:15:48 +0100, Alexander Bluhm wrote: > The whole diff converting all the messages has more than 2000 lines > as it touches every part of syslogd code. I would refuse to review > such a huge diff, so I have splitted it. Let's start with the log.c > implementation. Looks goo

Re: skeylogin.c: use arc4random_buf instead of /var/db/host.random

2017-03-20 Thread Todd C. Miller
On Mon, 20 Mar 2017 21:06:23 +0100, Theo Buehler wrote: > libskey reads directly from /var/db/host.random and falls back to the > ctime of /dev/mem or / for generating the fake prompt for the user. You should also remove SKEY_RAND_FILE_PATH from skey.h. OK millert@ with that removed. - todd

mkdir(2): document EACCESS when no write permission

2017-03-23 Thread Todd C. Miller
>From FreeBSD, POSIX has identical wording. Alternately, we could add an extra EACCESS entry similar to what exists in open(2). I'm happy with either approach. - todd Index: lib/libc/sys/mkdir.2 === RCS file: /cvs/src/lib/libc/sys

Re: RTC clocks

2017-03-26 Thread Todd C. Miller
On Sun, 26 Mar 2017 23:25:48 +0200, Mark Kettenis wrote: > The downside of this is that it becomes impossible to set the time > back that far. But the upside is that if you haven't left a machine > powered off for a very long time, the ntpd constraint will actually > work. I think that is a reas

Re: cksum not working with both -a and -C flags together

2017-03-28 Thread Todd C. Miller
On Tue, 28 Mar 2017 15:49:24 +0100, Craig Skinner wrote: > When cksum(1) is used with a -C checklist listing multiple algorithms, > and a single -a algorithm is specified, cksum doesn't select the correct > -a [algorithm], nor the correct line in the -C [checklist]: The -a option is only used to

Re: cksum not working with both -a and -C flags together

2017-03-28 Thread Todd C. Miller
On Tue, 28 Mar 2017 09:33:53 -0600, "Todd C. Miller" wrote: > It seems to me that in -C mode it should really process all the > checksums that match the specified file(s), but the documentation > does not actually specify what the behavior is in this case. Here's a dif

Re: shutdown(8): warn format string should be literal

2017-04-03 Thread Todd C. Miller
On Mon, 03 Apr 2017 22:21:10 +0200, Frederic Cambus wrote: > warn format string should be literal. OK millert@ Note that path can only be set to either _PATH_REBOOT or _PATH_HALT so there is no security issue, but the compiler doesn't know this. Changing the code helps eliminate false positives

Re: rtadvd: asprintf

2017-04-04 Thread Todd C. Miller
On Tue, 04 Apr 2017 19:08:13 +0200, Jeremie Courreges-Anglas wrote: > The last commit to this file fixed two (void)asprintf calls. Fix the > two remaining calls: depend on the ret buffer being set to NULL on > failure. Personally, I would leave vltimexpire and pltimexpire initialized to NULL and

Re: __pure __dead

2017-04-04 Thread Todd C. Miller
OK millert@ We should probably consider pruning out all the gcc < 3.x bits from sys/cdefs.h. - todd

Re: syslogd log_debug

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 02:10:44 +0200, Alexander Bluhm wrote: > Updated diff after unlock, ok? Looks correct. OK millert@ - todd

Re: syslogd log fatal

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 13:58:12 +0200, Alexander Bluhm wrote: > On Fri, Mar 17, 2017 at 02:09:35AM +0100, Alexander Bluhm wrote: > > This is the next step for refactoring internal syslogd(8) logging. > > Replace all combinations of logerror() and die() with log.c fatal(). > Also all err(3) after log

Re: syslogd log fatal

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 16:51:13 +0200, Alexander Bluhm wrote: > Syslogd's fatal() calls die() internally, so there is no change in > behavior. The idea is that you may call fatal() anywhere and die() > will do cleanup if necessary. Ah, right, I missed that. - todd

Re: syslogd log_warn

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 18:17:38 +0200, Alexander Bluhm wrote: > Replace logerror() functions with generic log_warn() from log.c. > Make messages a bit more consistent. Note that the new function > supports format strings. Replace some log_debug() with log_warn(). OK millert@ - todd

Re: mmap:ing /dev/rsdNc fails with EINVAL on all my attempts&man pages give no hint. Any way around it?

2017-04-05 Thread Todd C. Miller
Not all devices support mmap. Only those that define a d_mmap entry in cdevsw[] will work (see conf.c and conf.h in the kernel). On OpenBSD, disks can not be mmaped. - todd

Re: mmap:ing /dev/rsdNc fails with EINVAL on all my attempts&man pages give no hint. Any way around it?

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 11:24:11 -0600, "Theo de Raadt" wrote: > > "ls -l /dev/rsd0c; ls -l /dev/sd0c" shows that sd0c is a block device > > and rsd0c is a character device, and mmap's man page says that > > "character special files" are OK. > > The manual pages will never list all restrictions. In

Re: syslogd log_info

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 22:23:58 +0200, Alexander Bluhm wrote: > The function logmsg() was used to generate local messages and to > process incomming messages. Split this functionality into log_info() > and logline(). Sort the parameters like they appear in the syslog > line. Shouldn't vlogmsg() be

Re: syslogd log_info

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 22:36:36 +0200, Alexander Bluhm wrote: > On Wed, Apr 05, 2017 at 02:29:46PM -0600, Todd C. Miller wrote: > > On Wed, 05 Apr 2017 22:23:58 +0200, Alexander Bluhm wrote: > > > > > The function logmsg() was used to generate local messages and to > >

Re: syslogd log ttymsg

2017-04-05 Thread Todd C. Miller
On Wed, 05 Apr 2017 23:46:45 +0200, Alexander Bluhm wrote: > On Fri, Mar 17, 2017 at 02:09:35AM +0100, Alexander Bluhm wrote: > > This is the next step for refactoring internal syslogd(8) logging. > > As we did not have nice log functions before, ttymsg() had to return > the error string. Log th

Re: syslogd log startup

2017-04-05 Thread Todd C. Miller
On Thu, 06 Apr 2017 00:03:34 +0200, Alexander Bluhm wrote: > On Fri, Mar 17, 2017 at 02:09:35AM +0100, Alexander Bluhm wrote: > > This is the next step for refactoring internal syslogd(8) logging. > > Here is my final diff for now, thanks for all the reviews. > > The variable Startup is not used

Re: gzip not exiting 2 when not compressible

2017-04-06 Thread Todd C. Miller
This was fixed after 6.0 came out. I believe it was: CVSROOT:/cvs Module name:src Changes by: mill...@cvs.openbsd.org 2016/08/17 06:02:38 Modified files: usr.bin/compress: gzopen.c Log message: When returning the file size info, only use z_total_in/z_total_out for the re

Re: syslogd tcp connect message

2017-04-07 Thread Todd C. Miller
On Fri, 07 Apr 2017 14:50:27 +0200, Alexander Bluhm wrote: > I got feedback that on a TCP log server the TCP connections from > the clients are spamming the log file. The log clients reconnect > at every SIGHUP. > > The easy fix is to write these accept and close messages with debug > priority,

Re: fsck_ffs(8): remove always false comparison

2017-04-10 Thread Todd C. Miller
On Sun, 09 Apr 2017 18:09:51 +0200, Frederic Cambus wrote: > Remove always false comparison: inosused type is ino_t, which is > unsigned. It's not so simple. It looks like this is intended to handle inosused wrapping, which is possible. I think it is worth having a check in there of some kind.

lex: use isblank()

2017-04-12 Thread Todd C. Miller
isblank() is part of C99, no reason not to use it. - todd Index: usr.bin/lex/parse.y === RCS file: /cvs/src/usr.bin/lex/parse.y,v retrieving revision 1.9 diff -u -p -u -r1.9 parse.y --- usr.bin/lex/parse.y 19 Nov 2015 19:43:40 -

lex: missing update of yy_buf_size?

2017-04-12 Thread Todd C. Miller
I found this diff rotting in my tree. It doesn't look like yy_buf_size gets updated when we realloc. Am I missing something? - todd Index: usr.bin/lex/flex.skl === RCS file: /cvs/src/usr.bin/lex/flex.skl,v retrieving revision 1.15

Re: lex: missing update of yy_buf_size?

2017-04-12 Thread Todd C. Miller
On Wed, 12 Apr 2017 09:07:57 -0600, "Todd C. Miller" wrote: > I found this diff rotting in my tree. It doesn't look like yy_buf_size > gets updated when we realloc. Am I missing something? We also need to account for the two end of buffer chars somehow. I've opened a

Re: lex: missing update of yy_buf_size?

2017-04-12 Thread Todd C. Miller
On Wed, 12 Apr 2017 09:12:53 -0600, "Theo de Raadt" wrote: > After realloc, the grown buffer's new space will be garbage bytes > rather than zeroed. Should we be afraid of another bug in the lex > accidentally looking 1 byte ahead, and proactively zero at least the > first byte of growth? lex do

Re: Fix regress/lib/libc/db

2017-04-17 Thread Todd C. Miller
Maybe use UINT_MAX since st_size gets cast to u_int below? Either way OK millert@ - todd

Re: Fix regress/lib/libc/db

2017-04-17 Thread Todd C. Miller
On Mon, 17 Apr 2017 17:12:13 +0200, Mark Kettenis wrote: > > From: "Todd C. Miller" > > Date: Mon, 17 Apr 2017 08:49:26 -0600 > > > > Maybe use UINT_MAX since st_size gets cast to u_int below? > > Either way OK millert@ > > Already committed. But

Re: clang: ignore -fno-force-addr

2017-04-19 Thread Todd C. Miller
In general, if -fdo-something is supported I think it should also accept -fno-do-something. Since this was seen in the wild, patching llvm makes the most sense. Bonus points if you can get it upstreamed. - todd

Re: ftpd should not error out twice

2017-04-25 Thread Todd C. Miller
I don't have any objection to this but if it is committed a similar change should be made to check_login_epsvall. - todd

Re: vi(1): minor nit

2017-04-26 Thread Todd C. Miller
Thanks, fixed. - todd

Re: bin/ed: fix clang warnings

2017-04-26 Thread Todd C. Miller
On Wed, 26 Apr 2017 22:10:49 +0200, Christian Weisgerber wrote: > This fixes the clang warnings in bin/ed. One extra pair of parentheses > and stop passing empty format strings to printf-family functions. One comment inline. Overall, I find the changes to be an improvement. I see that FreeBSD b

Re: bin/ed: fix clang warnings

2017-04-26 Thread Todd C. Miller
On Wed, 26 Apr 2017 22:56:57 +0200, Christian Weisgerber wrote: > The cases before and after follow the > > if (!interactive) { > if (garrulous) > ... > > pattern. *shrug* Yes, but in this case there is nothing to do if !garrulous which is differ

Re: ftpd should not error out twice

2017-04-27 Thread Todd C. Miller
On Thu, 27 Apr 2017 11:00:52 +0200, Mike Belopuhov wrote: > Indeed, it supresses errors from PORT and the like, while > keeping the "530 Please login with USER and PASS.". > > Before: > > USER foo > 331 Password required for foo. > PORT 12567 > 530 Please login with USER and PASS

ksh: quiet clang warning

2017-04-27 Thread Todd C. Miller
This quiets the folowing warning without resorting to a cast. /usr/src/bin/ksh/eval.c:329:19: warning: implicit conversion from 'int' to 'char' changes value from 192 to -64 [-Wconstant-conversion] *dp++ = '@' + 0x80;

Re: Fix exponential glob

2017-04-28 Thread Todd C. Miller
That patch seems to have gotten munged and there was a duplicate return statement. This one works for me. - todd Index: lib/libc/gen/glob.c === RCS file: /cvs/src/lib/libc/gen/glob.c,v retrieving revision 1.46 diff -u -p -u -r1.46

Re: Fix exponential glob

2017-04-28 Thread Todd C. Miller
Here's a diff that hews a bit more closely to the example code in https://research.swtch.com/glob - todd Index: lib/libc/gen/glob.c === RCS file: /cvs/src/lib/libc/gen/glob.c,v retrieving revision 1.46 diff -u -p -u -r1.46 glob.c --

Re: Fix exponential glob

2017-04-28 Thread Todd C. Miller
On Fri, 28 Apr 2017 15:31:34 -0600, "Todd C. Miller" wrote: > Here's a diff that hews a bit more closely to the example code in > https://research.swtch.com/glob Ignore that diff for now, it is not correct. - todd

Re: FQ-CoDel: Flow Queue - Controlled Delay

2017-05-02 Thread Todd C. Miller
On Tue, 02 May 2017 18:59:44 +0200, Mike Belopuhov wrote: > After switching the ph_timestamp to int64_t, the implementation > can be re-adjusted to use int64_t timestamps throughout. > > I think I've got all of the conversion right, but will double- > check everything before getting this in. Wou

Re: FQ-CoDel: Flow Queue - Controlled Delay

2017-05-02 Thread Todd C. Miller
On Tue, 02 May 2017 11:12:58 -0600, "Todd C. Miller" wrote: > On Tue, 02 May 2017 18:59:44 +0200, Mike Belopuhov wrote: > > > After switching the ph_timestamp to int64_t, the implementation > > can be re-adjusted to use int64_t timestamps throughout. > >

Re: less(1): plug memory leak

2017-05-03 Thread Todd C. Miller
On Wed, 03 May 2017 08:03:06 +0200, Anton Lindqvist wrote: > On Mon, May 01, 2017 at 01:36:51PM +0100, Nicholas Marriott wrote: > > > > looks good, ok nicm > > Anyone willing to commit? Committed. - todd

Re: netcat receive limit

2017-05-10 Thread Todd C. Miller
Since netcat is generally used as a debugging tool I think this is a reasonable addition. OK millert@ - todd

Re: [PATCH] Clean up obsolete information in gettimeofday.2

2017-05-11 Thread Todd C. Miller
On Sat, 29 Apr 2017 23:05:45 +0900, Bryan Linton wrote: > Is this worth deleting now that struct timezone *tzp is no longer > used? Actually, gettimeofday(2) will fill in struct timezone *tzp if it is non-NULL. It is still possible to set the time zone via the TIMEZONE kernel option. However, i

improving qsort worst case behavior

2017-05-18 Thread Todd C. Miller
On Wed, 17 May 2017 19:15:45 +0200, Ingo Schwarze wrote: > For the record, this commit changes worst-case stack space requirements > from O(n) to O(log n). The following are unchanged: > > - average stack space: O(log n) > - average run time: O(n log n) > - worst case run time: O(n^2) >

Re: improving qsort worst case behavior

2017-05-19 Thread Todd C. Miller
On Thu, 18 May 2017 09:58:14 -0600, "Todd C. Miller" wrote: > I believe the best approach is to switch qsort.c to "introsort". > The changes are minimal and the elimination of the O(n^2) worst > case is compelling. I've added input arrays to the qsort regress te

qsort: support swapping int-sized elements

2017-05-20 Thread Todd C. Miller
On 64-bit systems, when sorting int-sized elements our qsort will swap elements byte by byte. On 32-bit systems where sizeof(int) == sizeof(long) this is not an issue. Adding support for int-sized swaps results in a nice speedup when sorting ints (like the qsort regress). Another way to look at

qsort: store the partition value out of line

2017-05-20 Thread Todd C. Miller
One optimization implemented in the sample code from "Engineering a Sort Function" that our qsort lacks is storing the partition value out of line when convenient. Currently, we swap the partition value into a[0], but this can significantly degrade performance when the array is sorted in reverse o

Re: qsort: store the partition value out of line

2017-05-22 Thread Todd C. Miller
On Sat, 20 May 2017 15:27:06 -0600, "Todd C. Miller" wrote: > One optimization implemented in the sample code from "Engineering > a Sort Function" that our qsort lacks is storing the partition value > out of line when convenient. Currently, we swap the partition va

Re: qsort: store the partition value out of line

2017-05-22 Thread Todd C. Miller
On Sat, 20 May 2017 15:27:06 -0600, "Todd C. Miller" wrote: > One optimization implemented in the sample code from "Engineering > a Sort Function" that our qsort lacks is storing the partition value > out of line when convenient. Currently, we swap the partition va

Re: dhcpleased, resolvd, slaacd: accurate lock error message

2022-11-27 Thread Todd C . Miller
On Sun, 27 Nov 2022 12:41:23 +, Klemens Nanni wrote: > On Sat, Nov 26, 2022 at 07:33:40PM -0700, Theo de Raadt wrote: > > Yes, that is understandable and suggests "no need to panic". > > Sure, I wasn't sure yet as to whether this is the only way open(2) can > yield EAGAIN (in this use case), b

Re: midicat(1): use err(3)

2022-11-30 Thread Todd C . Miller
On Wed, 30 Nov 2022 09:20:26 -0600, Scott Cheloha wrote: > Couple related things: > > - Use err(3) everywhere. > > For many of these errors we are not currently printing the errno > string. Is there any reason not to do so? The errno string is > useful. OK > - Set ifile/ofile to "stdin"/

Re: Some ENTRY_NB for libc/arch/i386

2022-12-03 Thread Todd C . Miller
On Sat, 03 Dec 2022 17:46:40 +0100, Theo Buehler wrote: > A while ago I added ENTRY_NB to i386 to fix some warnings in libm. Turns > out that libc also has a few of them on i386, diff below fixes the > > warning: bcopy changed binding to STB_WEAK > > for bcmp, bzero, bcopy, brk, sbrk. > > http://b

Re: userspace: remove vestigial '?' cases from getopt(3) loops

2022-12-04 Thread Todd C . Miller
On Sat, 03 Dec 2022 20:14:37 -0600, Scott Cheloha wrote: > There are nearly a hundred vestigial question mark cases in the > top-level getopt(3) loops of various programs. You know, this: > > switch (ch) { > /* ... */ > case '?': > default: > usage(); >

Re: userspace: remove vestigial '?' cases from getopt(3) loops

2022-12-04 Thread Todd C . Miller
On Sun, 04 Dec 2022 15:58:22 -0600, Scott Cheloha wrote: > On Mon, Dec 05, 2022 at 06:37:49AM +1000, David Gwynne wrote: > > On Sat, Dec 03, 2022 at 08:14:37PM -0600, Scott Cheloha wrote: > > > There are nearly a hundred vestigial question mark cases in the > > > top-level getopt(3) loops of vario

<    9   10   11   12   13   14   15   16   >