Andreas Schneider
b1f4b6ffec
channels: Use SSH_BUFFER_FREE()
...
Fixes T183
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 752c906ea7 )
2019-12-09 16:38:36 +01:00
Andreas Schneider
1788f98543
channels: Use SSH_STRING_FREE()
...
Fixes T183
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 1832ed4fef )
2019-12-09 16:38:36 +01:00
Andreas Schneider
297aed60c4
channels: Return size_t for count_ptrs()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 500481e101 )
2019-12-09 16:38:36 +01:00
Andreas Schneider
4e5dfd677e
channels: Fix integer and bool argument of channel_default_bufferize()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit dad2720355 )
2019-12-09 16:38:36 +01:00
Andreas Schneider
34fd4ebfc3
channels: Fix type of arguments of grow_window()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 6f39deefcd )
2019-12-09 16:38:36 +01:00
Andreas Schneider
0080ac1f03
channels: Fix type of arguments of channel_open()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 0abd187dba )
2019-12-09 16:38:36 +01:00
Andreas Schneider
dd4eb4a288
channels: Use ssize_t for to_read
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 07a57b74ba )
2019-12-09 16:38:36 +01:00
Andreas Schneider
a967258649
channels: Reformat ssh_channel_read_nonblocking()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 8d671efdbd )
2019-12-09 16:38:36 +01:00
Andreas Schneider
e0e3636c60
channels: Use a size_t variable for length check
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 3bad060738 )
2019-12-09 16:38:36 +01:00
Andreas Schneider
c0e5393927
channesl: Reformat ssh_channel_poll_timeout()
...
Fixes T188
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit fbe115abba )
2019-12-09 16:38:36 +01:00
Anderson Toshiyuki Sasaki
8837d32d92
channels: Initialize states explicitly
...
In ssh_channel_new(), initialize channel->state and
channel->request_state explicitly for better readability.
Fixes T194
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 2f1f662d46 )
2019-12-09 16:38:35 +01:00
Andreas Schneider
0c951b9f27
channel: Document ssh_channel_request_sftp()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit e5767bf0b7 )
2019-11-04 09:48:38 +01:00
Jakub Jelen
93541fe150
channels: Correctly reports failed channels opening
...
Fixes T75
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 2f05243a4a )
2019-09-30 15:59:53 +02:00
Jakub Jelen
e6ba98a0aa
Reformat channel_open()
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 89a9eb8811 )
2019-09-30 15:59:37 +02:00
Jakub Jelen
6dcb960501
channels: Do not use deprecated functions in the example code
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 3cf2b41f5e )
2019-09-30 15:59:27 +02:00
Anderson Toshiyuki Sasaki
ab25ca205d
channels: Do not mix integer types
...
Use uint32_t when expecting 32 bits unsigned int. Use PRIu32 macro to
print correctly independently of the architecture.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2019-06-14 15:22:45 +02:00
Andreas Schneider
8a885f0bd3
channels: Add check if we are authenticated before we create a channel
...
Fixes T139
Reported-by: Jan Pazdziora <jpazdziora@redhat.com >
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2019-04-29 13:17:19 +02:00
Andreas Schneider
c4348c7b3c
sftp: Check if the channel is still valid
...
Fixes T138
Reported-by: Jan Pazdziora <jpazdziora@redhat.com >
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2019-04-29 13:17:16 +02:00
Enji Cooper
5ffc595d0d
Document more @return values with doxygen for APIs
...
Summary:
* Note that SSH_ERROR can be returned on error in `ssh_channel_get_exit_status`
and `ssh_channel_get_session`.
* Note the return codes for `channel_open` and `grow_window`; although these
are internal APIs, it's best to document their behavior.
* Replace `@returns` use with `@return`. While Doxygen supports the
former as a synonym for `@return`, it isn't documented in the manual
(and might not be supported by other downstream documentation tools).
Signed-off-by: Enji Cooper <yaneurabeya@gmail.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Test Plan: n/a
Reviewers: #libssh, asn
Differential Revision: https://bugs.libssh.org/D15
2019-04-29 13:17:11 +02:00
Till Wimmer
95ab5f0dce
channel: Don't send EOF on channel more than once
...
Signed-off-by: Till Wimmer <g4-lisz@tonarchiv.ch >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2019-04-29 13:17:01 +02:00
pmorris67
f05571841b
channels: Added function to create channel to UNIX socket
...
[asn: Reformatting and added openssh version check]
Signed-off-by: Philip Morris <philip.morris67@ntlworld.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2019-03-29 08:10:43 +01:00
Andreas Schneider
6cd8d4a24a
channels: Don't call ssh_channel_close() twice
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-12 18:31:31 +01:00
Andreas Schneider
c3067f8e73
channels: Send close if we received a remote close
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-10 16:42:22 +01:00
Andreas Schneider
1d5b222cc4
channels: Reformat ssh_channel_free()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-10 14:59:21 +01:00
Andreas Schneider
13b9d268d4
channel: Add SSH_CHANNEL_FLAG_CLOSED_LOCAL
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-10 14:59:21 +01:00
Andreas Schneider
0ba10870d1
channel: Reformat ssh_channel_close()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-10 14:57:50 +01:00
Andreas Schneider
e4e51ccc13
session: Check the session timeout and use it if set
...
This checks if a timeout has been set using ssh_options_set(). If it has
been set it will use that parametr by default for blocking sessions.
This is at least what users are expecting.
Fixes T33
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 17:49:19 +01:00
Anderson Toshiyuki Sasaki
8e69d435ef
channels: Set error state when closed channel is read
...
When an attempt to read a closed channel happens, set the session error
state properly.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-12-07 17:44:46 +01:00
Nicolas Viennot
59ada799d7
packets: Fix ssh_send_keepalive()
...
ssh_send_keepalive() should use global_request() to properly configure
the state machine for packet filtering.
Signed-off-by: Nicolas Viennot <nicolas@viennot.biz >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-11-20 07:55:08 +01:00
Andreas Schneider
cde13b0f00
channels: Check return code of ssh_packet_send()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-10-24 09:48:35 +02:00
Andreas Schneider
8f31623947
channels: Reformat ssh_channel_send_eof()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-10-24 09:48:35 +02:00
Andreas Schneider
253bda4bac
channels: Check return of ssh_buffer_unpack()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-10-24 09:48:35 +02:00
Anderson Toshiyuki Sasaki
68b0c7a934
CVE-2018-10933: Check channel state when OPEN_FAILURE arrives
...
When a SSH2_MSG_OPEN_FAILURE arrives, the channel state is checked
to be in SSH_CHANNEL_STATE_OPENING.
Fixes T101
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-10-16 09:19:03 +02:00
Anderson Toshiyuki Sasaki
459868c4a5
CVE-2018-10933: Check channel state when OPEN_CONFIRMATION arrives
...
When a SSH2_MSG_OPEN_CONFIRMATION arrives, the channel state is checked
to be in SSH_CHANNEL_STATE_OPENING.
Fixes T101
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-10-16 09:19:03 +02:00
Andreas Schneider
ef06ef2c1b
channels: Allow infinite timeout for ssh_channel_read_timout()
...
This is also documented.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-09-05 11:43:05 +02:00
Andreas Schneider
e558827c4e
channels: Don't read from a closed channel
...
Fixes T76
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-09-04 20:34:52 +02:00
Andreas Schneider
72e91d5131
channels: Remove memset in ssh_channel_do_free()
...
We have nice tools to detect that in the meantime.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2018-09-04 19:58:11 +02:00
Andreas Schneider
4af4b59e21
channels: Reformat ssh_channel_free()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2018-09-04 19:58:03 +02:00
Andreas Schneider
ca464ca2ba
channels: Use calloc() in ssh_channel_new()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2018-09-04 19:57:58 +02:00
Andreas Schneider
9ac6ac6c26
channel: Reformat ssh_channel_new()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2018-09-04 19:57:53 +02:00
Andreas Schneider
c2fc9ac956
channels: Fix timeout variable to match documentation
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-08-22 09:08:39 +02:00
Andreas Schneider
c503bb572e
crytpo: Make sure we check return of ssh_get_random() correctly
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-07-05 12:12:14 +02:00
Andreas Schneider
88673b2d1f
channels: Fix NULL check in channel_rcv_data callback
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-06-30 14:37:04 +02:00
Andreas Schneider
206f3ff895
Rest in Peace SSHv1
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
2018-06-29 14:41:14 +02:00
Andreas Schneider
c563ed636a
Remove vim modelines from all files
...
If you want modelines use my vim plugin:
https://github.com/cryptomilk/git-modeline.vim
git config --add vim.modeline "ts=4 sw=4 et"
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-06-28 08:41:08 +02:00
Axel Eppe
fb2fefb3c6
channels: add ssh_channel_request_send_break to support RFC 4335
...
Signed-off-by: Axel Eppe <aeppe@google.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2018-04-10 11:16:23 +02:00
Andreas Schneider
aaeb938ca4
channels: Use calloc() instead of malloc()
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2018-01-18 18:52:04 +01:00
Andreas Schneider
f0ddde4826
Fix config.h includes
...
We need stdlib.h and string.h in priv.h for free() and memset().
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2017-10-28 14:31:37 +02:00
Andreas Schneider
5437deed1b
callbacks: Add support for MSVC
...
__typeof__ is GCC specific
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
2016-11-05 20:00:02 +01:00
Aris Adamantiadis
9b3648ded0
connector: Implement ssh_connector_except()
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
2016-05-02 16:58:47 +02:00