Heiko Thiery
a77d89d3ea
session: add missing return value documentation
...
Add SSH_AGAIN as return value to ssh_handle_packets documentation.
Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit e76332bbd6 )
2020-05-05 14:33:24 +02:00
Jakub Jelen
4276560680
channels: Avoid returning SSH_AGAIN from ssh_channel_poll_timeout()
...
This addresses a regression introduced in 3bad0607 , partially fixed in 022409e9 ,
but the function was still able to return SSH_AGAIN, which was not expected by
callers.
Based on discussion in [1] and [2]
[1] https://gitlab.com/libssh/libssh-mirror/-/merge_requests/101
[2] https://www.libssh.org/archive/libssh/2020-03/0000029.html
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 6417f5a3ca )
2020-05-05 14:33:01 +02:00
Jakub Jelen
a7ce241652
channels: reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit fe0fcbbc67 )
2020-05-05 14:32:59 +02:00
Jakub Jelen
1c7cfaba9c
examples: Avoid unused parameter warnings and reformat
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit c2f64108a1 )
2020-05-05 14:32:57 +02:00
Jakub Jelen
98c91e68fa
examples: Add missing includes
...
Fixes: T225
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 58d53f1397 )
2020-05-05 14:32:31 +02:00
Jakub Jelen
078cb4c6f3
libcrypto-compat: Fix indentation and return value
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit eebb02fff5 )
2020-05-05 14:32:27 +02:00
Rosen Penev
5972d7a98e
libcrypto: remove deprecated API usage
...
EVP_CIPHER_CTX_init was replaced with _reset.
Removed EVP_CIPHER_CTX_cleanup. The successive _free call handles that.
Removed old SSLeay function usage.
Signed-off-by: Rosen Penev <rosenp@gmail.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 54296787a7 )
2020-05-05 14:32:23 +02:00
Rosen Penev
d35fdfbdb4
libcrypto-compat: add extra functions
...
Added extra functions. The next commit will switch to them.
Signed-off-by: Rosen Penev <rosenp@gmail.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 70478619ce )
2020-05-05 14:32:15 +02:00
Laurent Bigonville
7ee7ff94ba
Fix FTBFS on hurd-i386
...
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=933015
Signed-off-by: Laurent Bigonville <bigon@bigon.be >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit a881c318ac )
2020-05-05 14:32:09 +02:00
Laurent Bigonville
c42aab0122
Make the documentation reproducible
...
Signed-off-by: Laurent Bigonville <bigon@bigon.be >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 5f1d0c4795 )
2020-05-05 14:32:07 +02:00
StefanBruens
69e97057c7
Correctly parse v4 subsecond timestamps
...
All subsecond timestamps are only in the packets if both the
SUBSECOND_TIMES flag and the timestamp flag, e.g. ATTR_ACCESSTIME
are set.
SUBSECOND_TIMES are not very common across server implementations
(e.g. openssh does not include it, nor does libssh's sftpserver
implementation), but this interpretation of the SFTP protocol draft
is used by WinSCP and lftp.
Fixes T219.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 1ff6dda616 )
2020-05-05 14:32:04 +02:00
Anderson Toshiyuki Sasaki
3025eeace3
client: Check if the library is initialized in ssh_connect()
...
If the library is not initialized, SSH_ERROR is returned and the error
message is set properly.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit e3e3a27863 )
2020-05-05 14:31:59 +02:00
Anderson Toshiyuki Sasaki
ffb0007768
client: Reformat ssh_connect()
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 0f33eecc01 )
2020-05-05 14:31:58 +02:00
Anderson Toshiyuki Sasaki
a99b8a3979
init: Introduce internal is_ssh_initialized()
...
The introduced function returns whether the library is initialized or
not.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit dba2114ed7 )
2020-05-05 14:31:53 +02:00
Anderson Toshiyuki Sasaki
0a450f0251
init: Clarify the need to call ssh_{init, finalize}()
...
When libssh is statically linked, it is necessary to explicitly call
ssh_init() before calling any other provided API. It is also necessary
to call ssh_finalize() before exiting to free allocated resources.
Fixes T222
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit e3e52394c1 )
2020-05-05 14:31:49 +02:00
Andreas Schneider
9e9df61244
Bump version to 0.9.4
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
libssh-0.9.4
2020-04-09 09:30:20 +02:00
Andreas Schneider
958afb1c6a
CVE-2020-1730: Fix a possible segfault when zeroing AES-CTR key
...
Fixes T213
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit b36272eac1 )
2020-04-09 09:30:00 +02:00
Anderson Toshiyuki Sasaki
e510de0315
kex: Add support for diffie-hellman-group14-sha256
...
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 9eb1ce88ae )
2020-04-06 11:36:35 +02:00
Andreas Schneider
34c596182d
dh-gex: Check return value of ssh_get_random()
...
CID #1422162
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit d2f0d3270a )
2020-04-06 11:36:33 +02:00
Andreas Schneider
1a18d9cce2
cmake: Fix building with threading support on MinGW
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit a9a7c2dc29 )
2020-04-06 11:36:30 +02:00
Anderson Toshiyuki Sasaki
4c83d19c48
auth: Fix memory leak in ssh_userauth_publickey_auto()
...
When a key is rejected, free the allocated memory before returning.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 6bd2b93f43 )
2020-03-29 09:59:52 +02:00
Andreas Schneider
673bf1ff09
doc: Fix a doxygen warning
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 46c54e5ddb )
2020-03-27 13:15:30 +01:00
Andreas Schneider
fe1fe49617
doc: Make sure we parse the server and sftp documentation
...
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit bbfce454de )
2020-03-27 13:15:28 +01:00
Andreas Schneider
316f46f833
doc: Add SSH auth callback to libssh_auth doc group
...
Fixes T217
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 3e5dc99198 )
2020-03-27 13:15:26 +01:00
Jon Simons
0dd71375e7
pki: fix pki_key_ecdsa_to_key_type thread-safety
...
Resolves https://bugs.libssh.org/T214 .
Signed-off-by: Jon Simons <jon@jonsimons.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 3664ba2800 )
2020-02-11 10:16:00 +01:00
Andreas Schneider
9a10cef920
channels: Fix ssh_channel_poll_timeout() not returing available bytes
...
Fixes T211
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
(cherry picked from commit 022409e99c )
2020-01-23 11:03:44 +01:00
Jakub Jelen
6fcd0940e3
packet_crypt: Check return values from AEAD deciphering
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit e31e7b0406 )
2020-01-23 10:31:44 +01:00
Jakub Jelen
0c8dbf5c81
curve25519: Avoid memory leaks
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 6644f8ca3b )
2020-01-23 10:31:38 +01:00
Anderson Toshiyuki Sasaki
a0aa62fffe
gitlab-ci: Create obj directory for Windows builds
...
The obj directory is not created anymore when the git repository is
cloned. Create the directory during the build.
Also set the variable "ErrorActionPreference: STOP" to make the build to
fail if an error occurs.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 7f5e14698f )
2020-01-23 09:53:48 +01:00
Andreas Schneider
402c922a9e
pki_crypto: Fix possible memory leak on error
...
CID #1409680
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 72498bac5f )
2020-01-23 09:50:41 +01:00
Andreas Schneider
112e32ba86
messages: Add missing NULL check
...
CID #1409678
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 4b4f568a68 )
2020-01-23 09:50:35 +01:00
Andreas Schneider
e2c5f5c7d1
tests: Use correct assert function for ssh return codes
...
CID #1398983
Signed-off-by: Andreas Schneider <asn@cryptomilk.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit 6324014866 )
2020-01-23 09:50:33 +01:00
Jakub Jelen
6dcfa25c9b
socket: Fix the error message
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 3a6751f3d2 )
2020-01-23 09:50:04 +01:00
Jakub Jelen
eed8d8e957
socket: Kill the proxy command if it still runs on disconnect
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit dd64980662 )
2020-01-23 09:50:01 +01:00
Jakub Jelen
1935e15cd4
pki_gcrypt: Warn about unsupported PEM export in gcrypt
...
Based on the following mail thread:
https://www.libssh.org/archive/libssh/2019-12/0000027.html
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 24f450fed1 )
2020-01-23 09:49:52 +01:00
Jakub Jelen
238dbabef8
tests: Unbreak strict builds on Ubuntu
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 9d5616a18c )
2020-01-23 09:49:45 +01:00
Jakub Jelen
ee7ee2404a
libgcrypt: Do not leak memory with invalid key lengths
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 7e692ee1b6 )
2020-01-23 09:49:35 +01:00
Jakub Jelen
6205cad534
pki_gcrypt: Do not confuse static analyzers
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit dd54ffb2f1 )
2020-01-23 09:49:30 +01:00
Jakub Jelen
d5a37e2bf5
legacy,keys: Fix the macro conditions
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 3642224ee5 )
2020-01-23 09:49:26 +01:00
Jakub Jelen
226d2a16b0
mbedcrypto_missing: Always check return values
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 9b858f57c5 )
2020-01-23 09:49:22 +01:00
Jakub Jelen
46105f4aa6
mbedcrypto_missing: Avoid potential memory leaks as reported by csbuild
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 13c88a2e0a )
2020-01-23 09:49:19 +01:00
Jakub Jelen
62f7004d5a
pki_mbedtls: Avoid potential memory leaks
...
reported by csbuild
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 059b6851dc )
2020-01-23 09:49:16 +01:00
Jakub Jelen
d7358ee5a7
pki_mbedtls: Do not warn about unused arguments
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 71ba61cc5b )
2020-01-23 09:49:12 +01:00
Jakub Jelen
ec8cedd803
options: Avoid needless assignment as reported by csbuild
...
The error was
src/options.c:971:13: warning: Value stored to 'u' is never read
# u = 0;
# ^ ~
src/options.c:971:13: note: Value stored to 'u' is never read
# u = 0;
# ^ ~
# 969| case SSH_OPTIONS_KBDINT_AUTH:
# 970| case SSH_OPTIONS_GSSAPI_AUTH:
# 971|-> u = 0;
# 972| if (value == NULL) {
# 973| ssh_set_error_invalid(session);
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 30cc1568f4 )
2020-01-23 09:49:07 +01:00
Jakub Jelen
92124ae65a
tests: Do not require strict host key checking in openssh
...
as nothing really sets these keys up and they are probably preserverd
from some previous test, which is really not a good testing strategy.
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 8eda4165cf )
2020-01-23 09:49:02 +01:00
Jakub Jelen
ea198fee43
tests: Avoid needless assignment as reported by csbuild
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 1563bddf88 )
2020-01-23 09:48:36 +01:00
Jakub Jelen
393cd36c01
kex: Avoid always-false comparisons as reported by csbuild
...
/builds/jjelen/libssh-mirror/src/kex.c:360:17: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] <--[cc]
360 | if (len < 0) {
| ^
/builds/jjelen/libssh-mirror/src/kex.c:372:17: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] <--[cc]
372 | if (len < 0) {
| ^
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit e2841908fb )
2020-01-23 09:48:32 +01:00
Aris Adamantiadis
93bf0ab6a3
tests: fix typos
...
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit 23c529c888 )
2020-01-23 09:47:57 +01:00
Jon Simons
251f60c031
curve25519: fix uninitialized arg to EVP_PKEY_derive
...
Ensure that the `keylen` argument as provided to `EVP_PKEY_derive`
is initialized, otherwise depending on stack contents, the function
call may fail.
Fixes T205.
Signed-off-by: Jon Simons <jon@jonsimons.org >
Reviewed-by: Jakub Jelen <jjelen@redhat.com >
(cherry picked from commit b94ecf18bd )
2019-12-16 12:59:58 +01:00
Jakub Jelen
b33dcda94d
torture: Accept whole pid_t range
...
Signed-off-by: Jakub Jelen <jjelen@redhat.com >
Reviewed-by: Andreas Schneider <asn@cryptomilk.org >
(cherry picked from commit d2a32ca6d3 )
2019-12-11 11:39:01 +01:00