Re: another slowcgi cleanup

2021-04-16 Thread Todd C . Miller
On Fri, 16 Apr 2021 17:34:38 +0200, Claudio Jeker wrote: > Every code using SLIST_REMOVE() should just switch to proper LISTs. > I realized slowcgi was using SLIST where it should use LIST but that was > only the start of the rabbit hole. There is also no need to double wrap > the request. So

Re: printf(1) Fix hex numbers

2021-04-15 Thread Todd C . Miller
On Fri, 16 Apr 2021 03:34:04 +0200, Martijn van Duren wrote: > We currently have NetBSD's behaviour when it comes to to no characters, > so no need to change there imho, but the 2 character limit seems like > a good place to stop, especially since there's no way to break out of > this hungry

Re: Manpage fix: passwd.1

2021-04-14 Thread Todd C . Miller
On Wed, 14 Apr 2021 11:09:02 +0200, Benjamin Baier wrote: > don't mention _PASSWORD_LEN in passwd manpage. > It's also no longer true, since Rev1.52, local_passwd.c uses 1024 > bytes for the password array. Committed, thanks. - todd

vi: apply expandtab to the output of a ! command

2021-04-13 Thread Todd C . Miller
This is consistent with vim's expandtab behavior. >From nvi2 (Craig Leres): https://github.com/lichray/nvi2/commit/7d3f43559026e0927032a105b217850feaefec66 I know most of us don't use expandtab but it is helpful when dealing with a codebase that is space-indented. Since the option originated

Re: vi: don't expandtab when we're in command mode.

2021-04-13 Thread Todd C . Miller
On Tue, 13 Apr 2021 16:56:52 +0200, Martijn van Duren wrote: > When adding a TRACE() I see that that case is only called incidentally > and / works for me as is. However, it still doesn't work when > in command-mode (e.g. ":%s// /g" still requires ^V escape). > > So either I'm not clear on which

vi: don't expandtab when we're in command mode.

2021-04-13 Thread Todd C . Miller
Otherwise you can't search for a tab unless you ^V escape it. >From nvi2: https://github.com/lichray/nvi2/commit/0ef1c824648bcfe9f831a9607cb465b18e313d1d Index: vi/v_txt.c === RCS file: /cvs/src/usr.bin/vi/vi/v_txt.c,v retrieving

Re: fix diff3/merge for files lacking \n at EOF

2021-04-12 Thread Todd C . Miller
On Mon, 12 Apr 2021 21:18:41 +0200, Stefan Sperling wrote: > The problem is that the code scanning a common chunk of lines doesn't > account for the possibility that EOF may occur before a final newline. > > This patch fixes the problem in all affected tools in the tree. OK? The return value of

Re: libressl pc files

2021-04-12 Thread Todd C . Miller
On Mon, 12 Apr 2021 13:25:06 -0600, "Todd C. Miller" wrote: > This is a bit of a mess. LibreSSL portable puts the LibreSSL version > number in the pc files. In-tree LibreSSL uses 1.0.0 which is clearly > wrong--using SHLIB_VERSION_NUMBER for the version makes absolute

Re: libressl pc files

2021-04-12 Thread Todd C . Miller
This is a bit of a mess. LibreSSL portable puts the LibreSSL version number in the pc files. In-tree LibreSSL uses 1.0.0 which is clearly wrong--using SHLIB_VERSION_NUMBER for the version makes absolutely no sense to me. The pc files used by OpenSSL also use the release version. The simplest

Re: smtpd: default mta ciphers

2021-04-01 Thread Todd C . Miller
On Thu, 01 Apr 2021 16:34:33 +0200, Eric Faurot wrote: > If not cipher list is specified for a relay rule, fallback to > the global cipher list if defined, rather than libtls default. > This is closer to the previous behavior. OK millert@ - todd

Re: btrace: add dry run mode

2021-03-19 Thread Todd C . Miller
On Fri, 19 Mar 2021 13:22:35 +0100, Klemens Nanni wrote: > I argue it should be `-n' like all the daemons, e.g. vmd(8) and other > parsers such as pfctl(8) do. Yes, please. I was about to make the same point. - todd

Re: pppoe(4): describe what happens if RFC 4638 is not supported

2021-03-16 Thread Todd C . Miller
On Tue, 16 Mar 2021 13:59:20 +0100, Klemens Nanni wrote: > It doesn't hurt however to mention the specific message such that users > can tell *when* that happens; perhaps add it under DIAGNOSTICS as the > various wifi driver manuals, e.g. athn(4) do? I think it makes more sense to have the

pppoe(4): describe what happens if RFC 4638 is not supported

2021-03-16 Thread Todd C . Miller
I think it is helpful to tell the user what happens if the remote endpoint doesn't support RFC 4638. OK? - todd Index: share/man/man4/pppoe.4 === RCS file: /cvs/src/share/man/man4/pppoe.4,v retrieving revision 1.34 diff -u -p -u

Re: ksh vi.c: define CTRL locally

2021-03-11 Thread Todd C . Miller
On Thu, 11 Mar 2021 12:44:18 +0100, Benjamin Baier wrote: > lets's sync up vi.c with emacs.c and define CTRL locally. > Makes the portable version work on FreeBSD https://github.com/ibara/oksh/issu > es/59 > And as a bonus makes ksh -DSMALL compile with -DVI. Thanks, I committed this without the

Re: quiz: Fix multi-line questions (trailing newline)

2021-03-10 Thread Todd C . Miller
On Wed, 10 Mar 2021 22:49:13 -0500, Alex Karle wrote: > > This would now be clearer as: > > > > if (qlen > 0 && qp->q_text[qlen - 1] == '\\') { > > I agree this is clearer, but I think we'll need a `qlen = 0` > initialization up above the while loop if we go with this

Re: Remove extra pointer to gzFile in grep(1)

2021-03-10 Thread Todd C . Miller
On Wed, 10 Mar 2021 16:46:32 -0500, Josh Rickmar wrote: > The compress(3) family of utility functions return and operate on > gzFile, a typedef for void*. The extra pointer to this gzFile in > grep(1) can be removed. Other uses of these compress(3) functions in > tree (spamd, mandoc, smtpd) do

Re: quiz: Fix multi-line questions (trailing newline)

2021-03-10 Thread Todd C . Miller
On Wed, 10 Mar 2021 21:15:13 +0100, Christian Weisgerber wrote: > Right. Next iteration: Looks better, one minor nit inline. - todd > Index: quiz.c > === > RCS file: /cvs/src/games/quiz/quiz.c,v > retrieving revision 1.30 > diff

Re: ksh: [vi.c] "clear-screen" bug + patch

2021-03-10 Thread Todd C . Miller
Now the the clear screen change has been committed, here's the insert mode ^R (redraw) diff again with a man page update. Note that ^R is already supported in command mode. OK? - todd Index: bin/ksh/ksh.1 === RCS file:

Re: quiz: Fix multi-line questions (trailing newline)

2021-03-09 Thread Todd C . Miller
On Tue, 09 Mar 2021 22:04:42 +0100, Christian Weisgerber wrote: > Thanks a lot for figuring this out! I finally got around to looking > at your patch. Once we have nul-terminated lines, appdstr() can > be replaced with realloc() and strlcat(). I don't think your use of qlen is safe since it is

Re: mg: Fix Coverity Scan warning: Insecure data handling

2021-03-09 Thread Todd C . Miller
On Tue, 09 Mar 2021 20:14:19 +, Mark Lumsden wrote: > Here is a diff from Joachim Wiberg's version of mg. > > "The strlcpy() function is guaranteed to never copy more than 'len - 1' > bytes, so there is no need to check if we copied more. This is a bogus > warning since the introduction of

Re: ksh: [vi.c] "clear-screen" bug + patch

2021-03-09 Thread Todd C . Miller
On Tue, 09 Mar 2021 17:53:06 +0100, Benjamin Baier wrote: > Ping I think that in do_clear_screen() full should not be set unless neednl is 0. That is, we should only print the entire prompt if the screen was actually cleared. Otherwise looks good to me. - todd Index: bin/ksh/vi.c

Re: smtpd: use mx name for sni

2021-03-07 Thread Todd C . Miller
On Sun, 07 Mar 2021 21:47:45 +0100, Eric Faurot wrote: > As spotted by krw@, the mta should use the mx hostname for sni, not > the reverse dns for the peer address. Yes, this matches the previous behavior with ssl_check_name(). OK millert@ - todd

Re: if calloc() needs nmemb and size, why doesn't freezero()?

2021-02-19 Thread Todd C . Miller
On Fri, 19 Feb 2021 10:38:13 -0600, Luke Small wrote: > In malloc(3): > “If you use smaller integer types than size_t for ‘nmemb’ and ‘size’, then > multiplication in freezero() may need to be cast to size_t to avoid integer > overflow: > freezero(ptr, (size_t)nmemb * (size_t)size);” > Or maybe

Re: disklabel: make use of getline(3)

2021-02-01 Thread Todd C . Miller
On Sun, 31 Jan 2021 15:43:32 +0100, Christian Weisgerber wrote: > Replace fgetln(3) with getline(3). > > Since getline() returns a C string, we don't need to carry around > the length separately. OK millert@ - todd

Re: fdisk: make use of getline(3)

2021-01-30 Thread Todd C . Miller
On Sat, 30 Jan 2021 18:02:10 +0100, Christian Weisgerber wrote: > Replace fgetln(3) with getline(3). OK millert@ - todd

Re: disklabel: pointer deref fix

2021-01-30 Thread Todd C . Miller
On Sat, 30 Jan 2021 01:01:37 +0100, Christian Weisgerber wrote: > Fix a pointer dereference in disklabel(8). > > This looks like somebody wrote *s[0] in place of (*s)[0]. > Which in this case happens to be equivalent, but it still looks > wrong. Probably my bug. OK millert@ - todd

Re: sed: make use of getline(3)

2021-01-30 Thread Todd C . Miller
On Sat, 30 Jan 2021 00:43:02 +0100, Christian Weisgerber wrote: > Replace fgetln(3) with getline(3) in sed. > > The mf_fgets() part is from Johann Oskarsson for Illumos/FreeBSD. > > Passes our sed regression tests. OK millert@ - todd

ldapd(8): Xr ldap(1)

2021-01-28 Thread Todd C . Miller
Add ldap(1) to SEE ALSO in ldapd(8). I don't think there is a need to add it to ldapctl(8) or ldapd.conf(5). - todd Index: usr.sbin/ldapd/ldapd.8 === RCS file: /cvs/src/usr.sbin/ldapd/ldapd.8,v retrieving revision 1.14 diff -u -p

Re: libcurses: don't return ERR if resize didn't change size

2021-01-21 Thread Todd C . Miller
On Thu, 21 Jan 2021 19:53:48 +0100, Hiltjo Posthuma wrote: > Yes please!, I've also run into this issue on OpenBSD with the "catpoint" > presentation program. I've been meaning to send the exact same backport patch > . > > The upstream snapshot version of ncurses compiles fine on OpenBSD and I've

libcurses: don't return ERR if resize didn't change size

2021-01-21 Thread Todd C . Miller
This is a backport of the ncurses 5.9 20120707 patch. https://github.com/mirror/ncurses/commit/471bc007361fd4bc8d2fae060c7d5b09828ed541 Previously, getch() would return ERR if SIGWINCH was received but the window didn't actually change size. This can happen, for example, when the xterm font is

games/canfield bug

2021-01-21 Thread Todd C . Miller
Paul Janzen reported that if you try to resize an xterm while canfield is running, canfield suspends itself. This is due to the curses getch() function returning KEY_RESIZE. However, canfield only expects to read 7-bit ascii characters and so uses a mask of 0x7f. Since KEY_RESIZE & 0x7f == 0x1a

Re: [PATCH] Reduce case duplication in kern_sysctl

2021-01-09 Thread Todd C . Miller
On Sat, 09 Jan 2021 14:39:53 -0800, Greg Steuck wrote: > How's this instead? OK? > > Tested with the usual diff of before/after sysctl outputs and a random > sysctl -w poke. > > Subject: [PATCH] Split hierarchical calls into kern_sysctl_dirs > > Removed a rash of +/-1 and made both functions

Re: [PATCH] Reduce case duplication in kern_sysctl

2021-01-09 Thread Todd C . Miller
On Mon, 28 Dec 2020 22:00:55 -0800, Greg Steuck wrote: > Here's an updated version to account from an intervening change since I > posted this first. Updated diff looks good to me. OK millert@ but it would be good to get feedback from Marcus too. - todd

Re: [PATCH] Reduce case duplication in kern_sysctl

2021-01-09 Thread Todd C . Miller
On Sun, 20 Dec 2020 15:52:07 -0800, Greg Steuck wrote: > I tested this by diff'ing sysctl output before/after on amd64. Since > there's a bunch of ifdef'ness I verified RAMDISK still builds. > > I deliberately didn't fix the indentation to keep this diff a pure line > motion (would run over 80

Re: [PATCH]es sysctl_int_bounded goodness

2021-01-09 Thread Todd C . Miller
On Fri, 18 Dec 2020 12:31:54 -0800, Greg Steuck wrote: > I'm scraping the bottom of the barrel with these, so dumped them all > together for ease of review. Will submit piecemeal as reviews happen. > > All verified manually with sysctl -w. Even bothered to find an i386 > machine with watchdog and

Re: Fix -Wincompatible-pointer-types-discards-qualifiers

2021-01-07 Thread Todd C . Miller
On Fri, 08 Jan 2021 00:29:32 +0100, Theo Buehler wrote: > Thanks. Unfortunately the patch was mangled by your MUA (line wrapping > and expanded tabs). > > Below is a version that applies. OK millert@ as well. - todd

Re: sleep(3): don't bypass nanosleep(2)

2021-01-06 Thread Todd C . Miller
On Wed, 06 Jan 2021 10:31:28 -0600, Scott Cheloha wrote: > Other benefits: > > - sleep(3) now *always* shows up in ktrace. > > - sleep(3) with a zero input now blocks for up to 1 tick, just like > nanosleep(2) does with a zero input (more intuitive behavior). > > - Neither NetBSD nor FreeBSD

Re: libc/regex: turn unsafe macros to inline functions

2021-01-03 Thread Todd C . Miller
On Sun, 03 Jan 2021 17:51:56 +0100, Theo Buehler wrote: > Thanks. Here's the diff rebased on top of -current. This is > > ok tb OK millert@ as well if you'd like to do the honors. - todd

Re: libc/regex: turn unsafe macros to inline functions

2021-01-02 Thread Todd C . Miller
On Sat, 02 Jan 2021 20:33:51 +, Miod Vallat wrote: > That code was written before inline functions were supported by > compilers; now that they are even part of the language standard, turn > macros into inline functions so that there is no need to document in > comments that they will

Re: libc/regex: const'r'us

2020-12-31 Thread Todd C . Miller
All three committed, thanks. - todd

Re: libc/regex: more regular error handling

2020-12-31 Thread Todd C . Miller
On Thu, 31 Dec 2020 07:29:51 +, Miod Vallat wrote: > The REQUIRE macro is used to check for a condition, and set an error in > the parse struct if it is not satisfied. > > This changes it from ((condition) || function call) to a, IMHO more > readable, if() test. OK millert@ - todd

Re: libc/regex: drop more unused data

2020-12-31 Thread Todd C . Miller
On Thu, 31 Dec 2020 07:25:19 +, Miod Vallat wrote: > re_guts catspace[] is only written to (via categories[]), and never used > for anything, so don't bother keeping that. OK millert@ - todd

Re: libc/regex: const'r'us

2020-12-31 Thread Todd C . Miller
On Thu, 31 Dec 2020 07:27:49 +, Miod Vallat wrote: > Spencer's code was written before const was a thing, but we can do > better. Neither regcomp(3) nor regex(3) modify the strings they are > being passed, so we can keep internal pointers as const as well and > avoid {dub,spur}ious casts. > >

Re: login_passwd.c (etc.) and auth_mkvalue(3) returning NULL

2020-12-31 Thread Todd C . Miller
On Thu, 31 Dec 2020 15:27:02 +1100, Ross L Richardson wrote: > It could, of course, just use a fixed string rather than the "%s" format, > although the latter is certainly clear(er) and consistent. I originally had a fixed string but decided that using the "%s" format was clearer. > With

Re: login_passwd.c (etc.) and auth_mkvalue(3) returning NULL

2020-12-30 Thread Todd C . Miller
On Wed, 30 Dec 2020 15:34:34 +1100, Ross L Richardson wrote: > auth_mkvalue(3) may return NULL (if no memory is available), but > login_passwd.c and friends use the return value without checking. Yes, that should be checked. In the case of login_passwd.c there is really no reason to use

Re: [diff] src/usr.sbin/smtpd: change process names

2020-12-30 Thread Todd C . Miller
On Wed, 30 Dec 2020 09:27:34 +0100, Martijn van Duren wrote: > On Tue, 2020-12-29 at 08:57 +0100, Giovanni Bechis wrote: > > On 12/20/20 12:21 AM, gil...@poolp.org wrote: > > > December 19, 2020 11:26 PM, "Martijn van Duren" alat.at> wrote: > > > > > > > Personally I'd rather wait to keep the

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-29 Thread Todd C . Miller
On Tue, 29 Dec 2020 12:36:22 -0700, Todd C. Miller wrote: > That looks something like this. I used the FreeBSD macros which > incorporate STAILQ_NEXT and STAILQ_FIRST but I can inline things > if someone has a strong opinion on this. Here is the updated man page. The table doesn'

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-29 Thread Todd C . Miller
On Sat, 26 Dec 2020 15:07:36 -0700, "Theo de Raadt" wrote: > Well in that case this should still be a multistep process. > > Add STAILQ > > Convert things, including everything in ports > > No diff should change a line of code before it's time That looks something like this. I used the FreeBSD

Re: libc/regex: safer pointer arithmetic

2020-12-29 Thread Todd C . Miller
On Tue, 29 Dec 2020 10:33:26 +, Miod Vallat wrote: > regcomp.c uses the "start + count < end" idiom to check that there are > "count" bytes available in an array of char "start" and "end" both point > to. > > This is fine, unless "start + count" goes beyond the last element of the > array. In

Re: libc/regex: regerror minor tweaks

2020-12-29 Thread Todd C . Miller
On Tue, 29 Dec 2020 10:35:08 +, Miod Vallat wrote: > The following diff constifies the strings in regerror.c and also makes > use of the strlcpy() return value to avoid a redundant strlen() call. OK millert@ - todd

Re: libc/regex: remove dead code

2020-12-29 Thread Todd C . Miller
On Tue, 29 Dec 2020 09:50:16 +, Miod Vallat wrote: > cclasses[] multis field is always an empty string. Remove it and code > dealing with it. This code was incomplete anyway. OK millert@ - todd

Re: libc/regex: constify more data

2020-12-29 Thread Todd C . Miller
On Tue, 29 Dec 2020 09:49:11 +, Miod Vallat wrote: > The following diff constifies the strings in cnames[]. No functional > change. OK millert@ - todd

Re: smtpd: trim down on filter processes

2020-12-27 Thread Todd C . Miller
On Sun, 27 Dec 2020 18:41:22 +0100, Martijn van Duren wrote: > Because filters use system(3) after forking we get 2 processes for every > filter: one for waiting for system(3) to return and one running the actual > filter. > > Since the extra smtpd process does absolutely nothing we can just as

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-26 Thread Todd C . Miller
On Sat, 26 Dec 2020 10:45:21 -0700, "Theo de Raadt" wrote: > > This diff renames SIMPLEQ_* to STAILQ_* in /usr/src/sys/sys to unify > > with FreeBSD and Linux. > > More than half the stuff being touched doesn't exist in FreeBSD or Linux. > > SIMPLEQ_ goes back to 97. STAILQ goes back to 96.

Re: Rename SIMPLEQ_ to STAILQ_, diff 1/7

2020-12-26 Thread Todd C . Miller
I read through all the diffs and they look fine to me. My only comment is that it would be nice if the whitespace changes to queue.h were done separately as they makes it more difficult to see the important changes. I was pleasntly surprised to find the nothing in the tree reaches into the data

Re: [diff] usr.sbin/smtpd: fix event handling upon exit

2020-12-22 Thread Todd C . Miller
OK millert@ - todd

Re: [diff] src/usr.sbin/smtpd: add a forward-file option

2020-12-19 Thread Todd C . Miller
I like this direction but I worry about breaking existing configs. How are we going to alert existing users that they need to update their configs if the behavior silently changes? - todd

Re: [diff] src/usr.sbin/smtpd: change process names

2020-12-19 Thread Todd C . Miller
I like it. I always forget which role the pony process performs. - todd

Re: WITNESS panic: acquiring blockable sleep lock with spinlock or critical section held (rwlock) kmmaplk

2020-12-19 Thread Todd C . Miller
On Sat, 19 Dec 2020 18:07:41 -0300, Martin Pieuchot wrote: > A solution based on a comment and a non-enabled by option seems very > fragile to me. I came up with the idea of poisoning the ipl of the > mutex. What do you think? Even better. OK millert@ - todd

Re: WITNESS panic: acquiring blockable sleep lock with spinlock or critical section held (rwlock) kmmaplk

2020-12-18 Thread Todd C . Miller
On Fri, 18 Dec 2020 13:34:39 +0100, Mark Kettenis wrote: > Anyway, your analysis is right. When a kernel thread wants to use > pmap_extract(9) on a userland pmap, it needs to lock pm_apte_mtx to > prevent another thread from simultaniously activating a userland pmap > too. So indeed,

Re: [diff] src/usr.sbin/smtpd: plug two memory leaks

2020-12-17 Thread Todd C . Miller
On Thu, 17 Dec 2020 15:02:41 +, gil...@poolp.org wrote: > a- in lka_filter.c, the name of the filter chain for a session is strdup()-ed > upon session allocation but not released upon session release. free() it > in lka_filter_end(). > > b- in smtp_session.c, filter io channel should be

Re: libcurses: --enable-const

2020-12-12 Thread Todd C . Miller
On Sat, 12 Dec 2020 16:28:18 +0100, Christian Weisgerber wrote: > ncurses has a configure option that adds a few more consts to its > headers by way of the NCURSES_CONST define. Starting with version > 6.0, this has become the default. OpenBSD is still on ncurses 5.7, > but FreeBSD and I guess

Re: cat(1): -n flag: support files with more than INT_MAX lines

2020-12-10 Thread Todd C . Miller
On Thu, 10 Dec 2020 22:12:49 -0600, Scott Cheloha wrote: > If we bump 'line' from an int to an unsigned long long we will > correctly number files with more than INT_MAX lines instead of > wrapping to a negative number. OK millert@ - todd

Re: rpki-client: reject bad URLs in cert files

2020-12-02 Thread Todd C . Miller
On Wed, 02 Dec 2020 17:18:49 +0100, Theo Buehler wrote: > Should this also check isascii() to ensure that this works as intended > in the -portable version? The ENVIRONMENT section of the isalnum() and > ispunct() manuals suggests that the characters satisfying this could be > locale-dependent

Re: rpki-client: reject bad URLs in cert files

2020-12-02 Thread Todd C . Miller
On Wed, 02 Dec 2020 15:17:43 +0100, Claudio Jeker wrote: > Be stricter in what we accept as URL. Nobody should use silly encodings > like UTF-8 or other crap in the embedded URLs. I also consider any kind of > space as a failure (use %20 instead if that is really needed). > > This makes later

Re: Better overflow check in bgpd

2020-12-02 Thread Todd C . Miller
On Wed, 02 Dec 2020 12:19:11 +0100, Claudio Jeker wrote: > The overflow check for the relative metric adjustments of filtersets > assumes a certain overflow behaviour of signed integers. I think it is > better to write this in a way that does not involve an overflow. OK millert@ though I think >

Re: [PATCH] __rec_open() should set the type

2020-12-01 Thread Todd C . Miller
On Tue, 01 Dec 2020 14:07:18 +0100, "Boudewijn Dijkstra" wrote: > According to dbopen(3), the 'type' field of struct DB holds the "type of > the underlying access method (and file format)." In __bt_open() it is set > to DB_BTREE and in __hash_open() it is set to DB_HASH, so one might expect

Re: find -exec util {} arg + confusion

2020-11-21 Thread Todd C . Miller
On Sat, 21 Nov 2020 17:02:05 +0100, Alexander Hall wrote: > So this is it. Any other objections? OK? OK millert@ - todd

Re: Import seq(1) from FreeBSD

2020-11-16 Thread Todd C . Miller
On Mon, 16 Nov 2020 16:14:31 +0100, Ingo Schwarze wrote: > are you really sure this is a good idea? The version you sent is > wildly incompatible with GNU sed. So we add a non-standard utility > that exhibits different behaviour on different systems even though > a standard utility already

Import seq(1) from FreeBSD

2020-11-16 Thread Todd C . Miller
This is originally from NetBSD but FreeBSD appears to have some additional fixes. I know we have jot(1) but seq(1) is considerably easier to use for simple things and at this point, most other systems have it. - todd Index: usr.bin/seq/Makefile

Re: Convert sysctl_sysvsem to sysctl_bounded_args

2020-11-16 Thread Todd C . Miller
On Sat, 14 Nov 2020 21:09:59 -0800, Greg Steuck wrote: > I went a tiny bit beyond pure textual conversion and moved a bit of code. OK millert@ - todd

Re: Convert fusefs_sysctl to sysctl_bounded_args

2020-11-16 Thread Todd C . Miller
On Sat, 14 Nov 2020 21:05:39 -0800, Greg Steuck wrote: > This is trivial more-of-the-same. If somebody spots a bug, do speak > up. I feel pretty good about committing this promptly. OK millert@ - todd

Re: Remove the cases folded into sysctl_bounded_args but left behind

2020-11-16 Thread Todd C . Miller
On Sat, 14 Nov 2020 21:08:09 -0800, Greg Steuck wrote: > This an "oops" moment... The code remained correct, but I forgot to > remove junk after converting it. OK millert@ - todd

Re: Convert ffs_sysctl to sysctl_bounded_args

2020-11-06 Thread Todd C . Miller
On Sun, 01 Nov 2020 20:16:35 -0800, Greg Steuck wrote: > How does the encoding of sysctl_rdint as [1,0] sound? I think this is OK. We already have the special case where min == max. OK millert@ - todd

Re: bpf_sysctl for sysctl_int_bounded

2020-11-02 Thread Todd C . Miller
On Sun, 01 Nov 2020 19:31:16 -0800, Greg Steuck wrote: > Mildly different in flavor due to the special check. OK? OK millert@ - todd

Re: Move TCPCTL_ALWAYS_KEEPALIVE into tcpctl_vars

2020-11-02 Thread Todd C . Miller
On Sun, 01 Nov 2020 19:29:23 -0800, Greg Steuck wrote: > This one was an omission from the earlier conversion, should be an easy > OK? OK millert@ - todd

Re: basename(3) should have non-const arg, says POSIX

2020-10-19 Thread Todd C . Miller
On Mon, 19 Oct 2020 22:06:52 +0200, Christian Weisgerber wrote: > The patch below aligns the function prototypes with POSIX. All > resulting warnings "passing 'const char *' to parameter of type > 'char *' discards qualifiers" in the base system have been cleaned > up. It successfully passes

Re: Non-const basename: usr.bin/cvs

2020-10-19 Thread Todd C . Miller
On Sat, 17 Oct 2020 00:15:54 +0200, Christian Weisgerber wrote: > Accommodate POSIX basename(3) that takes a non-const parameter and > may modify the string buffer. > > There were only two compiler warnings about discarded const, but > there are numerous instances where the code assumes non-POSIX

Re: _exit(2), execve(2): cancel interval timers MP-safely

2020-10-15 Thread Todd C . Miller
On Wed, 14 Oct 2020 20:06:50 -0500, Scott Cheloha wrote: > ... should I shove the for-loop into the helper function too? Maybe > call it "cancel_all_itimers()"? I have a vague feeling that showing > the reader that there are multiple timers is a good thing here, but > then again maybe I'm wrong

Re: Non-const basename: usr.bin/rcs

2020-10-15 Thread Todd C . Miller
On Wed, 14 Oct 2020 22:19:52 +0200, Christian Weisgerber wrote: > Accommodate POSIX basename(3) that takes a non-const parameter and > may in fact modify the string buffer. OK millert@ - todd

Re: Non-const basename: bin/chio

2020-10-13 Thread Todd C . Miller
On Tue, 13 Oct 2020 21:37:11 +0200, Christian Weisgerber wrote: > As far as I understand, the basename() here is specifically intended > to skip a leading "/dev/". So how about doing this expressly? That works for me. > Do we want to use _PATH_DEV or "/dev/"? There's a "/dev/rst%d" a > few

Re: Non-const basename: libkvm

2020-10-13 Thread Todd C . Miller
On Tue, 13 Oct 2020 11:05:42 +0200, Christian Weisgerber wrote: > Accommodate a basename(3) that takes a non-const parameter and may > in fact modify the string buffer. > > Note that strlen(uf) >= PATH_MAX is already checked by the caller > in _kvm_open(). OK. - todd

Re: Non-const basename: usr.bin/patch

2020-10-10 Thread Todd C . Miller
On Sat, 10 Oct 2020 16:50:56 +0200, Christian Weisgerber wrote: > Here's a fix to accommodate a basename(3) that takes a non-const > parameter and may in fact modify the string buffer. This is > originally from Joerg Sonnenberger for DragonFly BSD and has since > spread to the other BSDs. >

Re: Non-const basename: usr.bin/compress

2020-10-10 Thread Todd C . Miller
On Sat, 10 Oct 2020 22:24:58 +0200, Christian Weisgerber wrote: > Accommodate POSIX basename(3) that takes a non-const parameter and > may in fact modify the string buffer. > > Following martijn@'s comment for the sed diff, we don't need to > check for truncation because the "in" path has already

/etc/daily: use find -delete

2020-10-08 Thread Todd C . Miller
We can use find's built-in -delete primary to remove old /tmp files and directories. This is somewhat less error-prone than execing rm or rmdir. - todd Index: etc/daily === RCS file: /cvs/src/etc/daily,v retrieving revision 1.93

Re: ls: match historic behavior listing empty directories

2020-10-07 Thread Todd C . Miller
Anyone? - todd > This is adapted from FreeBSD revs 130236 and 130237 which have the > following log message: > > If we are asked to print the total number of blocks, do so even if we > have no entries to print (either due to an empty directory or an > error). This makes the -l and

libexec/security: don't prune mount points

2020-10-07 Thread Todd C . Miller
The recent changes to the daily security script will result in it not traversing file systems where the parent mount point is mounted with options nodev,nosuid but the child is mounted with setuid enabled. For example, if /var/www is a separate file system that allows setuid but /var is mounted

ls: match historic behavior listing empty directories

2020-10-03 Thread Todd C . Miller
This is adapted from FreeBSD revs 130236 and 130237 which have the following log message: If we are asked to print the total number of blocks, do so even if we have no entries to print (either due to an empty directory or an error). This makes the -l and -s options more consistent,

Re: setpriority(2): booleans are not scalars

2020-09-25 Thread Todd C . Miller
On Fri, 25 Sep 2020 13:58:01 -0500, Scott Cheloha wrote: > `found' serves as a boolean here. I'd prefer to simple and set it to > 1 instead of incrementing it when we find what we're looking for. Makes sense to me, the use of var++ instead of var=1 is old-school style ;-) - todd

Re: ksh "clear-screen" for vi mode

2020-09-20 Thread Todd C . Miller
Does this look better? I don't think we need to refer to the emacs clear-screen command in both cases; once should be sufficient. - todd Index: bin/ksh/ksh.1 === RCS file: /cvs/src/bin/ksh/ksh.1,v retrieving revision 1.209 diff -u

Re: ksh "clear-screen" for vi mode

2020-09-20 Thread Todd C . Miller
On Sun, 20 Sep 2020 05:39:02 +0200, Theo Buehler wrote: > This works and appears to match bash's behavior in that it only works > in normal mode. I would slightly prefer to also add the command to the > nonstandard vi commands in the switch around line 650 to have it > available from insert mode

Re: ksh "clear-screen" for vi mode

2020-09-19 Thread Todd C . Miller
The vi and emacs edit code are completely separate. Try the following diff. I had to rename a few things to avoid clashing with ncurses.h. - todd Index: bin/ksh/vi.c === RCS file: /cvs/src/bin/ksh/vi.c,v retrieving revision 1.56

Re: drop support for afs, nnpfs, and procfs from security(8)

2020-09-16 Thread Todd C . Miller
On Wed, 16 Sep 2020 18:17:36 +0200, Ingo Schwarze wrote: > Does anyone think that explicitely excluding these file system > types might still be useful, or is the following simplification > OK? No functional change intended. I think those bits can go. OK millert@ - todd

Re: cap_mkdb: remove igetnext prototype for the function does not exist

2020-09-15 Thread Todd C . Miller
On Tue, 15 Sep 2020 11:35:13 +0800, Kevin Lo wrote: > ok? OK millert@ - todd

Re: syslogd listen keep alive

2020-09-14 Thread Todd C . Miller
On Mon, 14 Sep 2020 21:49:07 +0200, Alexander Bluhm wrote: > A while ago dhill@ pointed out that syslogd TCP sockets will stay > open forever if a client aborts the connection silently. As syslogd > does not write anything into incoming connections, it will not > recognize failure and the socket

Re: smtp(1) fix for usernames containing '@' symbols

2020-09-14 Thread Todd C . Miller
On Mon, 14 Sep 2020 16:55:43 -, Josh Rickmar wrote: > Some email accounts use account names that include the @host portion, > and this broke the server and credentials parsing in smtp(1). Sometimes > I see these @ characters encoded as %40, but smtp(1) was not decoding > these url escape

Re: smtpd: document "pki" option for relay delivery in smtpd.conf(5)

2020-09-14 Thread Todd C . Miller
On Sun, 13 Sep 2020 20:45:35 +0800, Nick Gasson wrote: > I struggled a bit to configure smtpd to relay to a remote server that > requires SSL client certificates. The solution is to just add a "pki > host.example.org" option, but "pki" is not listed as a valid option for > the relay delivery

Re: smtpd: document "pki" option for relay delivery in smtpd.conf(5)

2020-09-13 Thread Todd C . Miller
On Sun, 13 Sep 2020 20:45:35 +0800, Nick Gasson wrote: > I struggled a bit to configure smtpd to relay to a remote server that > requires SSL client certificates. The solution is to just add a "pki > host.example.org" option, but "pki" is not listed as a valid option for > the relay delivery

Re: basename(3) should have non-const arg, says POSIX

2020-09-12 Thread Todd C . Miller
On Sat, 12 Sep 2020 17:05:02 +0200, Christian Weisgerber wrote: > A make build with the patch below succeeds, but gains some new > warnings "passing 'const char *' to parameter of type 'char *' > discards qualifiers". > > This is a portability trap. Code written on OpenBSD may not be > prepared

Re: httpd: use the original uri for REQUEST_URI

2020-09-11 Thread Todd C . Miller
On Fri, 11 Sep 2020 16:55:35 +0900, YASUOKA Masahiko wrote: > Anyone? > > This is a tiny change but makes httpd(8) more correct. > The diff is not so complicated. OK millert@ - todd

  1   2   3   4   5   6   7   8   9   10   >