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

54 Commits

Author SHA1 Message Date
Viktor Szakats
9a0b40af73 tidy-up: version-related comments and messages
If it improves consistency across builds and sources, prefer 'greater'
or newer/later/+, prefer no 'v'/'version` prefix.

Closes #1866
2026-08-27 03:25:32 +02:00
Viktor Szakats
3f718eaa90 tidy-up: comment and formatting fixes
Closes #2525
2026-08-14 01:58:59 +02:00
Viktor Szakats
8563c38383 build: assume POSIX gettimeofday() in fallback codepath, stop detecting it
The codebase no longer relies on `gettimeofday()`. It still serves as an
unconditional fallback in `ssh2_now()` on non-Windows, if no modern
alternative exists. Let us know if this causes an issue.

To simplify, make configure fast, and avoid the detection discrepancy
between autotools and cmake.

Follow-up to 0d998d16c0 #2494
Follow-up to 694d38e33e #2493
Follow-up to a43dc6d504 #2490
Follow-up to 04665fedff #2491
Follow-up to c97959e9b6 #2489
Follow-up to 9c421761bc #2341

Closes #2485
2026-08-03 03:54:47 +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
f7cdcd728c build: assume POSIX select() is available
`select()` was used unconditionally in internal function
`ssh2_wait_socket()`, when `poll()` is not available, since
9d55db6501 (2007-02-02, release 0.15)

It means the build was broken without `select()` in such case. There
were also no reports about this being an issue. Therefore detecting it
at configure time is superfluous.

Drop feature detections, and drop `libssh2_poll()` implementation
fallback logic dealing with an impossible no-poll-no-select build.

Follow-up to 9d55db6501

Closes #2464
2026-08-01 00:32:27 +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
be18d596c0 build: assume standard snprintf()
Stop detecting standard `snprintf()`, and expect it to be available.

Except for the only known platform where it's missing: Visual Studio
2013 and older, where we keep using the existing local implementation.

`snprintf()` was already required to build examples and tests.

Closes #2326
2026-07-16 03:55:53 +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
7391a24286 tidy-up: misc typos, syntax nits, formatting
- crypto.h: make `ssh2_prepare_iovec()` no-op macro safe.
- docs/Makefile.am: fix typo in variable name.
- GHA: sync order.
- HACKING-CRYPTO.md: fix typos, improve Markdown.
- kex: drop redundant parentheses.
- man2help: drop single-instruction `{}` blocks, flatten `if()` trees.
- mbedtls: sync function and variable names with sibling function in
  `mbed_mpi_write_binary()` -> `mbed_write_bn()`.
- mbedtls.h: whitespace.
- openssl: rename outlier result variable name with rest of code.
- os400qc3: add FIXME about always false condition in `pkcs1topkcs8()`.
- os400qc3: drop duplicate condition in `ssh2_dh_key_pair()`.
- misc typos in comments, documentation, whitespace fixes.

Closes #2287
2026-07-14 00:58:30 +02:00
Viktor Szakats
db065d2598 HACKING-CRYPTO: move from docs to src, markdownify, update
To make it easier to keep it in sync with the internals, by being in
scope when grepping src.

Also:
- re-sync for some missed src updates.
- update hash/hmac sections.
- markdownify.

Closes #2268
2026-07-10 16:23:00 +02:00
Viktor Szakats
b7fb963882 tidy-up: miscellaneous
- chacha: link to upstream source.
- fix comment typos and minor source nits.

Closes #2138
2026-06-30 00:12:47 +02:00
Viktor Szakats
4bb40bc6d7 tidy-up: comments
Fix typos/wording/consistency.

Some spotted by Github Code Quality.

Closes #2084
2026-06-20 14:25:59 +02:00
Viktor Szakats
3ccef40177 readme.vms: fix typos (cont.) [ci skip] 2026-06-16 03:59:43 +02:00
Viktor Szakats
622dfa06a1 readme.vms: fix typos [ci skip]
Spotted by Github Code Quality
2026-06-16 03:53:29 +02:00
Viktor Szakats
a25f69ef03 tidy-up: miscellaneous
- INSTALL-AUTOTOOLS.md, INSTALL-CMAKE.md: drop indent from list.
- agent: drop redundant parentheses.
- pem: unfold lines.
- transport: fix indent of continued line.
- wincng: explain/clarify `EC_MAX_POINT_LEN` macro.
- wincng: extend comment scope to two struct members.
- openssh_fixture: move `%` out of `LIBSSH2_SOCKET_MASK` macro.
- fix comment typos.

Closes #2069
2026-06-16 03:47:52 +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
99803822cb tidy-up: miscellaneous
- fix typos in comments and documentation.
- fix references to non-existing functions in comments.
- libssh2_session_free: fix see-also reference on man page.
- libssh2_scp_recv2: fix typo in prototype on man page.
- man2help: use increment operator.
- badwords: extend with new words and an exclusion.
- userauth: unfold string.
- clang-format and manual formatting.

Closes #1988
2026-06-05 18:12:37 +02:00
Viktor Szakats
2fe2e9afeb vms: bump an URL to HTTPS 2026-06-01 15:25:12 +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
af698be45d vms/man2help: rename some variables for readability
Spotted by GitHub Code Quality
2026-05-01 22:16:08 +02:00
Viktor Szakats
429900e685 man2help: tidy-ups, clang-format, use memcpy
Closes #1905
2026-04-30 14:19:24 +02:00
Viktor Szakats
295a2661cf man2help: misc fixes
- check allocation success.
- fix potential memory leaks.
- fix potential file handle leak.
- replace banned `strcpy` with `memcpy`.
- translate varname to English.
- replace typedef struct.
- formatting.

Note this wasn't compile/build-tested.

Partly spotted by GitHub Code Quality and Copilot

Closes #1904
2026-04-30 13:40:29 +02:00
Viktor Szakats
b599ff5ed6 man2help: make functions static 2026-04-30 12:46:15 +02:00
Viktor Szakats
aa45503a82 man2help: add missing void return type to prototype
Spotted by GitHub Code Quality
2026-04-30 12:44:29 +02:00
Viktor Szakats
3ec2920b96 vms: misc fixes in man2help.c
- fix to free the correct pointers in `convertman()`.
- declare `main()` to return `int`.
- fix typo in comment.
- replace commented code with `#if 0`.

Spotted by GitHub Code Quality

Closes #1902
2026-04-30 12:40:21 +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
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
557611f92b checksrc: update, update local config, fix toctou in examples
Closes #1719
2025-10-14 03:29:05 +02:00
Viktor Szakats
4f9e6e0bfb REUSE: add copyright headers to more files, and .gitignore updates
Also:
- rename a spellcheck file to match curl.
- editorconfig: fix line width.
- editorconfig: make it use UTF-8.
- editroconfig: apply some rules to all files.
- .gitignore: drop dupe, drop `.DS_Store` (not created by this repo),
   sort.
- .gitignore: add for tests executables.

Closes #1718
2025-10-13 13:35:25 +02:00
Viktor Szakats
1117b677a0 checksrc: update, check all sources, fix fallouts
update from curl:
cff75acfec/scripts/checksrc.pl

Closes #1457
2024-09-28 11:41:52 +02:00
Viktor Szakats
a9a79e7a41 readme.vms: fix typo [ci skip]
Detected by codespell 2.2.6
2023-10-03 13:46:22 +00:00
Viktor Szakats
6e3e883994 drop www. from www.libssh2.org
<https://www.libssh2.org/*> is now a 301 permanent redirect to
<https://libssh2.org/*>.

Update all references to point directly to the new destination.

Ref: ccf4a7de7f

Closes #1172
2023-08-18 11:20:58 +00:00
Viktor Szakats
fc003d4dc3 tidy-up: formatting nits
Whitespace and redundant parenthesis in `return`s.

Closes #1029
2023-05-04 20:16:28 +00:00
Viktor Szakats
6c6bf4e5c0 vms: fix to include sys/socket.h
Due to a typo in the `HAVE_*` macro, this header was never included.

A comment suggests that `socklen_t` is not defined on VMS and defines it
manually. This symbol is usually in `sys/socket.h`, so the typo may have
been the reason for it to be missing.

Closes #1007
2023-04-26 16:46:27 +00:00
Viktor Szakats
0924632fa0 tidy-up: misc & minor cmake MSVS fix
- `libssh2.rc`: document language/codepage codes.

  Ref: https://learn.microsoft.com/windows/win32/intl/code-page-identifiers

- convert to Markdown: `docs/BINDINGS`, `docs/HACKING`

  Blind update for `vms/libssh2_make_help.dcl`. Please double-check.

- cmake: fix to recognize dash-style warning options (`-Wn`) with MSVC.

- `NMakefile`: sync `rd` command with `Makefile.mk`.

- delete a CVS header.

- cmake: simplify a `LIBSSH2_HAVE_ZLIB` macro.

- few other nits and whitespace mods.

Closes #943
2023-04-10 23:03:43 +00:00
Viktor Szakats
cab599120c delete redundant HAVE_STDLIB_H
libssh2 used this standard C89 header unconditionally before this patch.

Delete the feature checks and all unnecessary header guards.

Closes #913
2023-04-01 23:41:07 +00:00
Viktor Szakats
1d9af00609 tidy-up: fix typos (#886)
detected by codespell 2.2.4.
2023-03-27 19:26:58 +02:00
Viktor Szakats
2f16d8105c tidy-up: replace tabs and other whitespace (#885)
There are a few non-whitespace changes, see them here:
https://github.com/libssh2/libssh2/pull/885/files?w=1
2023-03-27 18:28:27 +02:00
Viktor Szakats
38177f18dd delete old gex (SSH2_MSG_KEX_DH_GEX_REQUEST_OLD) build option (#872)
libssh2 supports an "old" style KEX message
`SSH2_MSG_KEX_DH_GEX_REQUEST_OLD`, as an off-by-default build option.

OpenSSH deprecated/disabled this feature in v6.9 (2015-07-01):
https://www.openssh.com/releasenotes.html#6.9

This patch deletes this obsolete feature from libssh2, with no option
to enable it.

Added to libssh2 in: cf8ca63ea0 (2004-12-31)
RFC: https://datatracker.ietf.org/doc/html/rfc4419 (2006-03)
2023-03-27 11:28:51 +02:00
Viktor Szakats
4cdf785cd3 snprintf: unify fallback logic
Before this patch, the `snprintf()` fallback logic for envs not
supporting this function (i.e. Visual Studio 2013 and older) varied
depending on build tool, and used different techniques in examples,
tests and libssh2 itself.

This patch aims to apply a common logic to libssh2 and examples/tests.

- libssh2: use local `snprintf()` fallback with all build tools.

  We already had a local implementation, but only with CMake. Move that
  to the library as `_libssh2_snprintf()`, and map `snprintf()` to it
  when `HAVE_SNPRINTF` is not set.

  Also change the length type from `int` to `size_t`, and fix
  formatting.

- set or detect `HAVE_SNPRINTF` in non-CMake builds.

  Detect in autotools. Keep existing logic in `win32/libssh2_config.h`.
  Always set for OS/400, NetWare and VMS, keeping existing behaviour.
  (OS/400 builds use a different local implementation)

- examples/tests: drop the CMake-specific fallback logic and map
  `snprintf()` to `_snprintf()` for old MSVC versions, like we did
  before with other build tools. This is unsafe, but should be fine for
  these uses.

- `win32/libssh2_config.h`: make it easier to read.

Closes #812
2023-03-07 14:08:12 +00:00
Will Cosgrove
635caa9078 updated docs for 1.10.0 release 2021-08-29 22:36:43 +02:00
Craig A. Berry
e6278aa2a6 Tweak VMS help file building.
Primarily this is handling cases where top-level files moved into
the docs/ directory.  I also corrected a typo and removed the
claim that libssh2 is public domain.
2016-03-15 21:58:26 +00:00
Craig A. Berry
a239e637c9 Build with standard stat structure on VMS.
This gets us large file support, is available on any VMS release
in the last decade and more, and gives stat other modern features
such as 64-bit ino_t.
2016-03-15 21:57:45 +00:00
Craig A. Berry
8a903d1083 Update vms/libssh2_config.h.
VMS does have stdlib.h, gettimeofday(), and OpenSSL.  The latter
is appropriate to hard-wire in the configuration because it's
installed by default as part of the base operating system and
there is currently no libgcrypt port.
2016-03-15 21:57:13 +00:00
Viktor Szakats
433c327ee2 url updates, HTTP => HTTPS
Closes #87
2016-02-24 23:44:13 +01:00
Daniel Stenberg
6d553a7bb9 web: the site is now HTTPS 2016-02-23 08:52:47 +01:00