]> git.ipfire.org Git - thirdparty/openssh-portable.git/log
thirdparty/openssh-portable.git
4 days agomention sntrup761x25519-sha512 in manpages V_8_9 anongit/V_8_9 github-selfhosted/V_8_9 github/V_8_9
Damien Miller [Tue, 12 Aug 2025 23:16:34 +0000 (09:16 +1000)] 
mention sntrup761x25519-sha512 in manpages

Spotted by Colin Watson

6 days agosupport sntrup761x25519-sha512 alias
Damien Miller [Mon, 11 Aug 2025 05:36:27 +0000 (15:36 +1000)] 
support sntrup761x25519-sha512 alias

OpenSSH 8.9 supports the sntrup761x25519-sha512@openssh.com
key agreement algorithm. As part of standardisation, this algorithm
has been assigned the name sntrup761x25519-sha512.

This commit enables the existing algorithm under this new name.

3 years agoOnly return events from ppoll that were requested.
Darren Tucker [Fri, 1 Apr 2022 12:38:44 +0000 (23:38 +1100)] 
Only return events from ppoll that were requested.

If the underlying system's select() returns bits that were not in the
request set, our ppoll() implementation can return revents for events
not requested, which can apparently cause a hang.  Only return revents
for activity in the requested event set.  bz#3416, analysis and fix by
yaroslav.kuzmin at vmssoftware com, ok djm@

3 years agoResync fmt_scaled. with OpenBSD.
Darren Tucker [Fri, 11 Mar 2022 07:43:58 +0000 (18:43 +1100)] 
Resync fmt_scaled. with OpenBSD.

Fixes underflow reported in bz#3401.

3 years agoDefault to not using sandbox when cross compiling.
Darren Tucker [Tue, 8 Mar 2022 09:04:06 +0000 (20:04 +1100)] 
Default to not using sandbox when cross compiling.

On most systems poll(2) does not work when the number of FDs is reduced
with setrlimit, so assume it doesn't when cross compiling and we can't
run the test.  bz#3398.

3 years agoupstream: pack pollfd array before server_accept_loop() ppoll()
djm@openbsd.org [Tue, 1 Mar 2022 01:59:19 +0000 (01:59 +0000)] 
upstream: pack pollfd array before server_accept_loop() ppoll()

call, and terminate sshd if ppoll() returns errno==EINVAL

avoids spin in ppoll when MaxStartups > RLIMIT_NOFILE, reported by
Daniel Micay

feedback/ok deraadt

OpenBSD-Commit-ID: dbab1c24993ac977ec24d83283b8b7528f7c2c15

3 years agoAllow ppoll_time64 in seccomp sandbox.
Darren Tucker [Sat, 26 Feb 2022 03:06:14 +0000 (14:06 +1100)] 
Allow ppoll_time64 in seccomp sandbox.

Should fix sandbox violations on (some? at least i386 and armhf) 32bit
Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
debian.org via bz#3396.

3 years agoImprove detection of -fzero-call-used-regs=all support
Colin Watson [Thu, 24 Feb 2022 16:04:18 +0000 (16:04 +0000)] 
Improve detection of -fzero-call-used-regs=all support

GCC doesn't tell us whether this option is supported unless it runs into
the situation where it would need to emit corresponding code.

3 years agoupstream: free(3) wants stdlib.h
djm@openbsd.org [Wed, 23 Feb 2022 21:21:49 +0000 (21:21 +0000)] 
upstream: free(3) wants stdlib.h

OpenBSD-Commit-ID: 227a8c70a95b4428c49e46863c9ef4bd318a3b8a

3 years agomakedepend V_8_9_P1
Damien Miller [Wed, 23 Feb 2022 11:31:11 +0000 (22:31 +1100)] 
makedepend

3 years agoupstream: avoid integer overflow of auth attempts (harmless, caught
djm@openbsd.org [Wed, 23 Feb 2022 11:18:13 +0000 (11:18 +0000)] 
upstream: avoid integer overflow of auth attempts (harmless, caught

by monitor)

OpenBSD-Commit-ID: 488ad570b003b21e0cd9e7a00349cfc1003b4d86

3 years agoupstream: randomise the password used in fakepw
djm@openbsd.org [Wed, 23 Feb 2022 11:17:10 +0000 (11:17 +0000)] 
upstream: randomise the password used in fakepw

OpenBSD-Commit-ID: 34e159f73b1fbf0a924a9c042d8d61edde293947

3 years agoupstream: use asprintf to construct .rhosts paths
djm@openbsd.org [Wed, 23 Feb 2022 11:15:57 +0000 (11:15 +0000)] 
upstream: use asprintf to construct .rhosts paths

OpenBSD-Commit-ID: 8286e8d3d2c6ff916ff13d041d1713073f738a8b

3 years agoupstream: openssh-8.9
djm@openbsd.org [Wed, 23 Feb 2022 11:07:09 +0000 (11:07 +0000)] 
upstream: openssh-8.9

OpenBSD-Commit-ID: 5c5f791c87c483cdab6d9266b43acdd9ca7bde0e

3 years agoExtend select+rlimit sanbox test to include poll.
Darren Tucker [Tue, 22 Feb 2022 04:29:22 +0000 (15:29 +1100)] 
Extend select+rlimit sanbox test to include poll.

POSIX specifies that poll() shall fail if "nfds argument is greater
than {OPEN_MAX}".  The setrlimit sandbox sets this to effectively zero
so this causes poll() to fail in the preauth privsep process.

This is likely the underlying cause for the previously observed similar
behaviour of select() on plaforms where it is implement in userspace on
top of poll().

3 years agoAdd Alpine Linux test VM.
Darren Tucker [Tue, 22 Feb 2022 02:08:59 +0000 (13:08 +1100)] 
Add Alpine Linux test VM.

3 years agoInclude sys/param.h if present.
Darren Tucker [Tue, 22 Feb 2022 01:27:07 +0000 (12:27 +1100)] 
Include sys/param.h if present.

Needed for howmany() on MUSL systems such as Alpine.

3 years agoOnly include sys/poll.h if we don't have poll.h.
Darren Tucker [Tue, 22 Feb 2022 01:25:52 +0000 (12:25 +1100)] 
Only include sys/poll.h if we don't have poll.h.

Prevents warnings on MUSL based systems such as Alpine.

3 years agodisable agent-restrict test on minix3
Damien Miller [Tue, 22 Feb 2022 00:14:51 +0000 (11:14 +1100)] 
disable agent-restrict test on minix3

Minix seems to have a platform-wide limit on the number of
select(2) syscalls that can be concurrently issued. This test
seems to exceed this limit.

Refer to:

https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/R3.3.0/minix/servers/vfs/select.c#L114
https://github.com/Stichting-MINIX-Research-Foundation/minix/blob/R3.3.0/minix/servers/vfs/select.c#L30-L31

3 years agoSkip agent-getpeereid when running as root.
Darren Tucker [Mon, 21 Feb 2022 10:27:20 +0000 (21:27 +1100)] 
Skip agent-getpeereid when running as root.

3 years agoupstream: Aproximate realpath on the expected output by deduping
dtucker@openbsd.org [Sun, 20 Feb 2022 03:47:26 +0000 (03:47 +0000)] 
upstream: Aproximate realpath on the expected output by deduping

leading slashes. Fixes test failure when user's home dir is / which is
possible in some portable configurations.

OpenBSD-Regress-ID: 53b8c53734f8893806961475c7106397f98d9f63

3 years agoReally move DSA to end of list.
Darren Tucker [Sun, 20 Feb 2022 02:30:52 +0000 (13:30 +1100)] 
Really move DSA to end of list.

In commit ad16a84e syncing from OpenBSD, RSA was accidentally moved to
the end of the list instead of DSA.  Spotted by andrew at fyfe.gb.net.

3 years agoAdd test configs for MUSL C library.
Darren Tucker [Fri, 18 Feb 2022 01:12:21 +0000 (12:12 +1100)] 
Add test configs for MUSL C library.

3 years agominix needs BROKEN_POLL too; chokes on /dev/null
Damien Miller [Thu, 17 Feb 2022 11:54:19 +0000 (22:54 +1100)] 
minix needs BROKEN_POLL too; chokes on /dev/null

3 years agoupstream: check for EINTR/EAGAIN failures in the rfd fast-path; caught
djm@openbsd.org [Thu, 17 Feb 2022 10:58:27 +0000 (10:58 +0000)] 
upstream: check for EINTR/EAGAIN failures in the rfd fast-path; caught

by dtucker's minix3 vm :) ok dtucker@

OpenBSD-Commit-ID: 2e2c895a3e82ef347aa6694394a76a438be91361

3 years agoComment hurd test, the VM is currently broken.
Darren Tucker [Thu, 17 Feb 2022 11:05:29 +0000 (22:05 +1100)] 
Comment hurd test, the VM is currently broken.

3 years agofind sk-dummy.so when build_dir != src_dir
Damien Miller [Thu, 17 Feb 2022 10:15:16 +0000 (21:15 +1100)] 
find sk-dummy.so when build_dir != src_dir

spotted by Corinna Vinschen; feedback & ok dtucker@

3 years agoupdate versions in preparation for 8.9 release
Damien Miller [Wed, 16 Feb 2022 05:26:17 +0000 (16:26 +1100)] 
update versions in preparation for 8.9 release

3 years agoupstream: document the unbound/host-bound options to
djm@openbsd.org [Tue, 15 Feb 2022 05:13:36 +0000 (05:13 +0000)] 
upstream: document the unbound/host-bound options to

PubkeyAuthentication; spotted by HARUYAMA Seigo

OpenBSD-Commit-ID: 298f681b66a9ecd498f0700082c7a6c46e948981

3 years agoTest if sshd accidentally acquires controlling tty
Darren Tucker [Mon, 14 Feb 2022 03:19:40 +0000 (14:19 +1100)] 
Test if sshd accidentally acquires controlling tty

When SSHD_ACQUIRES_CTTY is defined, test for the problematic behaviour
in the STREAMS code before activating the workaround.  ok djm@

3 years agoAdd cygwin-release test config.
Darren Tucker [Fri, 11 Feb 2022 23:24:56 +0000 (10:24 +1100)] 
Add cygwin-release test config.

This tests the flags used to build the cygwin release binaries.

3 years agoMove SSHD_ACQUIRES_CTTY workaround into compat.
Darren Tucker [Fri, 11 Feb 2022 10:00:35 +0000 (21:00 +1100)] 
Move SSHD_ACQUIRES_CTTY workaround into compat.

On some (most? all?) SysV based systems with STREAMS based ptys,
sshd could acquire a controlling terminal during pty setup when
it pushed the "ptem" module, due to what is probably a bug in
the STREAMS driver that's old enough to vote.  Because it was the
privileged sshd's controlling terminal, it was not available for
the user's session, which ended up without one.  This is known to
affect at least Solaris <=10, derivatives such as OpenIndiana and
several other SysV systems.  See bz#245 for the backstory.

In the we past worked around that by not calling setsid in the
privileged sshd child, which meant it was not a session or process
group leader.  This solved controlling terminal problem because sshd
was not eligble to acquire one, but had other side effects such as
not cleaning up helper subprocesses in the SIGALRM handler since it
was not PG leader.  Recent cleanups in the signal handler uncovered
this, resulting in the LoginGraceTime timer not cleaning up privsep
unprivileged processes.

This change moves the workaround into the STREAMS pty allocation code,
by allocating a sacrificial pty to act as sshd's controlling terminal
before allocating user ptys, so those are still available for users'
sessions.

On the down side:
 - this will waste a pty per ssh connection on affected platforms.

On the up side:
 - it makes the process group behaviour consistent between platforms.

 - it puts the workaround nearest the code that actually causes the
   problem and competely out of the mainline code.

 - the workaround is only activated if you use the STREAMS code.  If,
   say, Solaris 11 has the bug but also a working openpty() it doesn't
   matter that we defined SSHD_ACQUIRES_CTTY.

 - the workaround is only activated when the fist pty is allocated,
   ie in the post-auth privsep monitor.  This means there's no risk
   of fd leaks to the unprivileged processes, and there's no effect on
   sessions that do not allocate a pty.

Based on analysis and work by djm@, ok djm@

3 years agoSimplify handling of --with-ssl-dir.
Darren Tucker [Fri, 11 Feb 2022 09:09:32 +0000 (20:09 +1100)] 
Simplify handling of --with-ssl-dir.

ok djm@

3 years agoStop testing OpenBSD HEAD on 6.9 and 7.0.
Darren Tucker [Fri, 11 Feb 2022 02:39:29 +0000 (13:39 +1100)] 
Stop testing OpenBSD HEAD on 6.9 and 7.0.

HEAD is not guaranteed to work on previous stable branches, and at the
moment is broken due to libfido API changes.

3 years agoupstream: Always initialize delim before passing to hpdelim2 which
dtucker@openbsd.org [Fri, 11 Feb 2022 00:43:56 +0000 (00:43 +0000)] 
upstream: Always initialize delim before passing to hpdelim2 which

might not set it. Found by the Valgrind tests on github, ok deraadt@

OpenBSD-Commit-ID: c830c0db185ca43beff3f41c19943c724b4f636d

3 years agoFix helper include path and remove excess code.
Darren Tucker [Thu, 10 Feb 2022 23:03:06 +0000 (10:03 +1100)] 
Fix helper include path and remove excess code.

Looks like test_hpdelim.c was imported twice into the same file.
Spotted by kevin.brott at gmail com and chris at cataclysmal org.

3 years agoPut poll.h inside ifdef.
Darren Tucker [Thu, 10 Feb 2022 12:27:02 +0000 (23:27 +1100)] 
Put poll.h inside ifdef.

3 years agoWe now support POLLPRI so actually define it.
Darren Tucker [Thu, 10 Feb 2022 11:17:31 +0000 (22:17 +1100)] 
We now support POLLPRI so actually define it.

3 years agoupstream: Add test for empty hostname with port.
dtucker@openbsd.org [Sun, 6 Feb 2022 22:58:33 +0000 (22:58 +0000)] 
upstream: Add test for empty hostname with port.

OpenBSD-Regress-ID: e19e89d3c432b68997667efea44cf015bbe2a7e3

3 years agoupstream: Add unit tests for hpdelim.
dtucker@openbsd.org [Fri, 4 Feb 2022 07:53:44 +0000 (07:53 +0000)] 
upstream: Add unit tests for hpdelim.

OpenBSD-Regress-ID: be97b85c19895e6a1ce13c639765a3b48fd95018

3 years agoupstream: revert for imminent OpenSSH release, which wil ship with
djm@openbsd.org [Thu, 10 Feb 2022 04:12:38 +0000 (04:12 +0000)] 
upstream: revert for imminent OpenSSH release, which wil ship with

scp in RCP mode.

> revision 1.106
> date: 2021/10/15 14:46:46;  author: deraadt;  state: Exp;  lines: +13 -9;  commitid: w5n9B2RE38tFfggl;
> openbsd 7.0 release shipped with the (hopefully last) scp that uses RCP
> protocol for copying.  Let's get back to testing the SFTP protocol.

This will be put back once the OpenSSH release is done.

OpenBSD-Commit-ID: 0c725481a78210aceecff1537322c0b2df03e768

3 years agoupstream: Switch hpdelim interface to accept only ":" as delimiter.
dtucker@openbsd.org [Tue, 8 Feb 2022 08:59:12 +0000 (08:59 +0000)] 
upstream: Switch hpdelim interface to accept only ":" as delimiter.

Historicallly, hpdelim accepted ":" or "/" as a port delimiter between
hosts (or addresses) and ports.  These days most of the uses for "/"
are no longer accepted, so there are several places where it checks the
delimiter to disallow it.  Make hpdelim accept only ":" and use hpdelim2
in the other cases.  ok djm@

OpenBSD-Commit-ID: 7e6420bd1be87590b6840973f5ad5305804e3102

3 years agofix typos in previous
pedro martelletto [Mon, 7 Feb 2022 08:09:59 +0000 (09:09 +0100)] 
fix typos in previous

3 years agocompat code for fido_assert_set_clientdata()
Damien Miller [Mon, 7 Feb 2022 01:53:47 +0000 (12:53 +1100)] 
compat code for fido_assert_set_clientdata()

3 years agoupstream: use libfido2 1.8.0+ fido_assert_set_clientdata() instead
djm@openbsd.org [Mon, 7 Feb 2022 01:25:12 +0000 (01:25 +0000)] 
upstream: use libfido2 1.8.0+ fido_assert_set_clientdata() instead

of manually hashing data outselves. Saves a fair bit of code and makes life
easier for some -portable platforms.

OpenBSD-Commit-ID: 351dfaaa5ab1ee928c0e623041fca28078cff0e0

3 years agoupstream: remove please from manual pages ok jmc@ sthen@ millert@
jsg@openbsd.org [Sun, 6 Feb 2022 00:29:03 +0000 (00:29 +0000)] 
upstream: remove please from manual pages ok jmc@ sthen@ millert@

OpenBSD-Commit-ID: 6543acb00f4f38a23472538e1685c013ca1a99aa

3 years agoupstream: Since they are deprecated, move DSA to the end of the
dtucker@openbsd.org [Fri, 4 Feb 2022 02:49:17 +0000 (02:49 +0000)] 
upstream: Since they are deprecated, move DSA to the end of the

default list of public keys so that they will be tried last.  From github
PR#295 from "ProBackup-nl", ok djm@

OpenBSD-Commit-ID: 7e5d575cf4971d4e2de92e0b6d6efaba53598bf0

3 years agoportable-specific string array constification
Damien Miller [Wed, 2 Feb 2022 05:52:07 +0000 (16:52 +1100)] 
portable-specific string array constification

from Mike Frysinger

3 years agoupstream: test 'ssh-keygen -Y find-principals' with wildcard
djm@openbsd.org [Tue, 1 Feb 2022 23:37:15 +0000 (23:37 +0000)] 
upstream: test 'ssh-keygen -Y find-principals' with wildcard

principals; from Fabian Stelzer

OpenBSD-Regress-ID: fbe4da5f0032e7ab496527a5bf0010fd700f8f40

3 years agoupstream: Enable all supported ciphers and macs in the server
dtucker@openbsd.org [Fri, 21 Jan 2022 02:54:41 +0000 (02:54 +0000)] 
upstream: Enable all supported ciphers and macs in the server

before trying to benchmark them.  Increase the data file size to get more
signal.

OpenBSD-Regress-ID: dc3697d9f7defdfc51c608782c8e750128e46eb6

3 years agoupstream: allow 'ssh-keygen -Y find-principals' to match wildcard
djm@openbsd.org [Tue, 1 Feb 2022 23:34:47 +0000 (23:34 +0000)] 
upstream: allow 'ssh-keygen -Y find-principals' to match wildcard

principals in allowed_signers files; from Fabian Stelzer

OpenBSD-Commit-ID: 1e970b9c025b80717dddff5018fe5e6f470c5098

3 years agoupstream: mark const string array contents const too, i.e. static
djm@openbsd.org [Tue, 1 Feb 2022 23:32:51 +0000 (23:32 +0000)] 
upstream: mark const string array contents const too, i.e. static

const char *array => static const char * const array from Mike Frysinger

OpenBSD-Commit-ID: a664e31ea6a795d7c81153274a5f47b22bdc9bc1

3 years agoupstream: better match legacy scp behaviour: show un-expanded paths
djm@openbsd.org [Tue, 1 Feb 2022 23:11:11 +0000 (23:11 +0000)] 
upstream: better match legacy scp behaviour: show un-expanded paths

in error messages. Spotted by and ok tb@

OpenBSD-Commit-ID: 866c8ffac5bd7d38ecbfc3357c8adfa58af637b7

3 years agoupstream: Remove explicit kill of privsep preauth child's PID in
dtucker@openbsd.org [Tue, 1 Feb 2022 07:57:32 +0000 (07:57 +0000)] 
upstream: Remove explicit kill of privsep preauth child's PID in

SIGALRM handler. It's no longer needed since the child will get terminated by
the SIGTERM to the process group that cleans up any auth helpers, it
simplifies the signal handler and removes the risk of a race when updating
the PID. Based on analysis by HerrSpace in github PR#289, ok djm@

OpenBSD-Commit-ID: 2be1ffa28b4051ad9e33bb4371e2ec8a31d6d663

3 years agoupstream: When it's the possessive of 'it', it's spelled "its",
guenther@openbsd.org [Fri, 28 Jan 2022 06:18:42 +0000 (06:18 +0000)] 
upstream: When it's the possessive of 'it', it's spelled "its",

without the apostrophe.

OpenBSD-Commit-ID: fb6ab9c65bd31de831da1eb4631ddac018c5fae7

3 years agosandbox-seccomp-filter: allow gettid
Alex James [Sun, 30 Jan 2022 22:13:36 +0000 (16:13 -0600)] 
sandbox-seccomp-filter: allow gettid

Some allocators (such as Scudo) use gettid while tracing allocations [1].
Allow gettid in preauth to prevent sshd from crashing with Scudo.

[1]: https://github.com/llvm/llvm-project/blob/llvmorg-13.0.0/compiler-rt/lib/gwp_asan/common.cpp#L46

3 years agoupstream: add a ssh_packet_process_read() function that reads from
djm@openbsd.org [Sat, 22 Jan 2022 00:49:34 +0000 (00:49 +0000)] 
upstream: add a ssh_packet_process_read() function that reads from

a fd directly into the transport input buffer.

Use this in the client and server mainloops to avoid unnecessary
copying. It also lets us use a more greedy read size without penalty.

Yields a 2-3% performance gain on cipher-speed.sh (in a fairly
unscientific test tbf)

feedback dtucker@ ok markus@

OpenBSD-Commit-ID: df4112125bf79d8e38e79a77113e1b373078e632

3 years agoupstream: Use sshbuf_read() to read directly into the channel input
djm@openbsd.org [Sat, 22 Jan 2022 00:45:31 +0000 (00:45 +0000)] 
upstream: Use sshbuf_read() to read directly into the channel input

buffer rather than into a stack buffer that needs to be copied again;
Improves performance by about 1% on cipher-speed.sh feedback dtucker@ ok
markus@

OpenBSD-Commit-ID: bf5e6e3c821ac3546dc8241d8a94e70d47716572

3 years agodepend
Damien Miller [Tue, 25 Jan 2022 00:52:34 +0000 (11:52 +1100)] 
depend

3 years agoupstream: Add a sshbuf_read() that attempts to read(2) directly in
djm@openbsd.org [Sat, 22 Jan 2022 00:43:43 +0000 (00:43 +0000)] 
upstream: Add a sshbuf_read() that attempts to read(2) directly in

to a sshbuf; ok markus@

OpenBSD-Commit-ID: 2d8f249040a4279f3bc23c018947384de8d4a45b

3 years agoupstream: add a helper for writing an error message to the
djm@openbsd.org [Fri, 21 Jan 2022 07:04:19 +0000 (07:04 +0000)] 
upstream: add a helper for writing an error message to the

stderr_buf and setting quit_pending; no functional change but saves a bunch
of boilerplate

OpenBSD-Commit-ID: 0747657cad6b9eabd514a6732adad537568e232d

3 years agoupstream: correct comment and use local variable instead of long
djm@openbsd.org [Fri, 21 Jan 2022 06:58:06 +0000 (06:58 +0000)] 
upstream: correct comment and use local variable instead of long

indirection; spotted by dtucker@

OpenBSD-Commit-ID: 5f65f5f69db2b7d80a0a81b08f390a63f8845965

3 years agoupstream: When poll(2) returns -1, for some error conditions
deraadt@openbsd.org [Fri, 21 Jan 2022 00:53:40 +0000 (00:53 +0000)] 
upstream: When poll(2) returns -1, for some error conditions

pfd[].revents is not cleared.  There are subtle errors in various programs.
In this particular case, the program should error out. ok djm millert

OpenBSD-Commit-ID: 00f839b16861f7fb2adcf122e95e8a82fa6a375c

3 years agorestore tty force-read hack
Damien Miller [Sat, 22 Jan 2022 00:38:21 +0000 (11:38 +1100)] 
restore tty force-read hack

This portable-specific hack fixes a hang on exit for ttyful sessions
on Linux and some SysVish Unix variants. It was accidentally disabled
in commit 5c79952dfe1a (a precursor to the mainloop poll(2) conversion).

Spotted by John in bz3383

3 years agoFix signedness bug in Cygwin code
Corinna Vinschen [Thu, 20 Jan 2022 16:22:56 +0000 (03:22 +1100)] 
Fix signedness bug in Cygwin code

The Cygwin-specific pattern match code has a bug.  It checks
the size_t value returned by mbstowcs for being < 0.  The right
thing to do is to check against (size_t) -1.  Fix that.

Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
3 years agoImprove compatibility of early exit trap handling.
Darren Tucker [Thu, 20 Jan 2022 02:26:27 +0000 (13:26 +1100)] 
Improve compatibility of early exit trap handling.

Dash (as used by the github runners) has some differences in its trap
builtin:
 - it doesn't have -p (which is fine, that's not in posix).
 - it doesn't work in a subshell (which turns out to be in compliance
   with posix, which means bash isn't).
 - it doesn't work in a pipeline, ie "trap|cat" produces no output.

3 years agoMove more tests out of valgrind-1 runner.
Darren Tucker [Wed, 19 Jan 2022 13:49:57 +0000 (00:49 +1100)] 
Move more tests out of valgrind-1 runner.

3 years agoInvoke EXIT handler early when using Valgrind.
Darren Tucker [Wed, 19 Jan 2022 04:37:39 +0000 (15:37 +1100)] 
Invoke EXIT handler early when using Valgrind.

When using Valgrind, we need to wait for all invoked programs to
complete before checking their valgrind logs.  Some tests, notably
agent-restrict, set an EXIT trap handler to clean up things like
ssh-agent, but those do not get invoked until test-exec.sh exits.
This causes the Valgrind wait to deadlock, so if present invoke
the EXIT handler before checking the Valgrind logs.

3 years agoRemove line leftover from upstream sync.
Darren Tucker [Tue, 18 Jan 2022 01:55:21 +0000 (12:55 +1100)] 
Remove line leftover from upstream sync.

3 years agoupstream: when decompressing zlib compressed packets, use
djm@openbsd.org [Mon, 17 Jan 2022 22:56:04 +0000 (22:56 +0000)] 
upstream: when decompressing zlib compressed packets, use

Z_SYNC_FLUSH instead of Z_PARTIAL_FLUSH as the latter is not actually
specified as a valid mode for inflate(). There should be no practical change
in behaviour as the compression side ensures a flush that should make all
data available to the receiver in all cases.

repoted by lamm AT ibm.com via bz3372; ok markus

OpenBSD-Commit-ID: 67cfc1fa8261feae6d2cc0c554711c97867cc81b

3 years agoupstream: make most of the sftp errors more idiomatic, following
djm@openbsd.org [Mon, 17 Jan 2022 21:41:04 +0000 (21:41 +0000)] 
upstream: make most of the sftp errors more idiomatic, following

the general form of "[local/remote] operation path: error message"; ok markus

OpenBSD-Commit-ID: 61364cd5f3a9fecaf8d63b4c38a42c0c91f8b571

3 years agoupstream: when transferring multiple files in SFTP mode, create the
djm@openbsd.org [Mon, 17 Jan 2022 21:39:51 +0000 (21:39 +0000)] 
upstream: when transferring multiple files in SFTP mode, create the

destination directory if it doesn't already exist to match olde-scp(1)
behaviour. noticed by deraadt@ ok markus@

OpenBSD-Commit-ID: cf44dfa231d4112f697c24ff39d7ecf2e6311407

3 years agoupstream: allow pin-required FIDO keys to be added to ssh-agent(1).
djm@openbsd.org [Fri, 14 Jan 2022 03:43:48 +0000 (03:43 +0000)] 
upstream: allow pin-required FIDO keys to be added to ssh-agent(1).

ssh-askpass will be used to request the PIN at authentication time.

From Pedro Martelletto, ok djm

OpenBSD-Commit-ID: de8189fcd35b45f632484864523c1655550e2950

3 years agoupstream: ssh-sk: free a resident key's user id
djm@openbsd.org [Fri, 14 Jan 2022 03:35:10 +0000 (03:35 +0000)] 
upstream: ssh-sk: free a resident key's user id

From Pedro Martelletto; ok dtucker & me

OpenBSD-Commit-ID: 47be40d602b7a6458c4c71114df9b53d149fc2e9

3 years agoupstream: sshsk_load_resident: don't preallocate resp
djm@openbsd.org [Fri, 14 Jan 2022 03:34:00 +0000 (03:34 +0000)] 
upstream: sshsk_load_resident: don't preallocate resp

resp is allocated by client_converse(), at which point we lose
the original pointer.

From Pedro Martelletto; ok dtucker & me

OpenBSD-Commit-ID: 1f1b5ea3282017d6584dfed4f8370dc1db1f44b1

3 years agoupstream: sshsk_sign: trim call to sshkey_fingerprint()
djm@openbsd.org [Fri, 14 Jan 2022 03:32:52 +0000 (03:32 +0000)] 
upstream: sshsk_sign: trim call to sshkey_fingerprint()

the resulting fingerprint doesn't appear to be used for anything,
and we end up leaking it.

from Pedro Martelletto; ok dtucker & me

OpenBSD-Commit-ID: 5625cf6c68f082bc2cbbd348e69a3ed731d2f9b7

3 years agoupstream: use status error message to communicate ~user expansion
djm@openbsd.org [Fri, 14 Jan 2022 03:31:52 +0000 (03:31 +0000)] 
upstream: use status error message to communicate ~user expansion

failures; provides better experience for scp in sftp mode, where ~user paths
are more likely to be used; spotted jsg, feedback jsg & deraadt ok jsg &
markus

(forgot to include this file in previous commit)

OpenBSD-Commit-ID: d37cc4c8c861ce48cd6ea9899e96aaac3476847b

3 years agofix edge case in poll(2) wrapper
Damien Miller [Fri, 14 Jan 2022 02:49:32 +0000 (13:49 +1100)] 
fix edge case in poll(2) wrapper

Correct handling of select(2) exceptfds. These should only be consulted
for POLLPRI flagged pfds and not unconditionally converted to POLLERR.

with and ok dtucker@

3 years agoWrap OpenSSL includes in unit tests in ifdef.
Darren Tucker [Fri, 14 Jan 2022 02:46:35 +0000 (13:46 +1100)] 
Wrap OpenSSL includes in unit tests in ifdef.

Fixes unit test on systems that do not have OpenSSL headers installed.

3 years agoRemove sort wrapper.
Darren Tucker [Thu, 13 Jan 2022 04:53:33 +0000 (15:53 +1100)] 
Remove sort wrapper.

agent-restrict now takes care of this itself.

3 years agoupstream: Set LC_ALL in both local and remote shells so that sorted
dtucker@openbsd.org [Thu, 13 Jan 2022 04:53:16 +0000 (04:53 +0000)] 
upstream: Set LC_ALL in both local and remote shells so that sorted

output matches regardless of what the user's shell sets it to.  ok djm@

OpenBSD-Regress-ID: 4e97dd69a68b05872033175a4c2315345d01837f

3 years agoupstream: Avoid %'s in commands (not used in OpenBSD, but used in
dtucker@openbsd.org [Thu, 13 Jan 2022 04:22:10 +0000 (04:22 +0000)] 
upstream: Avoid %'s in commands (not used in OpenBSD, but used in

-portable's Valgrind test) being interpretted as printf format strings.

OpenBSD-Regress-ID: dc8655db27ac4acd2c386c4681bf42a10d80b043

3 years agoStop on first test failure to minimize logs.
Darren Tucker [Wed, 12 Jan 2022 05:58:13 +0000 (16:58 +1100)] 
Stop on first test failure to minimize logs.

3 years agoupstream: Use egrep when searching for an anchored string.
dtucker@openbsd.org [Wed, 12 Jan 2022 07:18:37 +0000 (07:18 +0000)] 
upstream: Use egrep when searching for an anchored string.

OpenBSD-Regress-ID: dd114a2ac27ac4b06f9e4a586d3f6320c54aeeb4

3 years agoAdd "rev" command replacement if needed.
Darren Tucker [Wed, 12 Jan 2022 07:25:06 +0000 (18:25 +1100)] 
Add "rev" command replacement if needed.

3 years agoupstream: Don't log NULL hostname in restricted agent code,
dtucker@openbsd.org [Wed, 12 Jan 2022 03:30:32 +0000 (03:30 +0000)] 
upstream: Don't log NULL hostname in restricted agent code,

printf("%s", NULL) is not safe on all platforms.  with & ok djm

OpenBSD-Commit-ID: faf10cdae4adde00cdd668cd1f6e05d0a0e32a02

3 years agoupstream: remove hardcoded domain and use window.location.host, so this
djm@openbsd.org [Tue, 11 Jan 2022 22:33:16 +0000 (22:33 +0000)] 
upstream: remove hardcoded domain and use window.location.host, so this

can be run anywhere

OpenBSD-Regress-ID: 2ac2ade3b6227d9c547351d3ccdfe671e62b7f92

3 years agoupstream: "void" functions should not return anything. From Tim Rice
dtucker@openbsd.org [Tue, 11 Jan 2022 02:56:19 +0000 (02:56 +0000)] 
upstream: "void" functions should not return anything. From Tim Rice

via -portable.

OpenBSD-Commit-ID: ce6616304f4c9881b46413e616b226c306830e2a

3 years agoupstream: suppress "Connection to xxx closed" messages at LogLevel >=
djm@openbsd.org [Tue, 11 Jan 2022 01:26:47 +0000 (01:26 +0000)] 
upstream: suppress "Connection to xxx closed" messages at LogLevel >=

error bz3378; ok dtucker@

OpenBSD-Commit-ID: d5bf457d5d2eb927b81d0663f45248a31028265c

3 years agoOS X poll(2) is broken; use compat replacement
Damien Miller [Tue, 11 Jan 2022 21:57:49 +0000 (08:57 +1100)] 
OS X poll(2) is broken; use compat replacement

Darwin's poll(2) implementation is broken. For character-special
devices like /dev/null, it returns POLLNVAL when polled with
POLLIN.

Apparently this is Apple bug 3710161, which is AFAIK not public,
but a websearch will find other OSS projects rediscovering it
periodically since it was first identified in 2005 (!!)

3 years agolibhardended_malloc.so moved into out dir.
Darren Tucker [Tue, 11 Jan 2022 09:56:01 +0000 (20:56 +1100)] 
libhardended_malloc.so moved into out dir.

3 years agoMake USL compilers happy
Tim Rice [Mon, 10 Jan 2022 19:07:04 +0000 (11:07 -0800)] 
Make USL compilers happy
UX:acomp: ERROR: "sftp-server.c", line 567: void function cannot return value

3 years agoAdd wrapper for "sort" to set LC_ALL=C.
Darren Tucker [Mon, 10 Jan 2022 10:07:38 +0000 (21:07 +1100)] 
Add wrapper for "sort" to set LC_ALL=C.

Found by djm, this should make sorts stable and reduce test flakiness.

3 years agoupstream: Remove errant "set -x" left over from debugging.
dtucker@openbsd.org [Sat, 8 Jan 2022 07:55:26 +0000 (07:55 +0000)] 
upstream: Remove errant "set -x" left over from debugging.

OpenBSD-Regress-ID: cd989268e034264cec5df97be7581549032c87dc

3 years agoupstream: Enable all supported hostkey algorithms (but no others).
dtucker@openbsd.org [Sat, 8 Jan 2022 07:01:13 +0000 (07:01 +0000)] 
upstream: Enable all supported hostkey algorithms (but no others).

Allows hostbased test to pass when built without OpenSSL.

OpenBSD-Regress-ID: 5ddd677a68b672517e1e78460dc6ca2ccc0a9562

3 years agoupstream: use status error message to communicate ~user expansion
djm@openbsd.org [Sat, 8 Jan 2022 07:37:32 +0000 (07:37 +0000)] 
upstream: use status error message to communicate ~user expansion

failures; provides better experience for scp in sftp mode, where ~user paths
are more likely to be used; spotted jsg, feedback jsg & deraadt ok jsg &
markus

OpenBSD-Commit-ID: fc610ce00ca0cdc2ecdabbd49ce7cb82033f905f

3 years agoupstream: fix some corner-case bugs in scp sftp-mode handling of
djm@openbsd.org [Sat, 8 Jan 2022 07:36:11 +0000 (07:36 +0000)] 
upstream: fix some corner-case bugs in scp sftp-mode handling of

~-prefixed paths; spotted by jsg; feedback jsg & deraadt, ok jsg & markus

OpenBSD-Commit-ID: d1697dbaaa9f0f5649d69be897eab25c7d37c222

3 years agoupstream: more idiomatic error messages; spotted by jsg & deraadt
djm@openbsd.org [Sat, 8 Jan 2022 07:34:57 +0000 (07:34 +0000)] 
upstream: more idiomatic error messages; spotted by jsg & deraadt

ok jsg & markus

OpenBSD-Commit-ID: 43618c692f3951747b4151c477c7df22afe2bcc8

3 years agoupstream: add a variant of send_status() that allows overriding the
djm@openbsd.org [Sat, 8 Jan 2022 07:33:54 +0000 (07:33 +0000)] 
upstream: add a variant of send_status() that allows overriding the

default, generic error message. feedback/ok markus & jsg

OpenBSD-Commit-ID: 81f251e975d759994131b717ee7c0b439659c40f

3 years agoupstream: refactor tilde_expand_filename() and make it handle ~user
djm@openbsd.org [Sat, 8 Jan 2022 07:32:45 +0000 (07:32 +0000)] 
upstream: refactor tilde_expand_filename() and make it handle ~user

paths with no trailing slash; feedback/ok markus and jsg

OpenBSD-Commit-ID: a2ab365598a902f0f14ba6a4f8fb2d07a9b5d51d