OpenBSD CVS

CVS log for src/usr.bin/ssh/mux.c


[BACK] Up to [local] / src / usr.bin / ssh

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.101 / (download) - annotate - [select for diffs], Thu Nov 23 03:37:05 2023 UTC (5 months, 3 weeks ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Include existing mux path in debug message.

Revision 1.100 / (download) - annotate - [select for diffs], Fri Aug 18 01:37:41 2023 UTC (8 months, 4 weeks ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.99: +4 -2 lines
Diff to previous 1.99 (colored)

fix regression in OpenSSH 9.4 (mux.c r1.99) that caused multiplexed
sessions to ignore SIGINT under some circumstances. Reported by /
feedback naddy@, ok dtucker@

Revision 1.99 / (download) - annotate - [select for diffs], Fri Aug 4 06:32:40 2023 UTC (9 months, 1 week ago) by dtucker
Branch: MAIN
Changes since 1.98: +22 -13 lines
Diff to previous 1.98 (colored)

Apply ConnectTimeout to multiplexing local socket connections.  If the
multiplex socket exists but the connection times out, ssh will fall back
to a direct connection the same way it would if the socket did not exist
at all.  ok djm@

Revision 1.98 / (download) - annotate - [select for diffs], Wed Jul 26 23:06:00 2023 UTC (9 months, 3 weeks ago) by djm
Branch: MAIN
Changes since 1.97: +11 -5 lines
Diff to previous 1.97 (colored)

make ssh -f (fork after authentication) work properly in multiplexed
cases (inc. ControlPersist). bz3589 bz3589
Based on patches by Peter Chubb; ok dtucker@

Revision 1.97 / (download) - annotate - [select for diffs], Tue Jun 20 23:59:33 2023 UTC (10 months, 3 weeks ago) by djm
Branch: MAIN
Changes since 1.96: +22 -7 lines
Diff to previous 1.96 (colored)

prepare for support for connecting to unix domain sockets using ssh -W
by explicitly decoding PORT_STREAMLOCAL (a negative number) from the u32
that's passed over the multiplexing socket; previously code would just
cast, which is UB.

Revision 1.96 / (download) - annotate - [select for diffs], Wed Mar 8 04:43:12 2023 UTC (14 months, 1 week ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.95: +1 -3 lines
Diff to previous 1.95 (colored)

Delete obsolete /* ARGSUSED */ lint comments.

ok miod@ millert@

Revision 1.95 / (download) - annotate - [select for diffs], Fri Jan 6 02:39:59 2023 UTC (16 months, 1 week ago) by djm
Branch: MAIN
Changes since 1.94: +3 -3 lines
Diff to previous 1.94 (colored)

Add channel_force_close()

This will forcibly close an open channel by simulating read/write errors,
draining the IO buffers and calling the detach function.

Previously the detach function was only ever called during channel garbage
collection, but there was no way to signal the user of a channel (e.g.
session.c) that its channel was being closed deliberately (vs. by the
usual state-machine logic). So this adds an extra "force" argument to the
channel cleanup callback to indicate this condition.

ok markus dtucker

Revision 1.94 / (download) - annotate - [select for diffs], Fri Jun 3 04:30:47 2022 UTC (23 months, 2 weeks ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.93: +5 -4 lines
Diff to previous 1.93 (colored)

Make SetEnv directives first-match-wins in both sshd_config and
sshd_config; previously if the same name was reused then the last
would win (which is the opposite to how the config is supposed to
work).

While there, make the ssh_config parsing more like sshd_config.

bz3438, ok dtucker

Revision 1.93 / (download) - annotate - [select for diffs], Thu May 5 00:55:11 2022 UTC (2 years ago) by djm
Branch: MAIN
Changes since 1.92: +2 -2 lines
Diff to previous 1.92 (colored)

mux.c: mark argument as const; from Martin Vahlensieck

Revision 1.92 / (download) - annotate - [select for diffs], Tue Jan 11 01:26:47 2022 UTC (2 years, 4 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

suppress "Connection to xxx closed" messages at LogLevel >= error
bz3378; ok dtucker@

Revision 1.91 / (download) - annotate - [select for diffs], Fri Jul 23 04:00:59 2021 UTC (2 years, 9 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.90: +3 -4 lines
Diff to previous 1.90 (colored)

Add a StdinNull directive to ssh_config(5) that allows the config
file to do the same thing as -n does on the ssh(1) commandline.
Patch from Volker Diels-Grabsch via GHPR231; ok dtucker

Revision 1.90 / (download) - annotate - [select for diffs], Tue Jul 13 23:48:36 2021 UTC (2 years, 10 months ago) by djm
Branch: MAIN
Changes since 1.89: +2 -3 lines
Diff to previous 1.89 (colored)

add a SessionType directive to ssh_config, allowing the configuration
file to offer equivalent control to the -N (no session) and -s
(subsystem) command-line flags.

Part of GHPR#231 by Volker Diels-Grabsch with some minor tweaks;
feedback and ok dtucker@

Revision 1.89 / (download) - annotate - [select for diffs], Fri Jun 4 05:02:40 2021 UTC (2 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.88: +7 -5 lines
Diff to previous 1.88 (colored)

allow ssh_config SetEnv to override $TERM, which is otherwise handled
specially by the protocol. Useful in ~/.ssh/config to set TERM to
something generic (e.g. "xterm" instead of "xterm-256color") for
destinations that lack terminfo entries. feedback and ok dtucker@

Revision 1.88 / (download) - annotate - [select for diffs], Wed May 19 01:24:05 2021 UTC (2 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.87: +4 -17 lines
Diff to previous 1.87 (colored)

restore blocking status on stdio fds before close

ssh(1) needs to set file descriptors to non-blocking mode to operate
but it was not restoring the original state on exit. This could cause
problems with fds shared with other programs via the shell, e.g.

> $ cat > test.sh << _EOF
> #!/bin/sh
> {
>         ssh -Fnone -oLogLevel=verbose ::1 hostname
>         cat /usr/share/dict/words
> } | sleep 10
> _EOF
> $ ./test.sh
> Authenticated to ::1 ([::1]:22).
> Transferred: sent 2352, received 2928 bytes, in 0.1 seconds
> Bytes per second: sent 44338.9, received 55197.4
> cat: stdout: Resource temporarily unavailable

This restores the blocking status for fds 0,1,2 (stdio) before ssh(1)
abandons/closes them.

This was reported as bz3280 and GHPR246; ok dtucker@

Revision 1.87 / (download) - annotate - [select for diffs], Sat Apr 3 06:18:40 2021 UTC (3 years, 1 month ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.86: +5 -5 lines
Diff to previous 1.86 (colored)

highly polished whitespace, mostly fixing spaces-for-tab and bad
indentation on continuation lines. Prompted by GHPR#185

Revision 1.86 / (download) - annotate - [select for diffs], Thu Oct 29 02:52:43 2020 UTC (3 years, 6 months ago) by djm
Branch: MAIN
Changes since 1.85: +3 -3 lines
Diff to previous 1.85 (colored)

whitespace; no code change

Revision 1.85 / (download) - annotate - [select for diffs], Sun Oct 18 11:32:01 2020 UTC (3 years, 6 months ago) by djm
Branch: MAIN
Changes since 1.84: +252 -286 lines
Diff to previous 1.84 (colored)

use the new variant log macros instead of prepending __func__ and
appending ssh_err(r) manually; ok markus@

Revision 1.84 / (download) - annotate - [select for diffs], Sat Oct 3 09:22:26 2020 UTC (3 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.83: +7 -19 lines
Diff to previous 1.83 (colored)

There are lots of place where we want to redirect stdin, stdout
and/or stderr to /dev/null. Factor all these out to a single
stdfd_devnull() function that allows selection of which of these
to redirect. ok markus@

Revision 1.83 / (download) - annotate - [select for diffs], Sun Jul 5 23:59:45 2020 UTC (3 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.82: +7 -7 lines
Diff to previous 1.82 (colored)

some language improvements; ok markus

Revision 1.82 / (download) - annotate - [select for diffs], Thu Apr 30 17:12:20 2020 UTC (4 years ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.81: +2 -1 lines
Diff to previous 1.81 (colored)

bring back debug() removed in rev 1.74; noted by pradeep kumar

Revision 1.81 / (download) - annotate - [select for diffs], Thu Jan 23 07:10:22 2020 UTC (4 years, 3 months ago) by dtucker
Branch: MAIN
Changes since 1.80: +11 -11 lines
Diff to previous 1.80 (colored)

Replace all calls to signal(2) with a wrapper around sigaction(2).
This wrapper blocks all other signals during the handler preventing
races between handlers, and sets SA_RESTART which should reduce the
potential for short read/write operations.

Revision 1.80 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:04 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.79: +4 -4 lines
Diff to previous 1.79 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.79 / (download) - annotate - [select for diffs], Sat Jan 19 21:35:25 2019 UTC (5 years, 3 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.78: +13 -6 lines
Diff to previous 1.78 (colored)

convert mux.c to new packet API

with & ok markus@

Revision 1.78 / (download) - annotate - [select for diffs], Sat Jan 19 21:31:32 2019 UTC (5 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.77: +4 -1 lines
Diff to previous 1.77 (colored)

begin landing remaining refactoring of packet parsing API, started
almost exactly six years ago.

This change stops including the old packet_* API by default and makes
each file that requires the old API include it explicitly. We will
commit file-by-file refactoring to remove the old API in consistent
steps.

with & ok markus@

Revision 1.77 / (download) - annotate - [select for diffs], Wed Sep 26 07:32:44 2018 UTC (5 years, 7 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.76: +1 -14 lines
Diff to previous 1.76 (colored)

remove big ugly TODO comment from start of file. Some of the mentioned
tasks are obsolete and, of the remainder, most are already captured in
PROTOCOL.mux where they better belong

Revision 1.76 / (download) - annotate - [select for diffs], Wed Sep 26 01:48:57 2018 UTC (5 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.75: +38 -36 lines
Diff to previous 1.75 (colored)

s/process_mux_master/mux_master_process/ in mux master function names,

Gives better symmetry with the existing mux_client_*() names and makes
it more obvious when a message comes from the master vs client (they
are interleved in ControlMaster=auto mode).

no functional change beyond prefixing a could of log messages with
__func__ where they were previously lacking.

Revision 1.75 / (download) - annotate - [select for diffs], Tue Jul 31 03:07:24 2018 UTC (5 years, 9 months ago) by djm
Branch: MAIN
Changes since 1.74: +2 -1 lines
Diff to previous 1.74 (colored)

fix some memory leaks spotted by Coverity via Jakub Jelen in bz#2366
feedback and ok dtucker@

Revision 1.74 / (download) - annotate - [select for diffs], Wed Jul 11 18:53:29 2018 UTC (5 years, 10 months ago) by markus
Branch: MAIN
Changes since 1.73: +2 -2 lines
Diff to previous 1.73 (colored)

remove legacy key emulation layer; ok djm@

Revision 1.73 / (download) - annotate - [select for diffs], Mon Jul 9 21:18:10 2018 UTC (5 years, 10 months ago) by markus
Branch: MAIN
Changes since 1.72: +507 -414 lines
Diff to previous 1.72 (colored)

client: switch mux to sshbuf API; with & ok djm@

Revision 1.72 / (download) - annotate - [select for diffs], Mon Jul 9 21:03:30 2018 UTC (5 years, 10 months ago) by markus
Branch: MAIN
Changes since 1.71: +3 -3 lines
Diff to previous 1.71 (colored)

client: switch to sshbuf API; ok djm@

Revision 1.71 / (download) - annotate - [select for diffs], Sat Jun 9 03:01:12 2018 UTC (5 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.70: +6 -4 lines
Diff to previous 1.70 (colored)

add a SetEnv directive to ssh_config that allows setting environment
variables for the remote session (subject to the server accepting them)

refactor SendEnv to remove the arbitrary limit of variable names.

ok markus@

Revision 1.70 / (download) - annotate - [select for diffs], Wed Jun 6 18:22:41 2018 UTC (5 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.69: +3 -3 lines
Diff to previous 1.69 (colored)

Add a PermitListen directive to control which server-side addresses
may be listened on when the client requests remote forwarding (ssh -R).

This is the converse of the existing PermitOpen directive and this
includes some refactoring to share much of its implementation.

feedback and ok markus@

Revision 1.69 / (download) - annotate - [select for diffs], Wed Sep 20 05:19:00 2017 UTC (6 years, 7 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (colored)

Use strsignal in debug message instead of casting for the benefit of
portable where sig_atomic_t might not be int.  "much nicer" deraadt@

Revision 1.68 / (download) - annotate - [select for diffs], Mon Sep 18 12:03:24 2017 UTC (6 years, 7 months ago) by dtucker
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (colored)

Prevent type mismatch warning in debug on platforms where sig_atomic_t
!= int.  ok djm@

Revision 1.67 / (download) - annotate - [select for diffs], Tue Sep 12 06:35:32 2017 UTC (6 years, 8 months ago) by djm
Branch: MAIN
Changes since 1.66: +11 -7 lines
Diff to previous 1.66 (colored)

Make remote channel ID a u_int

Previously we tracked the remote channel IDs in an int, but this is
strictly incorrect: the wire protocol uses uint32 and there is nothing
in-principle stopping a SSH implementation from sending, say, 0xffff0000.

In practice everyone numbers their channels sequentially, so this has
never been a problem.

ok markus@

Revision 1.66 / (download) - annotate - [select for diffs], Tue Sep 12 06:32:07 2017 UTC (6 years, 8 months ago) by djm
Branch: MAIN
Changes since 1.65: +108 -83 lines
Diff to previous 1.65 (colored)

refactor channels.c

Move static state to a "struct ssh_channels" that is allocated at
runtime and tracked as a member of struct ssh.

Explicitly pass "struct ssh" to all channels functions.

Replace use of the legacy packet APIs in channels.c.

Rework sshd_config PermitOpen handling: previously the configuration
parser would call directly into the channels layer. After the refactor
this is not possible, as the channels structures are allocated at
connection time and aren't available when the configuration is parsed.
The server config parser now tracks PermitOpen itself and explicitly
configures the channels code later.

ok markus@

Revision 1.65 / (download) - annotate - [select for diffs], Fri Jun 9 06:47:13 2017 UTC (6 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.64: +20 -10 lines
Diff to previous 1.64 (colored)

return failure rather than fatal() for more cases during mux
negotiations. Causes the session to fall back to a non-mux connection
if they occur. bz#2707 ok dtucker@

Revision 1.64 / (download) - annotate - [select for diffs], Sat Jan 21 11:32:04 2017 UTC (7 years, 3 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.63: +2 -4 lines
Diff to previous 1.63 (colored)

The POSIX APIs that that sockaddrs all ignore the s*_len field in the
incoming socket, so userspace doesn't need to set it unless it has its
own reasons for tracking the size along with the sockaddr.

ok phessler@ deraadt@ florian@

Revision 1.63 / (download) - annotate - [select for diffs], Wed Oct 19 23:21:56 2016 UTC (7 years, 6 months ago) by dtucker
Branch: MAIN
Changes since 1.62: +5 -3 lines
Diff to previous 1.62 (colored)

When tearing down ControlMaster connecctions, don't pollute stderr when
LogLevel=quiet.  Patch from Tim Kuijsten via tech@.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Sep 30 09:19:13 2016 UTC (7 years, 7 months ago) by markus
Branch: MAIN
Changes since 1.61: +62 -7 lines
Diff to previous 1.61 (colored)

ssh proxy mux mode (-O proxy; idea from Simon Tatham):
- mux client speaks the ssh-packet protocol directly over unix-domain socket.
- mux server acts as a proxy, translates channel IDs and relays to the server.
- no filedescriptor passing necessary.
- combined with unix-domain forwarding it's even possible to run mux client
  and server on different machines.
feedback & ok djm@

Revision 1.61 / (download) - annotate - [select for diffs], Mon Aug 8 22:40:57 2016 UTC (7 years, 9 months ago) by dtucker
Branch: MAIN
Changes since 1.60: +3 -2 lines
Diff to previous 1.60 (colored)

Improve error message for overlong ControlPath.  ok markus@ djm@

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jun 3 03:14:41 2016 UTC (7 years, 11 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.59: +4 -6 lines
Diff to previous 1.59 (colored)

Move the host and port used by ssh -W into the Options struct.
This will make future changes a bit easier.  ok djm@

Revision 1.59 / (download) - annotate - [select for diffs], Fri Apr 1 02:34:10 2016 UTC (8 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.58: +2 -2 lines
Diff to previous 1.58 (colored)

whitespace at EOL

Revision 1.50.2.1 / (download) - annotate - [select for diffs], Thu Jan 14 11:53:20 2016 UTC (8 years, 4 months ago) by sthen
Branch: OPENBSD_5_7
Changes since 1.50: +12 -10 lines
Diff to previous 1.50 (colored) next main 1.51 (colored)

MFC changes by djm@cvs.openbsd.org, 2016/01/13 16:04:47

"eliminate fallback from untrusted X11 forwarding to trusted
forwarding when the X server disables the SECURITY extension;
Reported by Thomas Hoger; ok deraadt@"

Revision 1.53.2.1 / (download) - annotate - [select for diffs], Thu Jan 14 11:50:37 2016 UTC (8 years, 4 months ago) by sthen
Branch: OPENBSD_5_8
Changes since 1.53: +12 -10 lines
Diff to previous 1.53 (colored) next main 1.54 (colored)

MFC changes by djm@cvs.openbsd.org, 2016/01/13 16:04:47

"eliminate fallback from untrusted X11 forwarding to trusted
forwarding when the X server disables the SECURITY extension;
Reported by Thomas Hoger; ok deraadt@"

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jan 13 23:04:47 2016 UTC (8 years, 4 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.57: +12 -10 lines
Diff to previous 1.57 (colored)

eliminate fallback from untrusted X11 forwarding to trusted
forwarding when the X server disables the SECURITY extension;
Reported by Thomas Hoger; ok deraadt@

Revision 1.57 / (download) - annotate - [select for diffs], Sat Dec 26 07:46:03 2015 UTC (8 years, 4 months ago) by semarie
Branch: MAIN
Changes since 1.56: +4 -7 lines
Diff to previous 1.56 (colored)

adjust pledge promises for ControlMaster: when using "ask" or "autoask", the process will use ssh-askpass for asking confirmation.

problem found by halex@

ok halex@

Revision 1.56 / (download) - annotate - [select for diffs], Thu Dec 3 17:00:18 2015 UTC (8 years, 5 months ago) by semarie
Branch: MAIN
Changes since 1.55: +10 -1 lines
Diff to previous 1.55 (colored)

pledges ssh client:
  - mux client: which is used when ControlMaster is in use.
    will end with "stdio proc tty" (proc is to permit sending SIGWINCH to mux master on window resize)

  - client loop: several levels of pledging depending of your used options

ok deraadt@

Revision 1.55 / (download) - annotate - [select for diffs], Thu Oct 15 23:51:40 2015 UTC (8 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.54: +3 -3 lines
Diff to previous 1.54 (colored)

fix some signed/unsigned integer type mismatches in format
strings; reported by Nicholas Lemonias

Revision 1.54 / (download) - annotate - [select for diffs], Wed Aug 19 23:18:26 2015 UTC (8 years, 8 months ago) by djm
Branch: MAIN
Changes since 1.53: +5 -1 lines
Diff to previous 1.53 (colored)

fix free() of uninitialised pointer reported by Mateusz Kocielski;
ok markus@

Revision 1.53 / (download) - annotate - [select for diffs], Fri May 1 04:03:20 2015 UTC (9 years ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE
Branch point for: OPENBSD_5_8
Changes since 1.52: +15 -2 lines
Diff to previous 1.52 (colored)

remove failed remote forwards established by muliplexing from the
list of active forwards; bz#2363, patch mostly by Yoann Ricordel;
ok dtucker@

Revision 1.52 / (download) - annotate - [select for diffs], Fri May 1 04:01:58 2015 UTC (9 years ago) by djm
Branch: MAIN
Changes since 1.51: +3 -3 lines
Diff to previous 1.51 (colored)

reduce stderr spam when using ssh -S /path/mux -O forward -R 0:...
ok dtucker@

Revision 1.51 / (download) - annotate - [select for diffs], Fri Apr 24 01:36:00 2015 UTC (9 years ago) by deraadt
Branch: MAIN
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (colored)

rename xrealloc() to xreallocarray() since it follows that form.
ok djm

Revision 1.50 / (download) - annotate - [select for diffs], Tue Jan 20 23:14:00 2015 UTC (9 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE
Branch point for: OPENBSD_5_7
Changes since 1.49: +1 -2 lines
Diff to previous 1.49 (colored)

Reduce use of <sys/param.h> and transition to <limits.h> throughout.
ok djm markus

Revision 1.49 / (download) - annotate - [select for diffs], Mon Dec 22 07:24:11 2014 UTC (9 years, 4 months ago) by djm
Branch: MAIN
Changes since 1.48: +3 -2 lines
Diff to previous 1.48 (colored)

fix passing of wildcard forward bind addresses when connection
multiplexing is in use; patch from Sami Hartikainen via bz#2324;
ok dtucker@

Revision 1.48 / (download) - annotate - [select for diffs], Thu Jul 17 07:22:19 2014 UTC (9 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.47: +59 -7 lines
Diff to previous 1.47 (colored)

reflect stdio-forward ("ssh -W host:port ...") failures in exit status.
previously we were always returning 0. bz#2255 reported by Brendan
Germain; ok dtucker

Revision 1.47 / (download) - annotate - [select for diffs], Thu Jul 17 00:10:18 2014 UTC (9 years, 10 months ago) by djm
Branch: MAIN
Changes since 1.46: +4 -2 lines
Diff to previous 1.46 (colored)

preserve errno across syscall

Revision 1.46 / (download) - annotate - [select for diffs], Tue Jul 15 15:54:14 2014 UTC (9 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.45: +117 -85 lines
Diff to previous 1.45 (colored)

Add support for Unix domain socket forwarding.  A remote TCP port
may be forwarded to a local Unix domain socket and vice versa or
both ends may be a Unix domain socket.  This is a reimplementation
of the streamlocal patches by William Ahern from:
    http://www.25thandclement.com/~william/projects/streamlocal.html
OK djm@ markus@

Revision 1.45 / (download) - annotate - [select for diffs], Mon Apr 28 03:09:18 2014 UTC (10 years ago) by djm
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

buffer_get_string_ptr's return should be const to remind
callers that futzing with it will futz with the actual buffer
contents

Revision 1.44 / (download) - annotate - [select for diffs], Fri Jul 12 00:19:58 2013 UTC (10 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.43: +13 -6 lines
Diff to previous 1.43 (colored)

fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@

Revision 1.43 / (download) - annotate - [select for diffs], Wed Jun 5 02:07:29 2013 UTC (10 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.42: +6 -2 lines
Diff to previous 1.42 (colored)

fix leaks in mux error paths, from Zhenbo Xu, found by Melton. bz#1967, ok djm

Revision 1.42 / (download) - annotate - [select for diffs], Sun Jun 2 23:36:29 2013 UTC (10 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

No need for the mux cleanup callback to be visible so restore it to static
and call it through the detach_user function pointer.  ok djm@

Revision 1.41 / (download) - annotate - [select for diffs], Fri May 17 00:13:13 2013 UTC (11 years ago) by djm
Branch: MAIN
Changes since 1.40: +52 -70 lines
Diff to previous 1.40 (colored)

bye, bye xfree(); ok markus@

Revision 1.40 / (download) - annotate - [select for diffs], Mon Apr 22 01:17:18 2013 UTC (11 years ago) by dtucker
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

typo in debug output: evitval->exitval

Revision 1.39 / (download) - annotate - [select for diffs], Fri Apr 5 00:58:51 2013 UTC (11 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.38: +3 -2 lines
Diff to previous 1.38 (colored)

cleanup mux-created channels that are in SSH_CHANNEL_OPENING state too
(in addition to ones already in OPEN); bz#2079, ok dtucker@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jan 2 00:32:07 2013 UTC (11 years, 4 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

channel_setup_local_fwd_listener() returns 0 on failure, not -ve
bz#2055 reported by mathieu.lacage AT gmail.com

Revision 1.37 / (download) - annotate - [select for diffs], Fri Aug 17 00:45:45 2012 UTC (11 years, 9 months ago) by dtucker
Branch: MAIN
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

Force a clean shutdown of ControlMaster client sessions when the ~. escape
sequence is used.  This means that ~. should now work in mux clients even
if the server is no longer responding.  Found by tedu, ok djm.

Revision 1.36 / (download) - annotate - [select for diffs], Fri Jul 6 01:37:21 2012 UTC (11 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.35: +9 -3 lines
Diff to previous 1.35 (colored)

fix memory leak of passed-in environment variables and connection
context when new session message is malformed; bz#2003 from Bert.Wesarg
AT googlemail.com

Revision 1.35 / (download) - annotate - [select for diffs], Fri Jun 1 01:01:22 2012 UTC (11 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

fix memory leak when mux socket creation fails; bz#2002 from bert.wesarg
AT googlemail.com

Revision 1.34 / (download) - annotate - [select for diffs], Sat Jan 7 21:11:36 2012 UTC (12 years, 4 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.33: +2 -4 lines
Diff to previous 1.33 (colored)

fix double-free in new session handler

Revision 1.33 / (download) - annotate - [select for diffs], Sun Dec 4 23:16:12 2011 UTC (12 years, 5 months ago) by djm
Branch: MAIN
Changes since 1.32: +0 -3 lines
Diff to previous 1.32 (colored)

revert:

> revision 1.32
> date: 2011/12/02 00:41:56;  author: djm;  state: Exp;  lines: +4 -1
> fix bz#1948: ssh -f doesn't fork for multiplexed connection.
> ok dtucker@

it interacts badly with ControlPersist

Revision 1.32 / (download) - annotate - [select for diffs], Fri Dec 2 00:41:56 2011 UTC (12 years, 5 months ago) by djm
Branch: MAIN
Changes since 1.31: +4 -1 lines
Diff to previous 1.31 (colored)

fix bz#1948: ssh -f doesn't fork for multiplexed connection.
ok dtucker@

Revision 1.31 / (download) - annotate - [select for diffs], Fri Sep 23 07:45:05 2011 UTC (12 years, 7 months ago) by markus
Branch: MAIN
Changes since 1.30: +14 -5 lines
Diff to previous 1.30 (colored)

unbreak remote portforwarding with dynamic allocated listen ports:
1) send the actual listen port in the open message (instead of 0).
   this allows multiple forwardings with a dynamic listen port
2) update the matching permit-open entry, so we can identify where
   to connect to
report: den at skbkontur.ru and P. Szczygielski
feedback and ok djm@

Revision 1.30 / (download) - annotate - [select for diffs], Fri Sep 9 22:46:44 2011 UTC (12 years, 8 months ago) by djm
Branch: MAIN
Changes since 1.29: +83 -21 lines
Diff to previous 1.29 (colored)

support for cancelling local and remote port forwards via the multiplex
socket. Use ssh -O cancel -L xx:xx:xx -R yy:yy:yy user@host" to request
the cancellation of the specified forwardings; ok markus@

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 22 22:08:42 2011 UTC (12 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.28: +5 -3 lines
Diff to previous 1.28 (colored)

hook up a channel confirm callback to warn the user then requested X11
forwarding was refused by the server; ok markus@

Revision 1.28 / (download) - annotate - [select for diffs], Sun May 8 12:52:01 2011 UTC (13 years ago) by djm
Branch: MAIN
Changes since 1.27: +48 -12 lines
Diff to previous 1.27 (colored)

improve our behaviour when TTY allocation fails: if we are in
RequestTTY=auto mode (the default), then do not treat at TTY
allocation error as fatal but rather just restore the local TTY
to cooked mode and continue. This is more graceful on devices that
never allocate TTYs.

If RequestTTY is set to "yes" or "force", then failure to allocate
a TTY is fatal.

ok markus@

Revision 1.27 / (download) - annotate - [select for diffs], Fri May 6 21:34:32 2011 UTC (13 years ago) by djm
Branch: MAIN
Changes since 1.26: +3 -4 lines
Diff to previous 1.26 (colored)

Add a RequestTTY ssh_config option to allow configuration-based
control over tty allocation (like -t/-T); ok markus@

Revision 1.26 / (download) - annotate - [select for diffs], Thu May 5 05:12:08 2011 UTC (13 years ago) by djm
Branch: MAIN
Changes since 1.25: +10 -6 lines
Diff to previous 1.25 (colored)

gracefully fall back when ControlPath is too large for a
sockaddr_un. ok markus@ as part of a larger diff

Revision 1.25 / (download) - annotate - [select for diffs], Sun Apr 17 22:42:41 2011 UTC (13 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.24: +85 -1 lines
Diff to previous 1.24 (colored)

allow graceful shutdown of multiplexing: request that a mux server removes
its listener socket and refuse future multiplexing requests; ok markus@

Revision 1.24 / (download) - annotate - [select for diffs], Thu Jan 13 21:54:53 2011 UTC (13 years, 4 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.23: +5 -5 lines
Diff to previous 1.23 (colored)

correct error messages; patch from bert.wesarg AT googlemail.com

Revision 1.23 / (download) - annotate - [select for diffs], Tue Oct 12 02:22:24 2010 UTC (13 years, 7 months ago) by dtucker
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)

Typo in confirmation message.  bz#1827, patch from imorgan at nas nasa gov

Revision 1.22 / (download) - annotate - [select for diffs], Mon Sep 20 07:19:27 2010 UTC (13 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.21: +46 -4 lines
Diff to previous 1.21 (colored)

"atomically" create the listening mux socket by binding it on a temorary
name and then linking it into position after listen() has succeeded.

this allows the mux clients to determine that the server socket is
either ready or stale without races. stale server sockets are now
automatically removed

ok deraadt

Revision 1.21 / (download) - annotate - [select for diffs], Fri Jun 25 23:15:36 2010 UTC (13 years, 10 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.20: +6 -3 lines
Diff to previous 1.20 (colored)

Add X11ForwardTimeout option to specify timeout for untrusted X11
authentication cookies to avoid fallback in X11 code to fully-trusted
implicit authentication using SO_PEERCRED described at:
http://lists.x.org/archives/xorg-devel/2010-May/008636.html

After the X11ForwardTimeout has expired the client will now refuse
incoming X11 channel opens.

based on patch from Tavis Ormandy; "nice" markus@

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jun 25 07:14:46 2010 UTC (13 years, 10 months ago) by djm
Branch: MAIN
Changes since 1.19: +4 -8 lines
Diff to previous 1.19 (colored)

bz#1327: remove hardcoded limit of 100 permitopen clauses and port
forwards per direction; ok markus@ stevesk@

Revision 1.19 / (download) - annotate - [select for diffs], Thu Jun 17 07:07:30 2010 UTC (13 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.18: +2 -2 lines
Diff to previous 1.18 (colored)

Correct sizing of object to be allocated by calloc(), replacing
sizeof(state) with sizeof(*state). This worked by accident since
the struct contained a single int at present, but could have broken
in the future. patch from hyc AT symas.com

Revision 1.18 / (download) - annotate - [select for diffs], Sun May 16 12:55:51 2010 UTC (14 years ago) by markus
Branch: MAIN
Changes since 1.17: +105 -8 lines
Diff to previous 1.17 (colored)

mux support for remote forwarding with dynamic port allocation,
use with
	LPORT=`ssh -S muxsocket -R0:localhost:25 -O forward somehost`
feedback and ok djm@

Revision 1.17 / (download) - annotate - [select for diffs], Fri May 14 23:29:23 2010 UTC (14 years ago) by djm
Branch: MAIN
Changes since 1.16: +37 -10 lines
Diff to previous 1.16 (colored)

Pause the mux channel while waiting for reply from aynch callbacks.
Prevents misordering of replies if new requests arrive while waiting.

Extend channel open confirm callback to allow signalling failure
conditions as well as success. Use this to 1) fix a memory leak, 2)
start using the above pause mechanism and 3) delay sending a success/
failure message on mux slave session open until we receive a reply from
the server.

motivated by and with feedback from markus@

Revision 1.16 / (download) - annotate - [select for diffs], Fri Apr 23 22:27:38 2010 UTC (14 years ago) by djm
Branch: MAIN
Changes since 1.15: +3 -3 lines
Diff to previous 1.15 (colored)

set "detach_close" flag when registering channel cleanup callbacks.
This causes the channel to close normally when its fds close and
hangs when terminating a mux slave using ~. bz#1758; ok markus@

Revision 1.15 / (download) - annotate - [select for diffs], Sat Apr 10 05:48:16 2010 UTC (14 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

fix NULL dereference; from matthew.haub AT alumni.adelaide.edu.au

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jan 30 02:54:53 2010 UTC (14 years, 3 months ago) by djm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.13: +5 -3 lines
Diff to previous 1.13 (colored)

don't mark channel as read failed if it is already closing; suppresses
harmless error messages when connecting to SSH.COM Tectia server
report by imorgan AT nas.nasa.gov

Revision 1.13 / (download) - annotate - [select for diffs], Fri Jan 29 20:16:17 2010 UTC (14 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

kill correct channel (was killing already-dead mux channel, not
its session channel)

Revision 1.12 / (download) - annotate - [select for diffs], Wed Jan 27 13:26:17 2010 UTC (14 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.11: +8 -2 lines
Diff to previous 1.11 (colored)

fix bug introduced in mux rewrite:

In a mux master, when a socket to a mux slave closes before its server
session (as may occur when the slave has been signalled), gracefully
close the server session rather than deleting its channel immediately.
A server may have more messages on that channel to send (e.g. an exit
message) that will fatal() the client if they are sent to a channel that
has been prematurely deleted.

spotted by imorgan AT nas.nasa.gov

Revision 1.11 / (download) - annotate - [select for diffs], Tue Jan 26 02:15:20 2010 UTC (14 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.10: +11 -4 lines
Diff to previous 1.10 (colored)

-Wuninitialized and remove a // comment; from portable

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jan 26 01:28:35 2010 UTC (14 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.9: +1450 -460 lines
Diff to previous 1.9 (colored)

rewrite ssh(1) multiplexing code to a more sensible protocol.

The new multiplexing code uses channels for the listener and
accepted control sockets to make the mux master non-blocking, so
no stalls when processing messages from a slave.

avoid use of fatal() in mux master protocol parsing so an errant slave
process cannot take down a running master.

implement requesting of port-forwards over multiplexed sessions. Any
port forwards requested by the slave are added to those the master has
established.

add support for stdio forwarding ("ssh -W host:port ...") in mux slaves.

document master/slave mux protocol so that other tools can use it to
control a running ssh(1). Note: there are no guarantees that this
protocol won't be incompatibly changed (though it is versioned).

feedback Salvador Fandino, dtucker@
channel changes ok markus@

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jan 9 05:04:24 2010 UTC (14 years, 4 months ago) by djm
Branch: MAIN
Changes since 1.8: +4 -3 lines
Diff to previous 1.8 (colored)

quell tc[gs]etattr warnings when forcing a tty (ssh -tt), since we
usually don't actually have a tty to read/set; bz#1686 ok dtucker@

Revision 1.8 / (download) - annotate - [select for diffs], Thu Aug 20 23:54:28 2009 UTC (14 years, 8 months ago) by dtucker
Branch: MAIN
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

subsystem_flag is defined in ssh.c so it's extern; ok djm

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 13 17:21:20 2008 UTC (15 years, 11 months ago) by dtucker
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.6: +3 -3 lines
Diff to previous 1.6 (colored)

Friendlier error messages for mux fallback.  ok djm@

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jun 13 00:47:53 2008 UTC (15 years, 11 months ago) by dtucker
Branch: MAIN
Changes since 1.5: +2 -2 lines
Diff to previous 1.5 (colored)

upcast size_t to u_long to match format arg; ok djm@

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jun 13 00:16:49 2008 UTC (15 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.4: +54 -18 lines
Diff to previous 1.4 (colored)

fall back to creating a new TCP connection on most multiplexing errors
(socket connect fail, invalid version, refused permittion, corrupted
messages, etc.); bz #1329 ok dtucker@

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jun 12 15:19:17 2008 UTC (15 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.3: +2 -1 lines
Diff to previous 1.3 (colored)

The multiplexing escape char handler commit last night introduced a
small memory leak per session; plug it.

Revision 1.3 / (download) - annotate - [select for diffs], Thu Jun 12 05:32:30 2008 UTC (15 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.2: +5 -2 lines
Diff to previous 1.2 (colored)

some more TODO for me

Revision 1.2 / (download) - annotate - [select for diffs], Thu Jun 12 03:40:52 2008 UTC (15 years, 11 months ago) by djm
Branch: MAIN
Changes since 1.1: +62 -31 lines
Diff to previous 1.1 (colored)

Enable ~ escapes for multiplex slave sessions; give each channel
its own escape state and hook the escape filters up to muxed
channels. bz #1331

Mux slaves do not currently support the ~^Z and ~& escapes.

NB. this change cranks the mux protocol version, so a new ssh
mux client will not be able to connect to a running old ssh
mux master.

ok dtucker@

Revision 1.1 / (download) - annotate - [select for diffs], Fri May 9 14:18:44 2008 UTC (16 years ago) by djm
Branch: MAIN

tidy up session multiplexing code, moving it into its own file and
making the function names more consistent - making ssh.c and
clientloop.c a fair bit more readable.

ok markus@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.