1
0
mirror of https://github.com/libssh2/libssh2.git synced 2026-10-24 03:48:58 +03:00
Commit Graph

342 Commits

Author SHA1 Message Date
Viktor Szakats
14fbba968b tidy-up: prefer host key in two words for human-readable text
Closes #2618
2026-09-13 16:12:32 +02:00
Viktor Szakats
da8d048dda clang-tidy: enable readability-redundant-casting, fix/silence findings
Also:
- openssl: drop redundant local variable in non-OpenSSL3 branch.
- x11: drop redundant cast.
- silence false positives.

Follow-up to 0b915eab67 #2586

Closes #2588
2026-09-04 15:29:18 +02:00
Viktor Szakats
3f718eaa90 tidy-up: comment and formatting fixes
Closes #2525
2026-08-14 01:58:59 +02:00
Viktor Szakats
72693e4e36 tests: rename keys/tests to contain the key format
To make navigating, identifying, key files and tests easier.

Also:
- example/ssh2: sync key filenames with rest of examples.

Closes #2510
2026-08-06 01:06:21 +02:00
Viktor Szakats
d96bea7155 example: drop two local macros, merge/simplify header guards
Also: include standard headers first to not interfere with Windows
redefinitions.

Closes #2498
2026-08-03 11:49:16 +02:00
Viktor Szakats
9525a6b0bc example: assume unistd.h header on non-Windows
To avoid relying on the `HAVE_UNITSTD_H` macro set by autotools/cmake.
Also to sync with curl examples.

Closes #2492
2026-08-03 03:55:50 +02:00
Viktor Szakats
04665fedff examples: drop HAVE_GETTIMEOFDAY macro use, fill it in for MSVC
Replace `HAVE_GETTIMEOFDAY` with `_MSC_VER`. Assuming it everywhere
except on MSVC. On MSVC, fill in the missing function with a local
implementation copied from `src/misc.c`.

To improve building standalone by reducing the reliance on autotools,
cmake configure. Also to bring MSVC builds to the same functionality as
other platforms.

Cherry-picked from #2485

Closes #2491
2026-08-03 02:45:55 +02:00
Viktor Szakats
a78e2c0ca9 build: assume sys/socket.h on non-Windows
Drop feature detection for it at configure time.

To simplify, improve configure performance, make examples build better
standalone, and sync with curl.

Closes #2467
2026-08-01 11:33:12 +02:00
Viktor Szakats
24d4014194 build: assume sys/time.h on non-Windows and mingw-w64
Drop feature detection for it at configure time.

To simplify, improve configure performance, make examples build better
standalone, and sync with curl.

Closes #2466
2026-08-01 10:59:20 +02:00
Viktor Szakats
bc6a0c5a78 tidy-up: C and formatting nits
- knownhost: add link to file format.
- drop redundant parentheses.
- move literals to right-hand side of comparisons.
- unfold lines, drop empty lines.

Closes #2463
2026-07-31 22:36:45 +02:00
Viktor Szakats
fe1ef9857d scp: enable 64-bit timestamp support in libssh2_scp_recv2()
By bumping internal mtime/atime from `long` to `time_t`, and adjusting
internals to read and log these as 64-bit values.

Before this patch, these internal variables used `long`.

Also: show fileinfo in scp read examples.

Closes #2460
2026-07-31 20:49:07 +02:00
Viktor Szakats
6f3c640d0b test_ssh2, examples: bump to SHA-256 fingerprints
Closes #2445
2026-07-29 01:42:54 +02:00
Viktor Szakats
9921aeff2f tidy-up: C nits
- drop redundant `== -1` to match rest of code.
- sync outlier pattern to init `struct string_buf` `dataptr`, to drop
  repeat code and casts.
- drop redundant parentheses.
- add const to casts where missing.

Closes #2437
2026-07-28 03:20:30 +02:00
Viktor Szakats
2569543b21 tidy-up: variable name sync, comment/formatting nits
Also:
- openssl: reduce magic numbers in
  `ossl_ed25519_sk_openssh_priv_to_pubkey()`.
- libssh2_priv.h: drop redundant parentheses.

Closes #2428
2026-07-24 22:40:55 +02:00
Viktor Szakats
179348c624 tidy-up: prefer \0 as null-terminator, drop newlines
Closes #2383
2026-07-21 22:22:22 +02:00
Viktor Szakats
3d3c7f6299 src: fix handling snprintf() return values
Prepare for -1 (potentially without null-terminator), and larger than
buffer size values.

Also:
- tackle two cases in example/subsystem_netconf.c.
- cap input size at 4 MiB in `transport_debugdump()`.

Refs:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/fprintf.html
https://pubs.opengroup.org/onlinepubs/9799919799/functions/vfprintf.html

Closes #2337
2026-07-17 13:29:16 +02:00
Viktor Szakats
1e32ae76e7 tidy-up: comment typos, parentheses, formatting
- move `static`s to the top of the block.
- add missing/drop redundant parentheses.

Closes #2336
2026-07-17 02:35:06 +02:00
Viktor Szakats
deefd7f6ed windows: stop setting _CRT_NONSTDC_NO_DEPRECATE for MSVC
It wasn't needed anymore for `write()` in contratry to the comment,
because mapping it earlier to `_write()` in examples. But, it was needed
again for `strdup()` due to a regression. Fix it by mapping it again to
`_strdup()` in examples.

Also: document `vsnprintf()` used in tests.

Follow-up to ca43b304cf #2042
Follow-up to e8e6bc2c50 #1688

Closes #2332
2026-07-16 18:22:14 +02:00
Viktor Szakats
521146a4f1 src: add Unicode, long-filename, and secure fopen() support (Windows)
Low-level logic copied from curl, and adapted to libssh2.

Also: use secure fopen CRT functions.

Credits-to: Jay Satiro
Credits-to: Viktor Szakats

Closes #2318
2026-07-15 15:31:58 +02:00
Viktor Szakats
6bf392f627 build: make examples a separate target, add quick-build for cmake
- cmake: do not build examples automatically. This makes the
  `BUILD_EXAMPLES=OFF` option redundant.
- cmake: build all examples with target `libssh2-examples`.
- cmake: build-test all examples with target `libssh2-examples-build`.
  To save linking them 23 times in CI.
- autotools: add root `examples` build target to build examples.
- CI: build examples in a separate step.
  (for autotools, make them not build in the main build step by
  configuring with `--disable-examples-build`)

To make the build more transparent, scale better, be faster in CI, also
syncing with curl.

Slight downsides after this patch:
- cmake and autotools have different default behavior for building
  examples.
- cmake needs an extra step to build examples. (an explicit option is
  planned to restore the old behavior.)

Also:
- sync BSD matrix build-tool naming with rest of jobs.

Closes #2276
2026-07-12 16:27:58 +02:00
Viktor Szakats
bcef4a03ee tidy-up: fixup and reflow copyright headers
Also:
- sync with canonical `BSD-3-Clause.txt`:
  - number the clauses.
  - wording in the 3rd clause.
- add 'All rights reserved.' where missing.
- agent: sync with rest of files.
- agent: merge two, identical, embedded headers.
- fix comments nits found nearby.

Closes #2247
2026-07-08 04:22:55 +02:00
Viktor Szakats
f784c21dec test_ssh2, examples: avoid crash on NULL fingerprint
Also bail out right away to avoid other issues down the line.

Seen in CI when Libgcrypt could not negotiate keys with modern sshd
server on Ubuntu 26.04:
```
26: 1..2
26: Failure establishing SSH session: -5
26: Fingerprint: /home/runner/tests/test_sshd.test: line 151:  8233 Segmentation fault
         (core dumped) ${LIBSSH2_TEST_EXE_RUNNER:-} "${test}"
26: not ok 1 - sshd-test_ssh2
26: libssh2_session_handshake failed (-5): Unable to exchange encryption keys
```
Ref: https://github.com/libssh2/libssh2/actions/runs/28582866680/job/84747161004?pr=2174

Ref: #2174

Closes #2179
2026-07-02 19:41:05 +02:00
Viktor Szakats
7f5d5f3c21 example: check write() and fgets() results to silence -Wunused-result
Seen when building in cmake Release config on Linux:
```
example/scp_nonblock.c:254:17: error: ignoring return value
of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  254 |                 write(1, mem, (size_t)nread);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/28063084190/job/83084069984

```
example/sftp.c:73:9: error: ignoring return value of ‘fgets’ declared
with attribute ‘warn_unused_result’ [-Wunused-result]
   73 |         fgets(buf, sizeof(buf), stdin);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/28064008314/job/83084278796

Closes #2122
2026-06-24 01:56:35 +02:00
Viktor Szakats
628fb7f9c5 tidy-up: comments
- chacha: comment out unused macros.
- example: add `SHUT_RDWR` comments to match test code.
- kex: delete stray characters.
- misc: use 'null-terminator'.
- misc: nits.

Closes #2111
2026-06-21 23:15:10 +02:00
Viktor Szakats
dcd0dbab6b build: stop redefining system symbol snprintf
Introduce and use the local name `ssh2_snprintf()` instead, and map it
to system `snprintf()` when safe, otherwise directly  call the local
implementation already using this name.

Also: adjust checksrc rules.

Closes #2103
2026-06-21 17:50:20 +02:00
Viktor Szakats
3b730f2ef1 cmake: drop auto-copying runtime DLLs next to targets
This feature has been permanently enabled since the initial commit
adding CMake builds to libssh2. Limited to libssh2's own DLL (if built
that way), and OpenSSL's crypto DLL. While limited to these two DLLs
(and not supporting other dependencies), history shows this feature was
prone to break, and recently started breaking parallel builds, due to
MSBuild failing while copying the DLLs to the same location in
concurrent threads. This recently made MSVC GHA jobs flaky.

It's also a potential performance and disk trashing issue when copying
large DLLs (OpenSSL `libcrypto-*.dll`) on each build, for each of the 52
(at the time of this commit) targets. That's potentially 104 copy
operations. Perhaps this could be limited to once per each target
directory, but that's adding even more complexity and development time.
There is also no generalized/trivial way to pick up the complete set of
DLL dependencies; e.g. libcrypto.dll may need other DLLs. Another
disadvantage is copying around DLLs eventually ends up contributing to
DLL-hell, copies may go stale, picked up when undesired, or due the
heuristic detection, they may not match the dependency version/instance
actually linked. The copying was done on all platforms, while typically
the issue is exclusive to Windows MSVC (and it's also where it breaks.)

As a replacement, I propose to add any necessary DLL location to `PATH`
before running examples or tests. It works well in CI. Also in curl.

Fixing:
```
Version: 20260616.203.1
[...]
MSBuild version 17.14.40+3e7442088 for .NET Framework
[...]
D:/a/libssh2/libssh2/bld/tests/Release\libssh2.dll: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  The process cannot access the file because it is being used by another process.
[...]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd" exited with code 32. [D:\a\libssh2\libssh2\bld\tests\test_auth_pubkey_ok_rsa_sha2_256_signed.vcxproj]
  D:/a/libssh2/libssh2/bld/tests/Release/test_auth_keyboard_info_request.exe: message: deploying dependencies
  D:/a/libssh2/libssh2/bld/tests/Release\libcrypto-3-x64.dll: message: deploying dependencies
  test_auth_pubkey_ok_rsa_openssh.vcxproj -> D:\a\libssh2\libssh2\bld\tests\Release\test_auth_pubkey_ok_rsa_openssh.exe
```
Refs (MSVC):
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203784 OpenSSL
https://github.com/libssh2/libssh2/actions/runs/27838566519/job/82392203753 WinCNG
https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340632890 WinCNG UWP

Examples, with shared libssh2:
combined with WINCNG:
Before: https://github.com/libssh2/libssh2/actions/runs/27891639324/job/82535960547 (277 steps)
After: https://github.com/libssh2/libssh2/actions/runs/27901568257/job/82562736781 (229 steps)
combined with OpenSSL:
Before: https://github.com/libssh2/libssh2/actions/runs/27902131772/job/82564199274 (326 steps)
After: https://github.com/libssh2/libssh2/actions/runs/27902733625/job/82565870012 (229 steps)

Observe these steps no longer performed:
```
D:/a/libssh2/libssh2/bld/example/Release\libcrypto-3-x64.dll: message: deploying dependencies
D:/a/libssh2/libssh2/bld/example/Release\libssh2.dll: message: deploying dependencies
```

Ref: #2078
Ref: 1e5e2923f7
Follow-up to a95a02c8fb #2093
Follow-up to 97d8e8d49a #2091
Follow-up to d652ba0205 #2090
Follow-up to dd50a41152 #1638
Follow-up to 694b9d964b #1610
Follow-up to 97417ad37f #899
Follow-up to 19884e5055 #818
Follow-up to 6bf8983368

Closes #2101
2026-06-21 13:51:09 +02:00
Viktor Szakats
165a9c3bee example/ssh2: replace GCC silencer pragma with a simpler workaround
As of gcc-16, this still causes a false positive:
```
example/ssh2.c: In function 'main':
example/ssh2.c:215:34: error: '__builtin_snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
  215 |             snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
      |                                  ^~~~~~~
example/ssh2.c:215:40: note: format string is defined here
  215 |             snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
      |                                        ^
example/ssh2.c:215:13: note: '__builtin_snprintf' output 17 or more bytes (assuming 18) into a destination of size 17
  215 |             snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
      |             ^~~~~~~~
example/ssh2.c:216:34: error: '__builtin_snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
  216 |             snprintf(fn2, fn2sz, "%s/%s", h, privkey);
      |                                  ^~~~~~~
example/ssh2.c:216:40: note: format string is defined here
  216 |             snprintf(fn2, fn2sz, "%s/%s", h, privkey);
      |                                        ^
example/ssh2.c:216:13: note: '__builtin_snprintf' output 13 or more bytes (assuming 14) into a destination of size 13
  216 |             snprintf(fn2, fn2sz, "%s/%s", h, privkey);
      |             ^~~~~~~~
```

By bumping the allocated buffers by one byte, the above disappears, but
remains in gcc-13. Fix by bumping buffer by one more byte.
```
example/ssh2.c: In function ‘main’:
example/ssh2.c:228:40: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  228 |             snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
      |                                        ^
example/ssh2.c:228:13: note: ‘snprintf’ output 3 or more bytes (assuming 4) into a destination of size 3
  228 |             snprintf(fn1, fn1sz, "%s/%s", h, pubkey);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
example/ssh2.c:229:40: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
  229 |             snprintf(fn2, fn2sz, "%s/%s", h, privkey);
      |                                        ^
example/ssh2.c:229:13: note: ‘snprintf’ output 3 or more bytes (assuming 4) into a destination of size 3
  229 |             snprintf(fn2, fn2sz, "%s/%s", h, privkey);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27890978881/job/82534253967#step:24:67

Closes #2100
2026-06-21 12:57:00 +02:00
Viktor Szakats
33f6508a58 tidy-up: drop most {} blocks around single-statements
Follow-up to b171deefde #2077
Follow-up to 28824712fe #2004

Closes #2087
2026-06-21 04:59:48 +02:00
Viktor Szakats
d652ba0205 cmake: simplify and fixup varname for runtime dependencies list
- factor out the single-underscored name.
- rename double-underscored name into the `LIBSSH2_` namespace.
  Spotted by GitHub Code Quality

Follow-up to 694b9d964b #1610
Follow-up to 6bf8983368

Closes #2090
2026-06-20 20:00:29 +02:00
Viktor Szakats
5d8daffab8 x11: rename variable to fix -Wc++-keyword
Seen with clang 21:
```
example/x11.c:154:43: error: identifier 'new' conflicts with a C++ keyword [-Wc++-keyword]
  154 |                     struct chan_X11_list *new;
      |                                           ^
[...]
```
Ref: https://github.com/libssh2/libssh2/actions/runs/27823077802/job/82340633301?pr=2078

Cherry-picked from #2078
2026-06-19 18:15:35 +02:00
Viktor Szakats
ca43b304cf tidy-up: miscellaneous
- man pages: grammar
- examples: add missing parentheses to macro values
- examples: replace `write()` with `_write()` on Windows.
  (to avoid warnings.)
- examples, tests: drop redundant NULL assigments.
- examples: fix to cleanup on error in ssh2_echo, ssh2_exec.
- libssh2.rpgle.in: make hex notation consistent in comment.
- chacha, session.h: avoid comparison with literal NULL.
- prefer 'unrecognized' vs 'unknown' in error messages.
- mbedtls: sync a code pattern with others in the code in
  `ssh2_rsa_new()`.
- openssl: declutter and update comment for wolfSSL `HMAC_Update()`
  exception. Also drop FIXME as the upstream incompatibility seems
  intentional.
- pem, userauth, wincng: fix, clarify error messages.
- wincng: add explanation for `NOLINT` exception, reword another
  comment.
  (suggested by Copilot)
- misc: drop redundant parentheses.
- test_read: fix a type mismatch.
- openssl: use indexed syntax for readability.
- vms/man2help: fix tool name is help text.
- formatting: reflow, newlines, spaces, comment typos.

Some of these reported by GitHub Code Quality / Copilot.

Closes #2042
2026-06-11 14:49:52 +02:00
Viktor Szakats
4140a13c52 tidy-up: drop stray comparisons with literal zero
Drop from:
- strcmp, strncmp, strlen, memcmp, fseek, fstat

Closes #2014
2026-06-10 15:37:16 +02:00
Viktor Szakats
509eac8b96 checksrc: extend to ossfuzz, reduce scope of exceptions
Replace a few calls in tests to reduce exceptions.

Closes #1998
2026-06-08 17:14:59 +02:00
Viktor Szakats
124c68bbed src: fix stray fprintf() calls, make checksrc verify
Replace with `ssh2_deb()`.

Also:
- adjust checksrc options to verify.
- checksrc-all.pl: fix an issue preventing picking up `tests/.checksrc`.

Follow-up to c090b696c6 #1556
Follow-up to af1e591eee #796

Closes #1997
2026-06-08 16:17:00 +02:00
Viktor Szakats
04ecdb22fe build: update picky warning options, fix fallouts
- sync picky compiler warning options with curl:
  - update version mappings for latest Apple clang.
  - replace `-pedantic` with `-Wpedantic` on newer toolchains.
  - adjust warning cutoff versions.
  - enable new picky warnings.
  - unlock picky warnings for most recent MSVC.
- GHA: bump some MSVC jobs to to VS2026.

Fix fallouts:
- configure: replace `-I` with `-isystem` for dependency headers.
  Notably it silences picky warnings otherwise found in 3rd-party
  headers, e.g. `-Wreserved-identifier` in `gpg-error.h`,
  `openssl/lhash.h`, `wolfssl/wolfcrypt/hmac.h`, or
  `-Wcast-function-type-strict` in `openssl/rsa.h`.
  It also aligns autotools builds with CMake (and curl builds).
  Logic copied from curl.
- example/x11: fix to not use reserved symbols.
- include, src/libssh2_priv.h: silence `-Wreserved-identifier` locally.
  May be fixed for real in a future patch.
- avoid using reserved C++ keyword `public`.
- openssl: silence `-Wcast-function-type-strict` locally for
  non-OpenSSL3 builds.
- mbedtls, openssl: fix potentially uninitialized variable warnings.
  (extend to all compilers from MSVC in openssl)
- fix `LIBSSH2_SOCKET_MASK` signedness on Windows.
- wincng: apply casts from `int` to `enum` to silence
  `-Wimplicit-int-enum-cast`.
- configure: disable `-Wleading-whitespace=spaces` to due
  incompatibility with `AC_FUNC_ALLOCA`.
- packet: fix to pass `int` as mask length.
- fix `-Wformat-signedness`.
- src/libssh2_priv.h: silence `-Wreserved-macro-identifier` locally for
  mingw-w64 builds.
- GHA: add workaround for missing NSIS on windows-2025 runner images.

Closes #1972
2026-06-07 15:19:19 +02:00
Viktor Szakats
9538c99fc4 badwords: add checker script, fix issues found
Checker script and wordlist comes from curl.

Also:
- checksrc.pl: sync up with curl.
- unfold an IETF URL.
- update all IETF URLs where missing.

Closes #1959
2026-06-01 13:22:40 +02:00
Viktor Szakats
63e59481fa src: formatting (cont.)
- apply manually selected clang-format fixes.
- apply manual formatting fixes.
- move return type inline with the declaration.
  (for private APIs)
- os400qc3: fix missed `_libssh2_dh_ctx` -> `libssh2_dh_ctx`.
  Follow-up to 689b202320 #1923
- os400qc3: drop redundant line-continuation backslashes.
- delete copy of function name from function top comments.
- move literal to right hand side in a couple of comparisons.
- drop redundant `extern` keywords.

Follow-up to 6ffb96321c #1935

Closes #1936
2026-05-13 12:00:36 +02:00
Viktor Szakats
1db7f0239d tidy-up: formatting
- reflow a few lines.
- drop space between cast and value. To match majority of code.
- drop space between `*` and variable in declarations and argument
  lists. To match majority of code.

Closes #1899
2026-04-30 10:28:29 +02:00
Viktor Szakats
b6f307dca9 tidy-up: add missing, and drop redundant parentheses
Also:
- apply minor whitespace fixes.
- VMS/man2help.c: clarify `if` expression, drop redundant `else`
  expression.

Follow-up to 6e47049cff #1844

Closes #1898
2026-04-29 19:52:56 +02:00
Viktor Szakats
70f0208314 x11: support custom port
Closes #1890
2026-04-25 18:47:08 +02:00
Viktor Szakats
94a018b001 x11: handle libssh2_channel_write() errors more
Closes #1889
2026-04-25 17:13:58 +02:00
Viktor Szakats
d0d88123f9 x11: fix memory leak on an error branch 2026-04-24 16:05:30 +02:00
Viktor Szakats
dd5a54b78f x11: handle libssh2_session_init() error 2026-04-24 16:00:57 +02:00
Viktor Szakats
8d72d55399 x11: more fixes
- move allocations out of a loop, handle errors.
- constify a pointer.
- simplify by using `strdup()`.
- fix typo in comment.

Closes #1888
2026-04-24 15:54:58 +02:00
Viktor Szakats
b05fa6c5c2 x11: add missing newlines to fprintf() strings 2026-04-24 15:24:49 +02:00
Viktor Szakats
4117824e9e x11: more fixes and tidy ups
- handle `calloc()` failure.
- replace `malloc()` with `calloc()`.
- reduce variable scope.
- move declarations to upper block to avoid duplicates.

Closes #1887
2026-04-24 15:17:06 +02:00
Viktor Szakats
5b734389e9 x11: fix messages, buffer sizes, error handling
- fix wrong data length in `libssh2_channel_write()` call.
- fix wrong buffer size in `libssh2_channel_read()` call.
- check success of `libssh2_channel_read()` call, show error on failure.
- fix writing raw data to stdout.
- fix grammar in error messages.

Also in ssh2_agent_forwarding, ssh2_exec:
- use `else if` in two other examples.
- fix to not display `libssh2_channel_read()` when zero.

Pointed out by GitHub Code Quality

Follow-up to 32080def94

Closes #1886
2026-04-24 14:48:29 +02:00
Viktor Szakats
8eaef7c702 x11: fix/simplify node removal
Also:
- show `DEBUG` option in command-line help.
- fix indent.

Pointed out by GitHub Code Quality

Follow-up to 32080def94

Closes #1867
2026-04-24 13:35:33 +02:00
Viktor Szakats
d8b219ba6e examples: readd sys/time.h where necessary
Also add comments saying why `sys/time.h` is included.

Reported-by: nnarayanamurthy on github
Fixes #1792
Follow-up to e53aae0e16 #1001

Closes #1863
2026-04-15 15:07:21 +02:00
Viktor Szakats
cbf2f0747b checksrc: update, fix new issues found
Closes #1850
2026-04-11 01:41:22 +02:00