Commit Graph

78 Commits

Author SHA1 Message Date
Matt Johnston
1a4db21fe4 buf_getstring and buf_putstring now use non-unsigned char* 2015-06-04 23:08:50 +08:00
Gaël PORTAY
1601a657d4 Turn send_msg_channel_open_failure()'s text and lang into const char * 2015-05-05 20:39:13 +02:00
Gaël PORTAY
50b14f696c Turn start_send_channel_request()'s type argument into char * 2015-05-05 20:39:13 +02:00
Gaël PORTAY
224b16b247 Fix pointer differ in signess warnings [-Werror=pointer-sign] 2015-05-05 20:39:13 +02:00
Matt Johnston
19e1afbd1c Fix no-writev fallback 2015-05-02 22:47:25 +08:00
Matt Johnston
ef20b9ff7a Avoid channel writev() when there is nothing to write 2015-03-21 22:43:08 +08:00
Matt Johnston
275611fbaa Make main socket nonblocking. Limit writequeue size. 2015-03-20 23:36:42 +08:00
Matt Johnston
20f9683ae0 avoid malloc for iovec 2015-03-20 22:53:32 +08:00
Matt Johnston
989c5c1436 Avoid copying data into circular buffer
--HG--
branch : nocircbuffer
2015-03-01 00:44:45 +08:00
Matt Johnston
31e379c300 merge from default
--HG--
branch : fastopen
2015-02-28 09:06:40 +08:00
Matt Johnston
4b1f5ec7c2 Use m_close() which will avoid close(-1) 2015-02-24 20:53:32 +08:00
Thorsten Horstmann
ab9439519a Fix for old compilers, variable declarations at beginning of functions
and /**/ comments
2015-02-24 20:51:18 +08:00
Matt Johnston
364a53577e Move generic network routines to netio.c
--HG--
branch : fastopen
2015-02-20 23:16:38 +08:00
Matt Johnston
755c1458f0 async connections working
--HG--
branch : fastopen
2015-02-18 22:46:15 +08:00
Matt Johnston
6d2d3669f3 Make keepalive handling more robust, this should now match what OpenSSH does 2014-08-19 23:08:56 +08:00
Matt Johnston
0e7409c7ff Make sure the check_close() handler runs when a server child process exits 2014-07-28 23:23:49 +08:00
Matt Johnston
5cf83a7212 Avoid use-after-free when channel inithandler fails. Thanks to Coverity 2014-07-26 10:18:55 +08:00
Matt Johnston
da57dd13c5 Set tcp priority as follows:
if (connecting || ptys || x11) tos = LOWDELAY;
else if (tcp_forwards) tos = 0;
else tos = BULK;

TCP forwards could be either lowdelay or bulk, hence the default priority.
2014-07-16 22:53:32 +08:00
Matt Johnston
1ccac01cee Make sure client exit messages don't get lost 2014-07-09 00:13:17 +08:00
Matt Johnston
50a5d3756f Send a failure response if a client receives a global request 2014-07-08 21:59:36 +08:00
Matt Johnston
ca86726f9f Improve handling lots of concurrent forwarded connections. Increase
connection backlog, avoid check_close() for channels that haven't had IO
2014-06-25 23:42:39 +08:00
Matt Johnston
bb7934bf04 A few fixes for cases where compression increases payload sizes, and
be more precise about maximum channel sizes
2014-02-22 18:02:09 +08:00
Matt Johnston
bf6f3f613d Read (and enqueue) packets from interactive input even when
we're waiting for a key exchange.

This should hopefully fix the situation where "~." doesn't work to terminate a
client session when a laptop wakes up. The client will be stuck waiting for a
key exchange on a dead connection, so won't have read the escape character
2014-02-17 21:41:06 +08:00
Matt Johnston
dffb33cecf Improve EOF handling for half-close. Patch from Catalin Patulea
Fixes the situation
$ ./dbclient root@1.2.3.4 'cat; echo foo'
^D
<no output>
2013-09-21 00:17:22 +08:00
Matt Johnston
c0d7c6693f run closehandlers on cleanup 2013-04-10 21:32:55 +08:00
Matt Johnston
90cf7f012c Move the more verbose TRACE() statements into TRACE2() 2013-04-01 00:07:26 +08:00
Matt Johnston
5996c3824c Add ~. and ~^Z handling to exit/suspend dbclient 2013-03-23 23:16:06 +08:00
Matt Johnston
804a1e69f2 use an empty writebuf rather than a NULL one 2013-03-20 22:31:07 +08:00
Matt Johnston
4fd4fbc255 Fix memory leak when direct TCP connections time out on connection.
Long-standing bug probably stemming from the awkwardly named
delete_channel() versus remove_channel()
2013-03-19 23:54:32 +08:00
Matt Johnston
2a02c4084a - Don't sent SSH_MSG_UNIMPLEMENTED if we don't have ENABLE_SVR_REMOTETCPFWD
- Fix build if ENABLE_SVR_REMOTETCPFWD is disabled but ENABLE_SVR_LOCALTCPFWD
  is enabled
2012-05-09 20:33:16 +08:00
Matt Johnston
baa32218b0 - Make sure we don't use channel-specific data after it has been freed
with a ChanType->closehandler()
2011-12-04 05:27:29 +08:00
Matt Johnston
38ed870ffe Improve capitalisation for all logged strings
--HG--
extra : convert_revision : 997e53cec7a9efb7413ac6e17b6be60a5597bd2e
2011-02-23 15:50:30 +00:00
Matt Johnston
adc4d0194f Idle timeout patch from Farrell Aultman. Needs testing, unsure if server
code works

--HG--
extra : convert_revision : ff66e05ae040561110af70114bf83f11ed528f05
2008-11-07 14:11:06 +00:00
Matt Johnston
ed79abed76 Don't use // style comments
--HG--
extra : convert_revision : c92c7b4fef739b505d9842b45a393e1089097e3b
2008-11-02 12:01:39 +00:00
Matt Johnston
b98d13effb Don't send anything in response to a SSH_MSG_CHANNEL_REQUEST if we have
already sent a SSH_MSG_CHANNEL_CLOSE. This fixes a bug triggered by more
recent versions of putty with tcp fowarding and window adjustment request
messages.

--HG--
extra : convert_revision : 10b2f286b9886364db39dfbb4f8f46e49e345d87
2008-09-23 12:03:01 +00:00
Matt Johnston
6c9d2abc75 Don't return until the shell has quit. This will ensure that an exit status
is always returned.

--HG--
extra : convert_revision : 32fc88053016994100eb0ef17f75592881c90d97
2008-02-21 14:46:15 +00:00
Matt Johnston
e3e4445dc1 Add -W <windowsize> argument and document it.
--HG--
extra : convert_revision : 98d4c0f15480bf749c451034cbc565d7e9d3b8dc
2007-07-25 15:44:25 +00:00
Matt Johnston
2d4d9627a2 Rearrange the channel buffer sizes into three neat use-editable values in
options.h. Increasing RECV_MAX_WINDOW gives big network performance
increases - even with the present buffers (which haven't changed) it
performs a lot better.
Next step is to make the window size a cmdline option.

--HG--
extra : convert_revision : 24c7cb47fb56cf5b82e3bc0859b45ea83038eab0
2007-07-24 15:40:23 +00:00
Matt Johnston
62d792fbdc Fix a stupid bug s/readfd/errfd/ affecting channel close on child exit
--HG--
extra : convert_revision : 16dd04147563e91faaa44de193dece0f4056ec7a
2007-02-22 16:17:09 +00:00
Matt Johnston
7f12251fbb Fix for -pedantic -ansi compilation, change // to /**/, plus some signedness
and trailing-comma-in-array issues

--HG--
extra : convert_revision : c22be8b8f570b48e9662dac32c7b3e7148a42206
2007-02-16 14:42:08 +00:00
Matt Johnston
22440a6fb2 - Fix bug in child-exit handling where the wrong pid was being matched.
- Also wait for errfd to close before closing the channel

--HG--
branch : channel-fix
extra : convert_revision : ed68ea8963f7d1fa600f81479e7e211efc5a31bc
2007-02-12 10:39:22 +00:00
Matt Johnston
f5ad5c1553 Improve behaviour when flushing out after a process has exited.
--HG--
branch : channel-fix
extra : convert_revision : e73ee8f7ae404a9355685c30828a0ad4524031bc
2007-02-09 10:43:16 +00:00
Matt Johnston
d199e0b119 disapproval of revision '1dfbc5ef92391d01b576c8506061927869a89887'
--HG--
branch : channel-fix
extra : convert_revision : 73fe066c5d9e2395354ba74756124d45c978a04d
2007-02-06 15:59:54 +00:00
Matt Johnston
4e09d27c6f Add some code for testing whether a writefd is closed (by read()ing from it)
--HG--
branch : channel-fix
extra : convert_revision : 1dfbc5ef92391d01b576c8506061927869a89887
2006-12-05 15:23:06 +00:00
Matt Johnston
e1d3a8a6e9 - Add some extra tracing.
- Be clearer about errfd be used for read versus write with
ERRFD_IS_READ and ERRFD_IS_WRITE macros

--HG--
branch : channel-fix
extra : convert_revision : 8778af05d9573c68b0d859feb7079502b46ed769
2006-12-05 14:42:03 +00:00
Matt Johnston
5b8a26f1d1 Remove accidentally removed block (making sure to close the channel).
Other minor cleanups.

--HG--
branch : channel-fix
extra : convert_revision : 7559a8cc4f6abe2338636f2aced3a395a79c172c
2006-10-11 14:44:00 +00:00
Matt Johnston
cc340d9cdc Passes most test cases now
--HG--
branch : channel-fix
extra : convert_revision : 5a5f398411a7a3baa9472daa80fea0574fbd8a9a
2006-10-09 16:31:00 +00:00
Matt Johnston
786ea39ac4 Rearranged (and hopefully simplified) channel close/eof handling
--HG--
branch : channel-fix
extra : convert_revision : d44aac5fec50b1d20515da77d410d3c511f16277
2006-10-07 17:48:55 +00:00
Matt Johnston
df57eb3824 Rearranged some more bits, marked some areas that need work.
* send_msg_channel_data() no longer allocates a separate buffer
* getchannel() handles unknown channels so callers don't have to

--HG--
branch : channel-fix
extra : convert_revision : 3db645581be0fbb0d2ac8d218fbd55e096cbbbe5
2006-10-02 16:34:06 +00:00
Matt Johnston
7e04c5e277 just shuffle some variables names about, a brief comment
about the "bad writefd" problem

--HG--
branch : channel-fix
extra : convert_revision : f0b407c3d3e047ed83174e6f4ebd85a19352df5b
2006-10-01 16:35:13 +00:00