summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/channels.c
AgeCommit message (Collapse)Author
2016-03-07refactor canohost.c: move functions that cache results closer to theDamien Miller
places that use them (authn and session code). After this, no state is cached in canohost.c feedback and ok markus@
2016-02-05Only check errno if read() has returned an error. EOF is not an error.Christian Weisgerber
This fixes a problem where the mux master would sporadically fail to notice that the client had exited. ok mikeb@ djm@
2015-10-15fix some signed/unsigned integer type mismatches in formatDamien Miller
strings; reported by Nicholas Lemonias
2015-07-01better refuse ForwardX11Trusted=no connections attempted afterDamien Miller
ForwardX11Timeout expires; reported by Jann Horn
2015-06-30fatal() when a remote window update causes the window value toDamien Miller
overflow. Reported by Georg Wicherski, ok markus@
2015-06-30Fix math error in remote window calculations that causes eventual stallsDamien Miller
for datagram channels. Reported by Georg Wicherski, ok markus@
2015-06-05For "ssh -L 12345:/tmp/sock" don't fail with "No forward host name."Todd C. Miller
(we have a path, not a host name). Based on a diff from Jared Yanovich. OK djm@
2015-05-08Use xcalloc for permitted_adm_opens instead of xmalloc to ensure it's zeroed.Darren Tucker
Fixes post-auth crash with permitopen=none. bz#2355, ok djm@
2015-04-24rename xrealloc() to xreallocarray() since it follows that form.Theo de Raadt
ok djm
2015-02-06SIZE_MAX is standard, we should be using it in preference to theTodd C. Miller
obsolete SIZE_T_MAX. OK miod@ beck@
2015-01-20Reduce use of <sys/param.h> and transition to <limits.h> throughout.Theo de Raadt
ok djm markus
2015-01-19move dispatch to struct ssh; ok djm@Markus Friedl
2014-12-11explicitly include sys/param.h in files that use the howmany() macro;Damien Miller
from portable
2014-10-08fix a few -Wpointer-sign warnings from clangDamien Miller
2014-07-15Add support for Unix domain socket forwarding. A remote TCP portTodd C. Miller
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@
2014-07-05fix remote-forward cancel regression; ok markus@Damien Miller
2014-07-03allow explicit ::1 and 127.0.0.1 forwarding bind addresses whenDamien Miller
GatewayPorts=no; allows client to choose address family; bz#2222 ok markus@
2014-06-27fix remote fwding with same listen port but different listen addressMarkus Friedl
with gerhard@, ok djm@
2014-04-28buffer_get_string_ptr's return should be const to remindDamien Miller
callers that futzing with it will futz with the actual buffer contents
2014-02-26don't assume that the socks4 username is \0 terminated;Damien Miller
spotted by Ben Hawkes; ok markus@
2014-02-15avoid spurious "getsockname failed: Bad file descriptor" errors in ssh -W;Damien Miller
bz#2200, debian#738692 via Colin Watson; ok dtucker@
2014-01-31replace most bzero with explicit_bzero, except a few that cna be memsetTed Unangst
ok djm dtucker
2013-12-19bz#2147: fix multiple remote forwardings with dynamically assignedDamien Miller
listen ports. In the s->c message to open the channel we were sending zero (the magic number to request a dynamic port) instead of the actual listen port. The client therefore had no way of discriminating between them. Diagnosis and fix by ronf AT timeheart.net
2013-11-08use calloc for all structure allocations; from markus@Damien Miller
2013-09-19bz#1297 - tell the client (via packet_send_debug) when their preferredDamien Miller
listen address has been overridden by the server's GatewayPorts; ok dtucker@
2013-09-13avoid unaligned access in code that reused a buffer to send aDamien Miller
struct in_addr in a reply; simpler just use use buffer_put_int(); from portable; spotted by and ok dtucker@
2013-07-12fix pointer-signedness warnings from clang/llvm-3.3; "seems nice" deraadt@Damien Miller
2013-06-07Add an "ABANDONED" channel state and use for mux sessions that areDarren Tucker
disconnected via the ~. escape sequence. Channels in this state will be able to close if the server responds, but do not count as active channels. This means that if you ~. all of the mux clients when using ControlPersist on a broken network, the backgrounded mux master will exit when the Control Persist time expires rather than hanging around indefinitely. bz#1917, also reported and tested by tedu@. ok djm@ markus@.
2013-06-01Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things likeDarren Tucker
keepalives and rekeying will work properly over clock steps. Suggested by markus@, "looks good" djm@.
2013-05-17bye, bye xfree(); ok markus@Damien Miller
2013-04-06handle ECONNABORTED for accept(); ok deraadt some time ago...Markus Friedl
2012-12-02make AllowTcpForwarding accept "local" and "remote" in addition to itsDamien Miller
current "yes"/"no" to allow the server to specify whether just local or remote TCP forwarding is enabled. ok markus@
2012-04-23fix function proto/source mismatchDamien Miller
2012-04-11don't spin in accept() when out of fds (ENFILE/ENFILE) - back off for aDamien Miller
while; ok deraadt@ markus@
2012-03-29Add PermitOpen none option based on patch from Loganaden VelvindronDarren Tucker
(bz #1949). ok djm@
2011-09-23unbreak remote portforwarding with dynamic allocated listen ports:Markus Friedl
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@
2011-09-23Add wildcard support to PermitOpen, allowing things like "PermitOpenDarren Tucker
localhost:*". bz #1857, ok djm markus.
2011-09-10support cancellation of local/dynamic forwardings from ~C commandline;Markus Friedl
ok & feedback djm@
2011-09-09support for cancelling local and remote port forwards via the multiplexDamien Miller
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@
2011-06-22hook up a channel confirm callback to warn the user then requested X11Damien Miller
forwarding was refused by the server; ok markus@
2010-11-24remove a debug() that pollutes stderr on client connecting to a serverDamien Miller
in debug mode (channel_close_fds is called transitively from the session code post-fork); bz#1719, ok dtucker
2010-08-05Fix a trio of bugs in the local/remote window calculation for datagramDamien Miller
data channels (i.e. TunnelForward): Calculate local_consumed correctly in channel_handle_wfd() by measuring the delta to buffer_len(c->output) from when we start to when we finish. The proximal problem here is that the output_filter we use in portable modified the length of the dequeued datagram (to futz with the headers for !OpenBSD). In channel_output_poll(), don't enqueue datagrams that won't fit in the peer's advertised packet size (highly unlikely to ever occur) or which won't fit in the peer's remaining window (more likely). In channel_input_data(), account for the 4-byte string header in datagram packets that we accept from the peer and enqueue in c->output. report, analysis and testing 2/3 cases from wierbows AT us.ibm.com; "looks good" markus@
2010-07-13s/timing_safe_cmp/timingsafe_bcmp/gDamien Miller
2010-07-13implement a timing_safe_cmp() function to compare memory without leakingDamien Miller
timing information by short-circuiting like memcmp() and use it for some of the more sensitive comparisons (though nothing high-value was readily attackable anyway); "looks ok" markus@
2010-06-25bz#1750: fix requirement for /dev/null inside ChrootDirectory forDamien Miller
internal-sftp accidentally introduced in r1.253 by removing the code that opens and dup /dev/null to stderr and modifying the channels code to read stderr but discard it instead; ok markus@
2010-06-25bz#1327: remove hardcoded limit of 100 permitopen clauses and portDamien Miller
forwards per direction; ok markus@ stevesk@
2010-05-14Pause the mux channel while waiting for reply from aynch callbacks.Damien Miller
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@
2010-01-30fake local addr:port when stdio fowarding as some servers (Tectia atDamien Miller
least) validate that they are well-formed; reported by imorgan AT nas.nasa.gov ok dtucker
2010-01-26rewrite ssh(1) multiplexing code to a more sensible protocol.Damien Miller
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@
2010-01-11Add a 'netcat mode' (ssh -W). This connects stdio on the client to a singleDarren Tucker
port forward on the server. This allows, for example, using ssh as a ProxyCommand to route connections via intermediate servers. bz #1618, man page help from jmc@, ok markus@