1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-01-27 00:18:12 +03:00
Commit Graph

3010 Commits

Author SHA1 Message Date
Viktor Szakats
766bde9fb9 docs: replace SHA1 with SHA256 in CMake example 2023-06-23 16:31:16 +00:00
Viktor Szakats
3d309f9b8d checksrc: modernise perl file open
Use regular variables and separate file open modes from filenames.

Suggested by perlcritic

Copied from 7f669aa0f1
Copied from https://github.com/curl/trurl/commit/f2784a9240f47ee28a845
2023-06-23 16:30:41 +00:00
Viktor Szakats
fe6239a11f reuse: comply with 3.1 spec and 2.0.0 checker
The checker tool was upgraded upstream to 2.0.0 and the REUSE
Specification to version 3.1 (from 3.0), causing these new errors:
```
reuse.project - WARNING - Copyright and licensing information for 'docs/INSTALL_AUTOTOOLS' have been found in 'docs/INSTALL_AUTOTOOLS' and the DEP5 file located at '.reuse/dep5'. The information in the DEP5 file has been overridden. Please ensure that this is correct.
reuse.project - WARNING - Copyright and licensing information for 'tests/openssh_server/Dockerfile' have been found in 'tests/openssh_server/Dockerfile' and the DEP5 file located at '.reuse/dep5'. The information in the DEP5 file has been overridden. Please ensure that this is correct.

The following files have no licensing information:
* docs/INSTALL_AUTOTOOLS
* tests/openssh_server/Dockerfile
```
Via: https://github.com/libssh2/libssh2/actions/runs/5333572682/jobs/9664211341?pr=1098#step:4:4

Ref: https://github.com/fsfe/reuse-tool/releases/tag/v2.0.0
Ref: https://git.fsfe.org/reuse/docs/src/branch/stable/CHANGELOG.md#3-1-2023-06-21

Original discovery: https://github.com/libssh2/libssh2/pull/1098#issuecomment-1600719575

Fixes #1101
Closes #1102
2023-06-21 17:43:42 +00:00
Viktor Szakats
b2916b286b tests: trap signals in scripts
Closes #1098
2023-06-21 12:50:26 +00:00
Viktor Szakats
ad7188456f test_sshd.test: fixup to distcheck failure
Fixes:
```
ERROR: test_sshd.test - missing test plan
ERROR: test_sshd.test - exited with status 1
```
Ref: https://github.com/libssh2/libssh2/actions/runs/5322354271/jobs/9638694218#step:10:532

Caused by trying to create the log file in a read-only directory.

Follow-up to 299c204062
Closes #1099
2023-06-21 11:08:44 +00:00
Viktor Szakats
299c204062 test_sshd.test: show sshd and test connect logs on harness failure (#1097) 2023-06-21 10:09:45 +02:00
Joel Depooter
2388a3aa49 Fix incorrect byte offset in debug message (#1096)
Fixes debug log message

Credit:
Joel Depooter
2023-06-16 13:55:28 -07:00
Viktor Szakats
9218d37798 tidy-up: delete whitespace at EOL [ci skip] 2023-06-16 11:34:17 +00:00
Viktor Szakats
9d7bc25306 mbedtls: include version.h for MBEDTLS_VERSION_NUMBER
Older (2021 or earlier?) mbedTLS releases require this.

Reported-by: rahmanih on Github
Fixes #1094
Closes #1095
2023-06-16 11:22:43 +00:00
Viktor Szakats
82d1b8ff47 hostkey: do not advertise ssh-rsa when SHA1 is disabled
Before this patch OpenSSL, mbedTLS, WinCNG and OS/400 advertised both
SHA2 and SHA1 host key algos, even when SHA1 was not supported by the
crypto backend or when forcefully disabled via `LIBSSH2_NO_RSA_SHA1`.

Reported-by: João M. S. Silva
Fixes #1092
Closes #1093
2023-06-14 20:41:17 +00:00
Viktor Szakats
12ae9645ff openssl.h: whitespace tidy-up [ci skip] 2023-06-14 12:34:18 +00:00
Dan Fandrich
e8cabdcf2c test_sshd.test: set a safe PID directory (#1089)
The compiled in default to sshd can be a non-writable location since it
expects to be run as root.
2023-06-14 00:09:48 +02:00
Viktor Szakats
36c1e1d1f2 mingw: fix printf mask for 64-bit integers
Before 02f2700a61 #846 #876, we used
`%I64d'. That patch changed this to `%lld`. This patch uses `PRId64`
(defined in `inttypes.h`).

Fixes #1090
Closes #1091
2023-06-13 17:47:47 +00:00
Viktor Szakats
d29eea1d29 test_sshd.test: minor cleanups 2023-06-07 15:10:01 +02:00
Daniel Stenberg
f6aa31f48f provide SPDX identifiers
- All files have prominent copyright and SPDX identifier
- If not embedded in the file, in the .reuse/dep5 file
- All used licenses are in LICENSES/ (not shipped in tarballs)
- A new REUSE CI job verify that all files are OK

Assisted-by: Viktor Szakats

Closes #1084
2023-06-07 08:18:55 +02:00
Viktor Szakats
8b92499940 src: improve MSVC C4701 warning fix
Simplify the code to avoid this warning. This might also help avoiding
it with other compilers (e.g. gcc?).

Improves 02f2700a61 #876
Might fix #1083
Closes #1086
2023-06-06 12:13:55 +00:00
Daniel Stenberg
f4f52ccc4d configure.ac: remove AB_INIT
Not used. Remove m4/autobuild.m4 as well
2023-06-05 19:33:09 +02:00
Viktor Szakats
187d89bb07 copyright: remove years from copyright headers
Also:
- uppercase `(C)`.
- add missing 'All rights reserved.' lines.
- drop duplicate 'Author' lines.
- add copyright headers where missing.
- enable copyright header check in checksrc.

Reasons for deleting years (copied as-is from curl):
- they are mostly pointless in all major jurisdictions
- many big corporations and projects already don't use them
- saves us from pointless churn
- git keeps history for us
- the year range is kept in COPYING

Closes #1082
2023-06-04 19:19:16 +00:00
Viktor Szakats
43df6a46b1 tests: cast to avoid -Wchar-subscripts with Cygwin
```
In file included from $HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/openssh_fixture.c:57:
$HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/openssh_fixture.c: In function 'run_command_varg':
$HOME/src/cygwin/libssh2/libssh2-1.11.0-1.x86_64/src/libssh2-1.11.0/tests/openssh_fixture.c:136:37: warning: array subscript has type 'char' [-Wchar-subscripts]
  136 |         while(end > 0 && isspace(buf[end - 1])) {
      |                                  ~~~^~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/files/11644340/cygwin-x86_64-libssh2-1.11.0-1-check.log

Reported-by: Brian Inglis
Fixes #1080
Closes #1081
2023-06-04 00:25:59 +00:00
Viktor Szakats
003fb454c3 tidy-up: avoid exclamations, prefer single quotes, in outputs
Closes #1079
2023-06-03 12:51:56 +00:00
Viktor Szakats
c89174a78b autotools: improve libz position
We repositioned crypto libs in 4f0f4bff5a
via #941 and subsequently in d4f58f0343
from d93ccf4901 via #1013.

This patch moves libz accordingly, to unbreak certain build scenarios.

Reported-by: Kenneth Davidson
Regression from 4f0f4bff5a #941
Fixes #1075
Closes #1077
2023-06-01 09:17:40 +00:00
Viktor Szakats
8b917d765f src: bump hash_len to size_t in LIBSSH2_HOSTKEY_METHOD
Follow-up to 7b8e02257f
Closes #1076
2023-05-31 23:28:09 +00:00
Viktor Szakats
c6e137f7aa ci: add non-static autotools i386 build, ignore GHA updates on AppVeyor
Add a non-static autotools build to GitHub Actions. Make this build
target i386 and libgcrypt, to test a new build combination if we are at
it.

Also:
- GHA: add necessary generic bits for i386 autotools builds.
- AppVeyor CI: teach it to ignore commits updating our GHA config.

Follow-up to 572c57c9d8 #1072
Closes #1074
2023-05-31 15:04:51 +00:00
Xi Ruoyao
572c57c9d8 autotools: skip tests requiring static lib if --disable-static (#1072)
Co-authored-by: Viktor Szakats
Regression from 83853f8aea #663
Fixes #1056
2023-05-31 15:03:11 +02:00
Viktor Szakats
e5c0304333 ci: prefer = operator in shell snippets
Closes #1073
2023-05-31 09:21:21 +00:00
Viktor Szakats
7b8e02257f src: bump DSA and ECDSA sign hash_len to size_t
Closes #1055
2023-05-31 08:29:03 +00:00
Viktor Szakats
c317e06faa scp: fix missing cast for targets without large file support
E.g. on 32-bit Linux. Issue revealed after adding i386 Linux CI build
in abdf40c741 #1057.

```
/home/runner/work/libssh2/libssh2/src/scp.c: In function 'scp_recv':
/home/runner/work/libssh2/libssh2/src/scp.c:765:23: error: conversion from 'libssh2_int64_t' {aka 'long long int'} to '__off_t' {aka 'long int'} may change value [-Werror=conversion]
  765 |         sb->st_size = session->scpRecv_size;
      |                       ^~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/5126803482/jobs/9221746299?pr=1054#step:12:51

Regression from 5db836b2a8 #1002
Closes #1060
2023-05-31 02:05:28 +00:00
Viktor Szakats
bc69ac232a mbedtls.h: formatting [ci skip]
For consistency with `mbedtls.c`.

Follow-up to 1153ebdeba
2023-05-30 23:40:27 +00:00
Viktor Szakats
e800038cb9 libssh2.h: bump to 1.11.1_DEV [ci skip] 2023-05-30 23:12:40 +00:00
Viktor Szakats
1153ebdeba mbedtls: use more size_t to sync up with crypto.h
Ref: 5a96f494ee #846 #879

Fixes #1053
Closes #1054
2023-05-30 23:00:53 +00:00
Viktor Szakats
ab8e95bcfc ci: drop redundant/unused vars, sync var names
Closes #1059
2023-05-30 23:00:51 +00:00
Viktor Szakats
abdf40c741 ci: add i386 Linux build (with mbedTLS)
Also:
- reorder Linux build matrix to make build tool more visible.
- hide apt-get progress bar.
- prepare package install step for i386 builds.

Detects bug #1053
Closes #1057
2023-05-30 22:19:35 +00:00
Viktor Szakats
d67a91aa10 checksrc: switch to dot file
Closes #1052
2023-05-30 17:24:28 +00:00
Daniel Stenberg
1c3f1b7da5 libssh2.h: bump to 1.11.0 for release libssh2-1.11.0 2023-05-30 17:58:13 +02:00
Will Cosgrove
1a186f1ead Libssh2 1.11 release notes, copyright (#1048)
* Libssh2 1.11 release notes, copyright
2023-05-30 08:57:13 -07:00
Viktor Szakats
e7a542da6a add copyright/credits
Closes #1050
2023-05-29 17:07:11 +00:00
Viktor Szakats
3f4ea939b4 ci: add LIBSSH2_NO_AES_CBC to GNU Make build
Closes #1049
2023-05-28 00:05:01 +00:00
Viktor Szakats
801aebc6a0 ci: add wolfSSL Linux builds
Exclude wolfSSL builds from tests. All fail:

```
2/43 Test  #2: test_aa_warmup ............................***Failed    5.59 sec
libssh2_session_handshake failed (-44): Unable to ask for ssh-userauth service
```
Ref: https://github.com/libssh2/libssh2/actions/runs/5085775952/jobs/9139583212#step:12:942 (with logging)
Ref: https://github.com/libssh2/libssh2/actions/runs/5085586301/jobs/9139192562#step:12:225

wolfSSL version:
```
Get:1 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl32 amd64 5.2.0-2 [818 kB]
Get:2 http://azure.archive.ubuntu.com/ubuntu jammy/universe amd64 libwolfssl-dev amd64 5.2.0-2 [1194 kB]
```

Cherry-picked from #1046
Closes #1046
2023-05-26 01:45:36 +00:00
Viktor Szakats
8e3bbd80eb ci: mbedTLS build config tidy-up
Cherry-picked from #1046
2023-05-26 00:27:54 +00:00
Viktor Szakats
4beb7a3a12 wolfssl: fix detection of AES-GCM feature
Follow-up to df513c0128

Ref: https://github.com/libssh2/libssh2/issues/1020#issuecomment-1562069241
Closes #1045
2023-05-25 22:30:13 +00:00
Viktor Szakats
ddb3be7dad build: fix 'unused' compiler warnings with all NO options set
- add `LIBSSH2_NO_ED25519` build-time option to force-disable ED25519
  support. Useful to replicate crypto-backend builds without ED25519,
  such as wolfSSL.

- openssl: fix unused variable and function warnings with all supported
  `LIBSSH2_NO_*` options enabled.

- mbedtls: fix misplaced `#endif` leaving out the required internal
  public function `libssh2_supported_key_sign_algorithms()`.

- mbedtls: add missing prototype for two internal public functions.

- delete a redundant block.

All `NO` options:
```shell
CPPFLAGS='
-DLIBSSH2_NO_MD5 -DLIBSSH2_NO_HMAC_RIPEMD -DLIBSSH2_NO_DSA
-DLIBSSH2_NO_RSA -DLIBSSH2_NO_RSA_SHA1
-DLIBSSH2_NO_ECDSA -DLIBSSH2_NO_ED25519 -DLIBSSH2_NO_AES_CTR
-DLIBSSH2_NO_BLOWFISH -DLIBSSH2_NO_RC4 -DLIBSSH2_NO_CAST
-DLIBSSH2_NO_3DES'
```

Closes #1044
2023-05-19 10:27:39 +00:00
Viktor Szakats
e692c55bc0 cmake: avoid list(PREPEND) for compatibility
`list(PREPEND)` requires CMake v3.15, our minimum is v3.1. `APPEND`
should work fine for headers anyway.

Also fix a wrongly placed comment.

Ref: https://cmake.org/cmake/help/latest/command/list.html#prepend

Regression from 1e3319a167d2f32d295603167486e9e88af9bb4e

Closes #1043
2023-05-18 23:36:58 +00:00
Viktor Szakats
1c9323416c checksrc: verify label indent, fix fallouts
Also update two labels to match the rest of the source.

checksrc update credit: Emanuele Torre @emanuele6

Ref: https://github.com/curl/curl/pull/11134

Closes #1042
2023-05-18 14:07:01 +00:00
Viktor Szakats
bfcf796c17 tidy-up: minor nits 2023-05-15 22:37:50 +02:00
Viktor Szakats
c7074ccc9d ci: drop default shared/static configuration options
Both autotools and cmake build both shared and static lib by default.

Ref: 896154bc17

Delete configuration enabling these explicitly in CI jobs.

Cherry-picked from #1036
Closes #1036
2023-05-09 08:14:05 +00:00
Viktor Szakats
896154bc17 cmake: enable shared libssh2 library by default
This brings default behaviour in sync with autotools, which builds both
lib flavours by default.

(Notice that on Windows, autotools includes the Windows Resource in the
static library, when building both at the same time. CMake doesn't have
this issue.)

Enabling both lib flavours has a side-effect when using non-MinGW
toolchains (e.g. MSVC): to resolve the filename conflict between import
and static libraries, we add a suffix to the static lib, naming it
`libssh2_static.lib`. This can break dependent builds relying on
`libssh2.lib` for linking the static libssh2.

Workarounds:

- disable either shared or static libssh2 via
  `-DBUILD_STATIC_LIBS=OFF` or
  `-DBUILD_SHARED_LIBS=OFF`. This results in a libssh2 library (either
  static or shared) without a prefix: `libssh2.lib`.

- set a custom static library suffix via:
  `-DSTATIC_LIB_SUFFIX=_my_static`. Resulting in
  `libssh2_my_static.lib`, and import library
  `libssh2.lib`.

- set a custom import library suffix via:
  `-DIMPORT_LIB_SUFFIX=_my_implib`. Resulting in
  `libssh2_my_implib.lib` import library, and static library
  `libssh2.lib`.

- customize the default static/import library suffix (incl. extension)
  via
  `-DCMAKE_STATIC_LIBRARY_SUFFIX=_my_static_suffix.lib` or
  `-DCMAKE_IMPORT_LIBRARY_SUFFIX=_my_import_suffix.lib`.

Cherry-picked from #1036
2023-05-09 08:12:52 +00:00
Viktor Szakats
837fa4b8b7 cmake: tweak static/import lib name collision avoidance logic
The collision issue affects (typically) MSVC, when building both shared
and static libssh2 in one go.

Ref: https://stackoverflow.com/questions/2140129/what-is-proper-naming-convention-for-msvc-dlls-static-libraries-and-import-libr

Initially we handled this by appending the `_imp` suffix to the import
library filename. This is how curl tackles this, but on a second look,
this solution seem to be accidental and has no widespread use.

It seems more widely accepted to use the '_static' suffix for the static
library. This patch implements this.

(MinGW, Cygwin and unixy platforms are not affected by this issue.)

Follow-up to 4e2580628d

Cherry-picked from #1036
2023-05-09 08:12:45 +00:00
Viktor Szakats
a791c0b26a cmake: add IMPORT_LIB_SUFFIX (like STATIC_LIB_SUFFIX)
Allow resolving the import/static library name collision also by setting
a custom _import_ library name suffix.

Follow-up to 4e2580628d

Cherry-picked from #1036
2023-05-09 08:12:39 +00:00
Viktor Szakats
9bd4d94a0c ci: do not disable shared lib with msys2/autotools in GHA
Cherry-picked from #1036
2023-05-09 08:12:33 +00:00
Viktor Szakats
4fcb97bde5 Makefile.mk: fix DYN=1 test by skipping tests needing static lib
`DYN=1` means to build examples/tests against the shared libssh2.

Before this patch this was broken for building tests. This patch skips
building tests that require the static libssh2 library, so the build now
succeeds.

Also move the list of tests that require static lib from
`CMakeLists.txt` to `Makefile.inc`, so that we can reuse it in
`Makefile.mk`.

Couldn't find a way to also reuse it in `Makefile.am`. Move the
`Makefile.am` specific definitions close to the shared list, to make it
easier to keep them synced.

Cherry-picked from #1036
2023-05-09 08:12:25 +00:00