1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-07 08:02:56 +03:00
Commit Graph

2997 Commits

Author SHA1 Message Date
Dan Fandrich
27ef3bbb25 Improve the ssh2 example program to run a command
This performs better as an example since it shows more working code, and
in the simplest possible way. It also turns the program into an actually
useful tool out of the box, able to run an arbitrary command (with one
restriction) on a remote machine and return the response, without
needing to touch the source.

Closes #800
2023-02-24 09:24:06 -08:00
Will Cosgrove
af1e591eee Add NULL session check to _libssh2_error_flags() (#796)
Don't dereference null if a null session happens to make it into _libssh2_error_flags()
2023-02-14 09:13:04 -08:00
Dan Fandrich
eefc06f2ef Reorder AES crypt methods so stronger ones are first
This make it more likely that a stronger one will be negotiated rather
than a weaker variant.
2023-02-07 17:41:23 -08:00
Dan Fandrich
879a2e4bf6 CI: update uses: dependencies to the latest versions
We were seeing some deprecation warning messages on some of the older
ones.
2023-01-06 14:12:39 -08:00
Dan Fandrich
1e1a74eb7e transport.c: Add some comments 2023-01-06 13:48:37 -08:00
Dan Fandrich
16619a8edd Add missing files to automake makefiles & build tests
Many files have been added to the cmake build files but not the automake
ones in recent years. Missing ones have been added so automake "make
dist" will now create a usable tar ball.

The integration tests using Docker are now built with automake as well
(with "make check").  They are not run yet since they aren't working yet
on Linux.
2023-01-06 10:47:32 -08:00
Dan Fandrich
e3ce906caf tests: Fix gcc compile warnings
These were mostly due to missing and non-ANSI prototypes.
2023-01-06 10:47:32 -08:00
Dan Fandrich
6cba487395 Enable trace debugging in example/ssh2
This is intended to be a test program, so debugging is likely to be
useful by default.
2022-12-30 12:22:33 -08:00
Dan Fandrich
d4062feb3d Improve example/ssh2 to allow unmodified use of public key auth
The previous hard-coded key file paths were not valid for normal users.
Make the paths relative to the user's home directory instead so they
can work out of the box.  Add a banner showing what connection will be
attempted to make it easier for the user to see what is being attempted.
Enable trace debugging since this is designed as a test program.
2022-12-30 12:22:33 -08:00
Viktor Szakats
2e2812dde8 openssl.h: enable ed25519 for LibreSSL 3.7.0 (#778)
This brings LibreSSL libssh2 builds on par with OpenSSL.
2022-12-13 22:11:13 +01:00
Dan Fandrich
9f8e69cca0 configure.ac: check for sys/param.h
This file is required by glibc for the test suite.
2022-12-05 17:12:07 -08:00
Viktor Szakats
f6694beb21 tests: add option to run tests without docker (#762)
via `export OPENSSH_NO_DOCKER=1`.

SSH server host can be set via:
  `export OPENSSH_SERVER_HOST=127.0.0.1`

SSH server port via existing:
  `export OPENSSH_SERVER_PORT=4711`

This requires more work to be usable out of the box. The necessery sshd
config is (partly) embedded into `tests/openssh_server/Dockerfile`.

After this patch, it is possible to run tests in envs where docker is
not installed or not available, by running a preconfigured,
non-containerized sshd.
2022-11-12 12:40:40 +01:00
Michael Buckley
821d50dad3 Skip leading \r and \n characters in banner_receive() (#769)
Fixes #768

Credit:
Michael Buckley
2022-11-09 15:56:22 -08:00
Zenju
5c3e53f0ee Fixed error handling of _libssh2_packet_requirev callers (#767)
Notes:

some callers of _libssh2_packet_requirev() fail to set _libssh2_error().
This creates the situation where e.g. libssh2_session_handshake() fails, but libssh2_session_last_error() confusingly returns LIBSSH2_ERROR_NONE.

Credit:
Zenju
2022-11-08 13:55:34 -08:00
Will Cosgrove
0986fee58b Revert usage of EVP_CipherUpdate #764 #739 (#765)
Revert usage of EVP_CipherUpdate from wolfSSL PR to fix #764 #739.
2022-11-02 09:28:45 -07:00
Will Cosgrove
0ba6e74bec Fix regression with rsa_sha2_verify #758 (#763)
Fixes comparison with the result value coming from `mbedtls_rsa_pkcs1_verify`. Success is 0, not 1.
2022-10-26 16:48:52 -07:00
Marc Hoersken
ca818c5134 CI: fix AppVeyor status failing for starting jobs 2022-10-24 20:46:19 +02:00
Viktor Szakats
b542466c72 delete cast5 - null-cipher mapping 2022-10-24 15:11:11 +02:00
Viktor Szakats
f1d60b1fb3 more feature guard cleanup 2022-10-24 15:11:11 +02:00
Viktor Szakats
d46091b22e indent 2022-10-24 15:11:11 +02:00
Viktor Szakats
942b94a937 formatting 2022-10-24 15:11:11 +02:00
Viktor Szakats
5387c506b4 fold long lines 2022-10-24 15:11:11 +02:00
Viktor Szakats
f0583d5608 cleanup 2022-10-24 15:11:11 +02:00
Viktor Szakats
c51a78657f temporarily silence checksrc 2022-10-24 15:11:11 +02:00
Viktor Szakats
048a6b411f add mbedTLS 3.x support
Make libssh2 compile cleanly with mbedTLS 3.x and later.

This patch makes use of `MBEDTLS_PRIVATE()`, which is not the
recommended, future-proof way to access mbedTLS data structures. This
method may break with a minor upgrade, according to the authors. This
is also the method used by libcurl.

Also:

- Fix a potentially uninitialized variable in
  `libssh2_mbedtls_rsa_sha2_sign()`. This happened in an error path,
  resulting in an unnecessary mbedTLS API call, with an uninitialized
  `md_type`.

- Bump mbedTLS version used in CI tests to 3.2.1.

Fixes #751
2022-10-24 15:11:11 +02:00
Viktor Szakats
e9561dd66e tests: add option to enable all trace messages in fixture
via `export FIXTURE_TRACE_ALL=1`.
2022-10-24 11:54:15 +02:00
Viktor Szakats
ea5d83d330 win32/GNUmakefile: add mbedTLS support
via `export MBEDTLS_PATH=<mbedtls-root>`.
2022-10-23 11:50:10 +02:00
Marc Hoersken
c2a7fad06b CI: fix AppVeyor job links only working for most recent build
Ref: https://github.com/curl/curl/pull/9768#issuecomment-1286675916
Reported-by: Daniel Stenberg

Follow up to #754
2022-10-21 22:57:23 +02:00
Marc Hoersken
44379f4762 CI: add missing permission section to AppVeyor status workflow
Follow up to #754
2022-10-20 20:57:21 +02:00
Marc Hoersken
94bd3d87c5 Remove OSSFuzz integration which was replaced with CIFuzz (#756)
Confirmed-by: Max Dymond
2022-10-18 20:28:30 +02:00
Marc Hoersken
fb8b84bc9f Rename workflow file appveyor.yml to appveyor_docker.yml 2022-10-16 21:26:42 +02:00
Marc Hoersken
612779b02c Streamline names of CI workflow jobs 2022-10-16 21:23:56 +02:00
Jeroen Ooms
752d90f217 Add CI for mingw-w64 via msys2 (#742)
Credit: Jeroen Ooms
2022-10-16 21:14:52 +02:00
Marc Hoersken
70a85e9c6e CI: report AppVeyor build status for each job (#754)
Also give each job on AppVeyor CI a human-readable name.

This aims to make job and therefore build failures more visible.
2022-10-16 21:08:39 +02:00
Michael Buckley
ed439a29bb Support for sk-ecdsa-sha2-nistp256 and sk-ssh-ed25519 keys, FIDO (#698)
Notes:
Add support for sk-ecdsa-sha2-nistp256@openssh.com and sk-ssh-ed25519@openssh.com key exchange for FIDO auth using the OpenSSL backend. Stub API for other backends.

Credit:
Michael Buckley
2022-09-29 09:05:34 -07:00
Y. Yang
ef292424bb Fix DLL import library name (#711)
Notes:
Fix DLL import library name

https://aur.archlinux.org/packages/mingw-w64-libssh2
https://cmake.org/cmake/help/latest/prop_tgt/IMPORT_PREFIX.html

Credit:
metab0t
Y. Yang
2022-09-23 10:41:35 -07:00
skundu07
8b3a864c5b Add RSA-SHA2 support for the WinCNG backend (#736)
Notes:
Added code to support RSA-SHA2 for WinCNG backend.

Credit:
skundu07
2022-09-23 10:11:20 -07:00
Gabriel Smith
bd9c65d68c sftp: Prevent files from being skipped if the output buffer is too small (#746)
Notes:
LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned if the buffer is too small
to contain a returned directory entry. On this condition we jump to the
label `end`. At this point the number of names left is decremented
despite no name being returned.

As suggested in #714, this commit moves the error label after the
decrement of `names_left`.

Fixes #714

Credit:
Co-authored-by: Gabriel Smith <gabriel.smith@precisionot.com>
2022-09-23 10:03:56 -07:00
bgermann
91adeae486 Drop advertisement clause on Blowfish (#747)
Originally driven by https://github.com/pyca/bcrypt/issues/169, OpenBSD
removed Niels Provos's BSD advertisement clause in version 7.1:

https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.c.diff?r1=1.1&r2=1.2
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/lib/libsa/blowfish.h.diff?r1=1.1&r2=1.2

This enables using libssh2 in GPL software.
2022-09-20 15:29:05 -07:00
zhaochongliu
09f0ffd9fb Support building with gcc < version 8
Files: CMakeLists.txt

Notes: don't use gcc arguments that don't exist in gcc versions lower than 8 if building with older gcc.

Credit:
zhaochongliu
2022-09-07 10:54:25 -07:00
Miguel de Icaza
6c59eea5a9 Document the obscure LIBSSH2_ERROR_BAD_USE when writing to a channel (#713)
Document the obscure LIBSSH2_ERROR_BAD_USE when writing to a channel

Credit:
Miguel de Icaza
2022-08-16 09:13:51 -07:00
Michael Buckley
31ae48885d Don't erroneously log SSH_MSG_REQUEST_FAILURE packets from keepalive (#727)
Notes:
When setting a ServerAliveInterval using libssh2_keepalive_config() with want_reply set to true, some servers will reply to the keep-alive requests with a single SSH_MSG_REQUEST_FAILURE packet. This is an allowed behavior in RFC 4254, section 4.

Credit:
Michael Buckley
2022-08-16 09:09:47 -07:00
Ryan Kelley
891ee16ab6 Updating docs for libssh2_channel_flush_ex (#728)
Notes:
In #614 it was identified the docs do not accurately show how libssh2_channel_flush_ex() return value is set. I have updated the doc's to correctly show what the function is returning.

Credit:
Ryan Kelley
2022-08-09 17:05:35 -07:00
Sandeep Bansal
4b21e49d9d Support RSA certificate authentication (#710)
* Adding support for signed RSA keys and unit test

Credit:
Sandeep Bansal
2022-07-28 08:57:34 -07:00
Viktor Szakats
7483edfada configure: add --disable-tests option 2022-07-02 11:54:39 +02:00
Viktor Szakats
3adc8e9081 cmake: do not add libssh2.rc to the static library 2022-05-26 15:12:11 +02:00
AyushiN
3af1f4f446 Fixed typo #697 (#701)
Credit:
AyushiN
2022-05-23 10:35:28 -07:00
Viktor Szakats
b952674f12 Openssl: add support for LibreSSL 3.5.x (#700)
LibreSSL 3.5.0 made more structures opaque, so let's enable existing
support for that when building against these LibreSSL versions.

Ref: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.5.0-relnotes.txt

Credit:
Viktor Szakats
2022-05-19 09:35:16 -07:00
Michael Buckley
4b057bd2d9 Ensure KEX replies don't include extra bytes (#696)
Addresses #695

Credit:
Michael Buckley, reported by Harry Sintonen
2022-05-06 08:40:19 -07:00
Zenju
dba9ad9d3d Fix buffer overflow during SSH_MSG_USERAUTH_BANNER (#693)
File: userauth.c
Notes:
This patch fixes application crashes due to heap corruption. Turns out the null terminator is written one byte outside of the allocated area.
Credit:
Zenju
2022-04-25 11:49:11 -07:00