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

3170 Commits

Author SHA1 Message Date
Viktor Szakats
cb252b5909 GHA: silence fresh zizmor 1.21.0 warnings
Ref: https://github.com/zizmorcore/zizmor/pull/1517#issuecomment-3759740853

Closes #1791
2026-01-16 14:24:58 +01:00
Lars Nordin
179dbafb51 agent: replace strncpy() with memcpy() (#1785) 2026-01-15 12:37:59 +01:00
Viktor Szakats
bd1d00a4b3 cmake: avoid setting custom property on built-in interface targets
In some cases `ZLIB::ZLIB` and/or `OpenSSL::Crypto` may be aliases,
which prevents setting a libssh2-specific property (.pc module name)
in them:
```
CMake Error at [...]/src/CMakeLists.txt:... (set_target_properties):
  set_target_properties can not be used on an ALIAS target.
```

This can happen when doing "superbuilds" with classic zlib or zlib-ng,
which define `ZLIB::ZLIB` on their own, but as an alias, unlike CMake
does with the canonical `ZLIB::ZLIB` target.

Fix by special-casing these built-in targets and manually converting
them to .pc module names, without using the targets themselves
to carry this information throughout libssh2's internal build logic.

A side-effect of this change is that `zlib` is now present in libssh2.pc
when zlib is an indirect dependency via a crypto backend (OpenSSL or
wolfSSL). Before this patch it only appeared there when enabling zlib
explicitly for libssh2.

Ref: https://github.com/curl/curl/pull/20316
Follow-up to df0563a857 #1535

Closes #1789
2026-01-14 21:28:25 +01:00
Viktor Szakats
fb6fcaa2e2 GHA: drop FreeBSD arm64 job, it is broken upstream (#1790)
Broken since 2026-01-11:
```
The process will require 71 MiB more space.
18 MiB to be downloaded.
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:14:aarch64/quarterly/All/Hashed/libtool-2.5.4_1~f2b07c18ac.pkg: Not found
pkg: Failed to fetch https://pkg.FreeBSD.org/FreeBSD:14:aarch64/quarterly/All/Hashed/libtool-2.5.4_1~f2b07c18ac.pkg: Not found
```
Ref:
https://github.com/libssh2/libssh2/actions/runs/21008063627/job/60395548917?pr=1789#step:3:130
2026-01-14 21:26:24 +01:00
Lars Nordin
ae0a231650 kex: missing free() when random data cannot be generated (#1780)
If random cannot be generated the allocated data must be freed.
2026-01-14 21:23:52 +01:00
HJadhav-NI
0cb8351494 hostkey: prefer ED25519 over ECDSA in hostkey algorithm negotiation (#1783)
Reorders the hostkey_methods array to prioritize ED25519 host keys over
ECDSA curves, aligning libssh2 with OpenSSH's default behavior.

As noted in issue #1782, industry usage has shifted to prefer ED25519

Previous order:
ECDSA (nistp256/384/521 + certificates)
**ED25519 (ssh-ed25519 + certificates)**
RSA (SHA2-512, SHA2-256, SHA1)
DSA

New order:
**ED25519 (ssh-ed25519 + certificates)**
ECDSA (nistp256/384/521 + certificates)
RSA (SHA2-512, SHA2-256, SHA1)
DSA

Testing:
Existing test suites should pass without modification

References:
OpenSSH HostKeyAlgorithms default order: 
- https://man.openbsd.org/sshd_config#HostKeyAlgorithms
- https://man.openbsd.org/ssh_config#HostKeyAlgorithms

Fixes #1782

Signed-off-by: Hemant Jadhav <hemant.jadhav@emerson.com>
2026-01-14 21:10:46 +01:00
Viktor Szakats
882bd26488 GHA: delete disable-man-db hack, runners doing it by default now
Refs:
1f107542ae
https://github.com/actions/runner-images/pull/13268
https://github.com/actions/runner-images/issues/13213

Also delete more 3rd-party apt source to reduce flakiness.

`ondrej-ubuntu-php-noble.sources` is ubuntu arm runner-specific.

Closes #1779
2026-01-12 12:42:58 +01:00
Viktor Szakats
14de8476c3 checksrc: replace bash starter with checksrc-all.pl
To remove dependence on a shell script to start `checksrc.pl`.

Fixes #1775
Closes #1778
2026-01-12 12:42:57 +01:00
dependabot[bot]
eeaf29bae8 GHA: bump Actions (#1776)
- update `actions/checkout` from 6.0.0 to 6.0.1
- update `msys2/setup-msys2` from 2.29.0 to 2.30.0
- update `actions/cache` from 4.3.0 to 5.0.1
- update `cross-platform-actions/action` from 0.30.0 to 0.32.0
- update `actions/upload-artifact` from 5.0.0 to 6.0.0
- update `github/codeql-action` from 4.30.8 to 4.31.9
- update `docker/metadata-action` from 5.8.0 to 5.10.0
2026-01-02 09:14:37 +01:00
Viktor Szakats
fdbc32b0d1 tidy-up: parenthesis in macros (OS400)
Follow-up to d97d8e3198 #1773

Closes #1774
2025-12-26 22:40:15 +01:00
Viktor Szakats
d97d8e3198 tidy-up: parenthesis in macros
- delete superfluous ones.
- add missing ones.
  Did not cause an actual issue with the current use of these macros.

Closes #1773
2025-12-26 21:22:11 +01:00
Viktor Szakats
71804d9f8d checksrc: update, fix fallouts
Closes #1772
2025-12-26 00:38:59 +01:00
Viktor Szakats
46c7a4807c windows: always enable large-file support
It's supported by all known mingw-w64 and MSVC versions, likely also by
other modern Windows compilers.

After this patch, the `LIBSSH2_USE_WIN32_LARGE_FILES` and
`LIBSSH2_USE_WIN32_SMALL_FILES` macros are ignored by the libssh2 public
header, and it no longer defines them.

Closes #1771
2025-12-26 00:03:51 +01:00
Viktor Szakats
3865eabe6e src: move outlier leading && and || to the end of lines
Closes #1767
2025-12-26 00:01:45 +01:00
Viktor Szakats
1d464325fe include: drop stray bits of Windows CE support
libssh2 cannot be compiled for WinCE. Delete two preprocessor conditions
in the public header checking for WinCE.

Closes #1770
2025-12-25 23:45:27 +01:00
Viktor Szakats
cbe7654d72 windows: drop support for Visual Studio 2008 and older
Closes #1769
2025-12-25 23:42:25 +01:00
Viktor Szakats
c321b324d6 appveyor: disable last Windows test job, now completely broken
After this, libssh2 is left without runtime tests on Windows in CI.

```
Waiting for SSH connection from GitHub Actions....[..].... failed.
```
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53276260/job/7hom25cx4q8kf3pv (OpenSSL)
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53289394/job/rxbker53liv2nqb2 (OpenSSL)
Ref: https://ci.appveyor.com/project/libssh2org/libssh2/builds/53289591/job/gf2xfpn9cq40ey0l (WinCNG)

Closes #1768
2025-12-25 23:33:58 +01:00
Viktor Szakats
6e56a8bdca tidy-up: drop duplicate newlines, fix non-ASCII chars, other formatting, check in CI
Closes #1766
2025-12-25 22:24:13 +01:00
Viktor Szakats
35e1c653bd cmake: rename libssh2-config.cmake.in to libssh2-config.in.cmake
To:
- match filename suffix with file content.
- simplify recognizing CMake sources.
- ensure syntax highlighters use the correct file type.

Also:
- cmakelint.sh: simplify, alpha sort the filelist.

Closes #1765
2025-12-25 20:37:50 +01:00
Michael Buckley
631e2f82a3 Fix a NULL dereference of kex->exchange_keys during key exchange. (#1763)
Credit:
Aldo Ristori
2025-12-19 15:41:45 -08:00
Joshua Rogers
c10cb2449c agent: do not truncate socket path; reject (#1709)
Credit:
Joshua Rogers
2025-12-03 10:42:31 -08:00
Viktor Szakats
cb0a6cf253 RELEASE-NOTES: sync [ci skip] 2025-12-02 04:08:15 +01:00
dependabot[bot]
dd2b04f253 GHA: bump pip reuse and 2 GitHub Actions
- update `actions/checkout` from 5.0.0 to 6.0.0
- update `cross-platform-actions/action` from 0.29.0 to 0.30.0
- update pip package `reuse` from 6.1.2 to 6.2.0

Closes #1755
Closes #1756
2025-12-01 20:21:17 +01:00
Viktor Szakats
96e21c2e25 cmake: verify minimum CMake version in libssh2-config.cmake
This is the same minimum version required to build libssh2 itself (3.7).

Closes #1754
2025-12-01 20:20:56 +01:00
Viktor Szakats
69bed46a9b cmakelint: also lint CMake .in files (fixup), fix a long line
Follow-up to 9e4d307e67 #1751
2025-12-01 14:58:50 +01:00
Viktor Szakats
78cd32aada cmake: namespace all local variables in libssh2-config.cmake
Closes #1752
2025-12-01 14:50:00 +01:00
Viktor Szakats
9e4d307e67 cmakelint: also lint CMake .in files
Closes #1751
2025-12-01 14:50:00 +01:00
Viktor Szakats
2b7f82989c GHA: minor command sync with the curl repo 2025-12-01 12:23:26 +01:00
Viktor Szakats
7fd89a58fa cmake: save and restore CMAKE_MODULE_PATH in libssh2-config.cmake
Bug: https://github.com/curl/curl/pull/16973#discussion_r2572957270
Follow-up to 82b09f9b3a #1322

Closes #1750
2025-11-29 15:09:48 +01:00
Viktor Szakats
78ffc2d405 GHA: move config log dumps to their separate steps
To make configure step output more readable in case of a build error.
To expose configure logs for successful builds without adding clutter.

Also:
- set shell globally for Windows jobs.
- move all Cygwin files to `D:`.

Closes #1749
2025-11-28 13:10:27 +01:00
Viktor Szakats
c124c6a987 GHA: fix using mbedtls@3 in macOS jobs
mbedtls@3 is no longer installed to default locations. Point the builds
to it explicitly.

Follow-up to b098a3c434 #1744
Closes #1748
2025-11-28 12:25:34 +01:00
Lars Nordin
81f0203c1c userauth: fix error message for EAGAIN in public-key response (#1747) 2025-11-28 11:58:05 +01:00
Viktor Szakats
b098a3c434 GHA: switch macOS jobs to versioned mbedtls@3 brew package
To avoid bumping to 4.x with the unversioned mbedtls package.

Closes #1744
2025-11-22 02:15:36 +01:00
Joshua Rogers
8ddf3b317f agent: pageant backend, bound reply copy, handle missing reply (#1711)
The Pageant transact path trusted the 32-bit length in the shared memory
mapping and could memcpy past the mapped view. It also treated
a non-positive SendMessage(WM_COPYDATA) result as success.

Changes:

Reject replies when SendMessage returns ≤ 0 and report
LIBSSH2_ERROR_AGENT_PROTOCOL.

Bound the copy by validating response_len <= PAGEANT_MAX_MSGLEN - 4
(accounting for the length prefix) to avoid OOB reads.

Impact: prevents potential out-of-bounds read and use of uninitialized
mapping contents when Pageant misbehaves or is malicious.
2025-11-17 11:25:26 +01:00
Viktor Szakats
1045cfd033 GHA/codeql: limit cron job to the origin repository (#1741)
To avoid running it in every fork, every week.
2025-11-16 23:14:22 +01:00
Viktor Szakats
f61703cc98 GHA: add actionlint job, fix reported issues
Closes #1740
2025-11-10 19:06:11 +01:00
Viktor Szakats
f97fb271e3 scripts: fix shellcheck SC2046 warnings
Also:
- use more `--` end-of-options markers.
- checksrc.sh: use literal quotes.

Closes #1739
2025-11-10 19:06:10 +01:00
Viktor Szakats
26a78929ce GHA/dependabot: group updates, other tidy-ups 2025-11-02 17:45:02 +01:00
Viktor Szakats
455f062236 GHA: run fuzzer on master commits, bump upload-artifacts
Also adjust formatting to match curl workflows.

Closes #1736
2025-10-25 00:51:35 +02:00
Viktor Szakats
d4ebb524c5 GHA: replace deprecated set-output command with $GITHUB_OUTPUT
Fixing:
```
Image build and push
The `set-output` command is deprecated and will be disabled soon. Please upgrade
to using Environment Files. For more information
see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18667440406

Ref: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Ref: https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#environment-files

Closes #1735
2025-10-24 14:36:51 +02:00
Viktor Szakats
da6dec9319 GHA: set concurrency, zizmor Dependabot, set cooldown
Closes #1734
2025-10-24 14:27:34 +02:00
Viktor Szakats
3969991b68 cmake: small tidy-ups
- say "Absolute path" for include and library paths in Find modules.
- flatten an if tree.
- fix a typo in comment.

Closes #1732
2025-10-21 01:09:36 +02:00
Will Cosgrove
4ed26f5740 Fix sftp_symlink when getting SSH_FXP_STATUS response (#1731)
Move advancing past packet ID before reading the FXP_STATUS response.
2025-10-20 14:04:52 -07:00
Viktor Szakats
8dd9da3261 GHA: drop HOMEBREW_NO_AUTO_UPDATE=1 [ci skip]
Doesn't seem to be fixing the initial delay.

Follow-up to ec5ba06276 #1678
2025-10-20 15:07:03 +02:00
Viktor Szakats
bb7b68dee8 build: quote a cmake variable, drop redundant step in Cygwin CI jobs
Drop the `git config --global core.autocrlf input` step in Cygwin jobs.
It's no longer necessary. Also saving ~10 seconds per job.

Quote the cmake variable for consistency.

Closes #1730
2025-10-19 23:04:04 +02:00
Viktor Szakats
16ce0ec89b mbedtls: fix using garbage value (reported by clang-tidy)
In `_libssh2_mbedtls_pub_priv_key()` on a NON-error code path, a stack
variable was checked without initializing it first.

I found it interesting that clang-tidy did not find this when building
against the system mbedtls (2.x) with 2.x compatibility code still in.
Then it did find it when using a manual build of mbedtls 3.1.0 with
2.x compatibility code deleted from libssh2. Being such a trivial error
I wonder why no compiler ever detected it as a regular warning.

linux (clang-tidy, amd64, mbedTLS-prev [3.1.0], cmake, ON):
```
src/mbedtls.c:744:8: error: Branch condition evaluates to a garbage value [clang-analyzer-core.uninitialized.Branch,-warnings-as-errors]
  744 |     if(ret) {
      |        ^
```
Ref: https://github.com/libssh2/libssh2/actions/runs/18620615649/job/53091295760#step:22:44

Follow-up to 186f1a2d75 #132
Cherry-picked from #1727
Closes #1729
2025-10-18 23:59:26 +02:00
Viktor Szakats
7c92792fed GHA: bump crypto lib dependencies
Closes #1728
2025-10-18 11:03:26 +02:00
Viktor Szakats
6c6ea30d3d GHA/dependabot: minor fixes to prev
Follow-up to d223094467 #1724
2025-10-14 11:39:20 +02:00
Viktor Szakats
557611f92b checksrc: update, update local config, fix toctou in examples
Closes #1719
2025-10-14 03:29:05 +02:00
dependabot[bot]
45d52d16c3 GHA: bump components
- bump debian from `c99c733` to `1caf1c7` in /tests/openssh_server
- bump github/codeql-action from 4.30.7 to 4.30.8

Closes #1726
Closes #1725
2025-10-14 03:24:42 +02:00