From 9538c99fc430455b87e58acc34fcc6d3e3593c6c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sun, 31 May 2026 22:20:58 +0200 Subject: [PATCH] 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 --- .github/SECURITY.md | 2 +- .github/stale.yml | 4 +- CMakeLists.txt | 2 +- Makefile.am | 3 + RELEASE-NOTES | 6 +- REUSE.toml | 4 +- acinclude.m4 | 34 +- cmake/CheckFunctionExistsMayNeedLibrary.cmake | 4 +- cmake/CheckNonblockingSocketSupport.cmake | 2 +- cmake/PickyWarnings.cmake | 6 +- configure.ac | 2 +- docs/HACKING-CRYPTO | 12 +- docs/INSTALL-AUTOTOOLS.md | 18 +- docs/INSTALL-CMAKE.md | 12 +- docs/Makefile.am | 4 +- docs/SECURITY.md | 20 +- docs/TODO.md | 16 +- docs/libssh2_agent_userauth.md | 2 +- docs/libssh2_banner_set.md | 4 +- docs/libssh2_base64_decode.md | 5 +- docs/libssh2_channel_close.md | 2 +- docs/libssh2_channel_forward_listen_ex.md | 6 +- docs/libssh2_channel_free.md | 2 +- docs/libssh2_channel_get_exit_signal.md | 8 +- docs/libssh2_channel_handle_extended_data.md | 2 +- docs/libssh2_channel_handle_extended_data2.md | 2 +- docs/libssh2_channel_receive_window_adjust.md | 6 +- .../libssh2_channel_receive_window_adjust2.md | 4 +- docs/libssh2_channel_request_auth_agent.md | 4 +- docs/libssh2_channel_send_eof.md | 2 +- docs/libssh2_channel_set_blocking.md | 2 +- docs/libssh2_channel_signal_ex.md | 2 +- docs/libssh2_channel_window_read_ex.md | 4 +- docs/libssh2_channel_window_write_ex.md | 2 +- docs/libssh2_channel_write_ex.md | 2 +- docs/libssh2_channel_x11_req_ex.md | 2 +- docs/libssh2_free.md | 4 +- docs/libssh2_init.md | 2 +- docs/libssh2_keepalive_config.md | 2 +- docs/libssh2_knownhost_add.md | 8 +- docs/libssh2_knownhost_addc.md | 12 +- docs/libssh2_knownhost_check.md | 6 +- docs/libssh2_knownhost_checkp.md | 12 +- docs/libssh2_knownhost_writeline.md | 6 +- docs/libssh2_scp_recv.md | 2 +- docs/libssh2_scp_recv2.md | 2 +- docs/libssh2_scp_send64.md | 4 +- docs/libssh2_scp_send_ex.md | 2 +- docs/libssh2_session_banner_get.md | 4 +- docs/libssh2_session_banner_set.md | 4 +- docs/libssh2_session_callback_set2.md | 4 +- docs/libssh2_session_flag.md | 6 +- docs/libssh2_session_handshake.md | 4 +- docs/libssh2_session_hostkey.md | 4 +- docs/libssh2_session_init_ex.md | 4 +- docs/libssh2_session_last_errno.md | 2 +- docs/libssh2_session_last_error.md | 8 +- docs/libssh2_session_method_pref.md | 2 +- docs/libssh2_session_set_blocking.md | 12 +- docs/libssh2_session_set_last_error.md | 2 +- docs/libssh2_session_set_read_timeout.md | 2 +- docs/libssh2_session_startup.md | 4 +- docs/libssh2_session_supported_algs.md | 16 +- docs/libssh2_sftp_fstat_ex.md | 8 +- docs/libssh2_sftp_fsync.md | 2 +- docs/libssh2_sftp_last_error.md | 2 +- docs/libssh2_sftp_open_ex.md | 4 +- docs/libssh2_sftp_open_ex_r.md | 4 +- docs/libssh2_sftp_posix_rename_ex.md | 8 +- docs/libssh2_sftp_read.md | 2 +- docs/libssh2_sftp_readdir_ex.md | 4 +- docs/libssh2_sftp_rename_ex.md | 2 +- docs/libssh2_sftp_seek64.md | 2 +- docs/libssh2_sftp_stat_ex.md | 11 +- docs/libssh2_sftp_write.md | 12 +- docs/libssh2_trace_sethandler.md | 2 +- docs/libssh2_userauth_banner.md | 6 +- ...ibssh2_userauth_keyboard_interactive_ex.md | 6 +- docs/libssh2_userauth_list.md | 6 +- docs/libssh2_userauth_password_ex.md | 4 +- .../libssh2_userauth_publickey_fromfile_ex.md | 2 +- docs/libssh2_userauth_publickey_frommemory.md | 2 +- docs/libssh2_userauth_publickey_sk.md | 6 +- docs/libssh2_version.md | 6 +- example/direct_tcpip.c | 4 +- example/scp.c | 4 +- example/scp_nonblock.c | 6 +- example/scp_write.c | 4 +- example/scp_write_nonblock.c | 4 +- example/sftp.c | 6 +- example/sftp_RW_nonblock.c | 14 +- example/sftp_append.c | 6 +- example/sftp_mkdir.c | 6 +- example/sftp_mkdir_nonblock.c | 6 +- example/sftp_nonblock.c | 6 +- example/sftp_write.c | 6 +- example/sftp_write_nonblock.c | 6 +- example/sftp_write_sliding.c | 6 +- example/sftpdir.c | 9 +- example/sftpdir_nonblock.c | 9 +- example/ssh2.c | 14 +- example/ssh2_agent.c | 10 +- example/ssh2_agent_forwarding.c | 2 +- example/ssh2_echo.c | 13 +- example/ssh2_exec.c | 4 +- example/subsystem_netconf.c | 6 +- example/tcpip-forward.c | 4 +- include/libssh2.h | 32 +- include/libssh2_sftp.h | 7 +- m4/libssh2-link.m4 | 50 +-- os400/README400 | 12 +- os400/libssh2_config.h | 8 +- os400/libssh2rpg/libssh2.rpgle.in | 22 +- os400/libssh2rpg/libssh2_sftp.rpgle | 6 +- os400/make-rpg.sh | 4 +- os400/rpg-examples/SFTPXMPLE | 4 +- scripts/badwords | 336 ++++++++++++++++++ scripts/badwords-all | 13 + scripts/badwords.txt | 126 +++++++ scripts/cd2nroff | 2 +- scripts/checksrc.pl | 27 +- scripts/cmakelint.sh | 6 +- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/agent.c | 4 +- src/bcrypt_pbkdf.c | 2 +- src/blowfish.c | 6 +- src/channel.c | 75 ++-- src/channel.h | 2 +- src/comp.c | 10 +- src/crypt.c | 8 +- src/crypto.h | 2 +- src/kex.c | 75 ++-- src/knownhost.c | 58 +-- src/libssh2_priv.h | 20 +- src/mac.c | 2 +- src/mbedtls.c | 10 +- src/misc.c | 11 +- src/openssl.c | 8 +- src/openssl.h | 4 +- src/os400qc3.c | 6 +- src/packet.c | 41 +-- src/publickey.c | 4 +- src/scp.c | 24 +- src/session.c | 16 +- src/sftp.c | 120 +++---- src/sftp.h | 8 +- src/transport.c | 74 ++-- src/transport.h | 2 +- src/userauth.c | 44 +-- src/wincng.c | 14 +- tests/CMakeLists.txt | 2 +- tests/openssh_fixture.c | 4 +- tests/ossfuzz/ssh2_client_fuzzer.cc | 6 +- tests/ossfuzz/standaloneengine.cc | 4 +- tests/session_fixture.c | 2 +- tests/test_auth_keyboard_info_request.c | 2 +- tests/test_read.c | 2 +- tests/test_ssh2.c | 6 +- vms/libssh2_config.h | 4 +- vms/libssh2_make_example.dcl | 2 +- vms/libssh2_make_kit.dcl | 4 +- vms/libssh2_make_lib.dcl | 2 +- vms/readme.vms | 36 +- 164 files changed, 1247 insertions(+), 752 deletions(-) create mode 100755 scripts/badwords create mode 100755 scripts/badwords-all create mode 100644 scripts/badwords.txt diff --git a/.github/SECURITY.md b/.github/SECURITY.md index e0b51749..1401456f 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -10,7 +10,7 @@ See [SECURITY.md](https://github.com/libssh2/libssh2/blob/master/docs/SECURITY.m ## Reporting a Vulnerability -If you have found or just suspect a security problem somewhere in libssh2, +If you have found or suspect a security problem somewhere in libssh2, email `libssh2-security@haxx.se` about it. **Do not submit suspected security issues in the public bug tracker!** diff --git a/.github/stale.yml b/.github/stale.yml index e9a15019..7ff6b551 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -6,7 +6,7 @@ daysUntilStale: 120 # Number of days of inactivity before a stale issue is closed daysUntilClose: 30 -# Issues with these labels will never be considered stale +# Issues with these labels are never considered stale exemptLabels: - pinned - security @@ -15,7 +15,7 @@ staleLabel: stale # Comment to post when marking an issue as stale. Set to `false` to disable markComment: > This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you + recent activity. It is closed if no further activity occurs. Thank you for your contributions. # Comment to post when closing a stale issue. Set to `false` to disable closeComment: false diff --git a/CMakeLists.txt b/CMakeLists.txt index 22bf6124..fc267a78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -573,7 +573,7 @@ if(LIBSSH2_BUILD_DOCS) set(_build_docs TRUE) add_subdirectory(docs) else() - message(WARNING "Perl not found. Will not build manuals.") + message(WARNING "Perl not found. Cannot build manuals.") endif() endif() add_feature_info("Docs" _build_docs "build docs") diff --git a/Makefile.am b/Makefile.am index 8d1308e0..9d95e69a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,6 +38,9 @@ OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \ os400/rpg-examples/SFTPXMPLE SCRIPTSFILES = \ + scripts/badwords \ + scripts/badwords-all \ + scripts/badwords.txt \ scripts/cd2nroff \ scripts/checksrc-all.pl \ scripts/checksrc.pl \ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9e9251c4..07aa2716 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -150,7 +150,7 @@ This release includes the following enhancements and bugfixes: - cmake: bump policy_max, add `FATAL_ERROR` for old cmake versions (717c0836 #1510) - cmake: fix cmake warnings (47258265 #1511) - cmake: tidy up `-j` make option in integration tests (389d70bf #1509) -- cmake: build but don't install static lib in certain conditions (5d03b4f9 #1469 #1450) +- cmake: build but do not install static lib in certain conditions (5d03b4f9 #1469 #1450) - cmake: add clang-cl support to PickyWarnings.cmake (bf9bb045 #1480) - cmake: tidy up variables names in PickyWarnings.cmake (ac00f6c4 #1478) - cmake: decorate comments in Find modules (efad5f90 #1477) @@ -286,14 +286,14 @@ This release includes the following enhancements and bugfixes: - knownhost: fix for short hostnames (704299e9 #1500) - knownhost: improve known_hosts parsing and harden _libssh2_base64_encode() (d1c0e14d #1641) - knownhost: handle malformed comments in known_hosts parsing #1628 (aa4c7b5b #1629 #1628) -- libgcrypt: bump weak random to very strong in `_libssh2_dh_key_pair()` (776be9f9 #1929 #149 follow: f7daf318) +- libgcrypt: bump weak random to strong in `_libssh2_dh_key_pair()` (776be9f9 #1929 #149 follow: f7daf318) - libgcrypt: add support for RSA SHA-256/SHA-512 (f4642222 #1600) - libssh2_base64_decode: add deprecation warning (cf3aac1a) - libssh2_poll: add deprecated attribute, drop from no-deprecated builds (94d4a2d1 #1838 #1266 follow: 2b8038e1 follow: b1414503) - libssh2_scp_send, libssh2_scp_send_ex: add deprecation warning (70276045) - libssh2_trace.3: Update prototype (7495084b #1518 #1517) - libssh2.h: merge two `#if` branches (cbdb0a8c #1869 #1793 #1578) -- libssh2.h: _WINDLL being defined doesn't mean libssh2 was built as a DLL (35326015 #1793 #1578) +- libssh2.h: _WINDLL being defined does not mean libssh2 was built as a DLL (35326015 #1793 #1578) - libssh2.h: drop stray bits of Windows CE support (1d464325 #1770) - libssh2.h: typo fixes (780bf13a #1496) - libssh2.h: add note about release versions to `LIBSSH2_VERSION` (83590ac7 #1475 #771 #1473) diff --git a/REUSE.toml b/REUSE.toml index c6cc3b45..af9bba57 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -3,8 +3,8 @@ # SPDX-License-Identifier: BSD-3-Clause # This file describes the licensing and copyright situation for files that -# cannot be annotated directly, for example because of being simply -# uncommentable. Unless this is the case, a file should be annotated directly. +# cannot be annotated directly, for example because of being uncommentable. +# Unless this is the case, a file should be annotated directly. # # This follows the REUSE specification: https://reuse.software/spec-3.2/#reusetoml diff --git a/acinclude.m4 b/acinclude.m4 index 031755d1..9d9f8c48 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -4,7 +4,7 @@ dnl CURL_CPP_P dnl dnl Check if $cpp -P should be used for extract define values due to gcc 5 dnl splitting up strings and defines between line outputs. gcc by default -dnl (without -P) will show TEST EINVAL TEST as +dnl (without -P) shows TEST EINVAL TEST as dnl dnl # 13 "conftest.c" dnl TEST @@ -51,11 +51,11 @@ TEST EINVAL TEST dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT]) dnl ------------------------------------------------- dnl Use the C preprocessor to find out if the given object-style symbol -dnl is defined and get its expansion. This macro will not use default -dnl includes even if no INCLUDES argument is given. This macro will run +dnl is defined and get its expansion. This macro does not use default +dnl includes even if no INCLUDES argument is given. This macro runs dnl silently when invoked with three arguments. If the expansion would -dnl result in a set of double-quoted strings the returned expansion will -dnl actually be a single double-quoted string concatenating all them. +dnl result in a set of double-quoted strings the returned expansion is +dnl actually a single double-quoted string concatenating all them. AC_DEFUN([CURL_CHECK_DEF], [ AC_REQUIRE([CURL_CPP_P]) @@ -199,7 +199,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], clangvlo=`echo $clangver | cut -d . -f2` compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null` if test "$appleclang" = '1' && test "$oldapple" = '0'; then - dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version + dnl Starting with Xcode 7 / clang 3.7, Apple clang does not tell its upstream version if test "$compiler_num" -ge '1700'; then compiler_num='1901' elif test "$compiler_num" -ge '1600'; then compiler_num='1700' elif test "$compiler_num" -ge '1500'; then compiler_num='1600' @@ -256,7 +256,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls]) - # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case + # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used: It makes default case unusable CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits]) if test "x$have_windows_h" != "xyes"; then CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Seen to clash with libtool-generated stub code @@ -275,7 +275,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-conversion]) tmp_CFLAGS="$tmp_CFLAGS -Wno-error=sign-conversion" # FIXME CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow]) - # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs + # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used: We cannot change public structs fi dnl Only clang 3.0 or later @@ -340,7 +340,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], case "$CFLAGS" in *-std=c89*|*-std=c90*|*-std=gnu89*|*-std=gnu90*) if test "$compiler_num" -ge "309"; then - tmp_CFLAGS="$tmp_CFLAGS -Wno-comma" # Just silly + tmp_CFLAGS="$tmp_CFLAGS -Wno-comma" # Silly fi ;; esac @@ -381,7 +381,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], tmp_CFLAGS="-wd279,269,981,1418,1419" if test "$compiler_num" -gt "600"; then - dnl icc 6.0 and older doesn't have the -Wall flag + dnl icc 6.0 and older does not have the -Wall flag tmp_CFLAGS="-Wall $tmp_CFLAGS" fi else dnl $ICC = yes @@ -452,10 +452,10 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter]) - # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs + # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used: We cannot change public structs CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pragmas]) CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls]) - # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case + # CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used: It makes default case unusable CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) fi @@ -551,7 +551,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS], case "$flag" in -I*) dnl Include path, provide a -isystem option for the same dir - dnl to prevent warnings in those dirs. The -isystem was not very + dnl to prevent warnings in those dirs. The -isystem was not dnl reliable on earlier gcc versions. add=`echo $flag | sed 's/^-I/-isystem /g'` tmp_CFLAGS="$tmp_CFLAGS $add" @@ -776,10 +776,10 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [ dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT dnl ------------------------------------------------- dnl This macro ensures that configuration tests done -dnl after this will execute with preprocessor symbol +dnl after this execute with preprocessor symbol dnl _REENTRANT defined. This macro also ensures that dnl the generated config file defines NEED_REENTRANT -dnl and that in turn setup.h will define _REENTRANT. +dnl and that in turn setup.h defines _REENTRANT. dnl Internal macro for CURL_CONFIGURE_REENTRANT. AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [ @@ -795,7 +795,7 @@ _EOF dnl CURL_CONFIGURE_REENTRANT dnl ------------------------------------------------- dnl This first checks if the preprocessor _REENTRANT -dnl symbol is already defined. If it isn't currently +dnl symbol is already defined. If it is not currently dnl defined a set of checks are performed to verify dnl if its definition is required to make visible to dnl the compiler a set of *_r functions. Finally, if @@ -851,7 +851,7 @@ dnl -------------------------- dnl Wrapper around LIBSSH2_HAVE_LINKFLAGS to also check $prefix/lib, if set. dnl dnl autoconf only checks $prefix/lib64 if gcc -print-search-dirs output -dnl includes a directory named lib64. So, to find libraries in $prefix/lib +dnl includes a directory named lib64. To find libraries in $prefix/lib dnl we append -L$prefix/lib to LDFLAGS before checking. dnl dnl For convenience, $4 is expanded if [lib]$1 is found. diff --git a/cmake/CheckFunctionExistsMayNeedLibrary.cmake b/cmake/CheckFunctionExistsMayNeedLibrary.cmake index d97c7738..b1f392a1 100644 --- a/cmake/CheckFunctionExistsMayNeedLibrary.cmake +++ b/cmake/CheckFunctionExistsMayNeedLibrary.cmake @@ -44,10 +44,10 @@ include(CheckLibraryExists) # then, if not found that way, linking in each optional library as well. This # function is similar to autotools AC_SEARCH_LIBS. # -# If the function if found, this will define . +# If the function if found, this defines . # # If the function was only found by linking in an additional library, this -# will define NEED_LIB_LIBX, where LIBX is the one of lib1 to libn that +# defines NEED_LIB_LIBX, where LIBX is the one of lib1 to libn that # makes the function available, in uppercase. # # The following variables may be set before calling this macro to diff --git a/cmake/CheckNonblockingSocketSupport.cmake b/cmake/CheckNonblockingSocketSupport.cmake index f4b80535..960227b4 100644 --- a/cmake/CheckNonblockingSocketSupport.cmake +++ b/cmake/CheckNonblockingSocketSupport.cmake @@ -9,7 +9,7 @@ include(CheckCSourceCompiles) # and XPG3, while the other different ways for different systems (old BSD, # Windows and Amiga). # -# One of the following variables will be set indicating the supported +# One of the following variables are set indicating the supported # method (if any): # HAVE_O_NONBLOCK # HAVE_FIONBIO diff --git a/cmake/PickyWarnings.cmake b/cmake/PickyWarnings.cmake index 8430d53b..073f3245 100644 --- a/cmake/PickyWarnings.cmake +++ b/cmake/PickyWarnings.cmake @@ -98,7 +98,7 @@ if(PICKY_COMPILER) -Wsign-conversion # clang 2.9 gcc 4.3 -Wno-error=sign-conversion # FIXME -Wstrict-prototypes # clang 1.0 gcc 3.3 - # -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case + # -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It makes default case unusable -Wtype-limits # clang 2.7 gcc 4.3 -Wunreachable-code # clang 2.7 gcc 4.1 -Wunused-macros # clang 2.7 gcc 4.1 @@ -266,7 +266,7 @@ if(PICKY_COMPILER) list(APPEND _picky "-wd4774") # 'snprintf': format string expected in argument 3 is not a string literal list(APPEND _picky "-wd4820") # 'A': 'N' bytes padding added after data member 'B' if(MSVC_VERSION GREATER_EQUAL 1900) - list(APPEND _picky "-wd5045") # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified + list(APPEND _picky "-wd5045") # Compiler inserts Spectre mitigation for memory load if /Qspectre switch specified endif() endif() endif() @@ -292,7 +292,7 @@ endif() if(CMAKE_C_STANDARD STREQUAL 90) if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9) OR (CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1)) - list(APPEND _picky "-Wno-comma") # Just silly + list(APPEND _picky "-Wno-comma") # Silly endif() endif() diff --git a/configure.ac b/configure.ac index 0aa4dbe7..2ab1bddd 100644 --- a/configure.ac +++ b/configure.ac @@ -119,7 +119,7 @@ AS_HELP_STRING([--disable-docs],[Disable documentation]), BUILD_DOCS=1 ) if test -z "$PERL" -a "x$BUILD_DOCS" != "x0"; then - AC_MSG_WARN([perl was not found. Will not build documentation.]) + AC_MSG_WARN([perl was not found. Cannot build documentation.]) BUILD_DOCS=0 fi diff --git a/docs/HACKING-CRYPTO b/docs/HACKING-CRYPTO index a63c8331..75d0b4e9 100644 --- a/docs/HACKING-CRYPTO +++ b/docs/HACKING-CRYPTO @@ -114,7 +114,7 @@ int libssh2_hmac_sha1_init(libssh2_hmac_ctx *ctx, const void *key, int keylen); Setup the HMAC computation context ctx for an HMAC-SHA-1 computation using the -keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +keylen-byte key. Is invoked right after libssh2_hmac_ctx_init(). Returns 1 for success and 0 for failure. 3.2) SHA-256 @@ -162,7 +162,7 @@ int libssh2_hmac_sha256_init(libssh2_hmac_ctx *ctx, const void *key, int keylen); Setup the HMAC computation context ctx for an HMAC-256 computation using the -keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +keylen-byte key. Is invoked right after libssh2_hmac_ctx_init(). Returns 1 for success and 0 for failure. 3.3) SHA-384 @@ -246,7 +246,7 @@ int libssh2_hmac_sha512_init(libssh2_hmac_ctx *ctx, const void *key, int keylen); Setup the HMAC computation context ctx for an HMAC-512 computation using the -keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +keylen-byte key. Is invoked right after libssh2_hmac_ctx_init(). Returns 1 for success and 0 for failure. 3.5) MD5 @@ -285,7 +285,7 @@ int libssh2_hmac_md5_init(libssh2_hmac_ctx *ctx, const void *key, int keylen); Setup the HMAC computation context ctx for an HMAC-MD5 computation using the -keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +keylen-byte key. Is invoked right after libssh2_hmac_ctx_init(). Returns 1 for success and 0 for failure. 3.6) RIPEMD-160 @@ -297,7 +297,7 @@ int libssh2_hmac_ripemd160_init(libssh2_hmac_ctx *ctx, const void *key, int keylen); Setup the HMAC computation context ctx for an HMAC-RIPEMD-160 computation using -the keylen-byte key. Is invoked just after libssh2_hmac_ctx_init(). +the keylen-byte key. Is invoked right after libssh2_hmac_ctx_init(). Returns 1 for success and 0 for failure. 4) Bidirectional key ciphers. @@ -968,7 +968,7 @@ const char *_libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session, This function is for implementing key hash upgrading as defined in RFC 8332. -Based on the incoming key_method value, this function will return a +Based on the incoming key_method value, this function returns a list of supported algorithms that can upgrade the original key method algorithm as a comma separated list, if there is no upgrade option this function should return NULL. diff --git a/docs/INSTALL-AUTOTOOLS.md b/docs/INSTALL-AUTOTOOLS.md index 566b274f..fccad2cd 100644 --- a/docs/INSTALL-AUTOTOOLS.md +++ b/docs/INSTALL-AUTOTOOLS.md @@ -148,7 +148,7 @@ their locations. ## Specifying the System Type There may be some features `configure` cannot figure out automatically, but -needs to determine by the type of machine the package will run on. Usually, +needs to determine by the type of machine the package runs on. Usually, assuming the package is built to be run on the _same_ architectures, `configure` can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE` option. TYPE can either be @@ -170,12 +170,12 @@ See the file `config.sub` for the possible values of each field. If to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the -option `--target=TYPE` to select the type of system they will produce code +option `--target=TYPE` to select the type of system they produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform -(i.e., that on which the generated programs will eventually be run) with +(i.e., that on which the generated programs eventually runs) with `--host=TYPE`. ## Sharing Defaults @@ -236,7 +236,7 @@ configuration-related scripts to be executed by `/bin/bash`. * `--quiet`, `--silent`, `-q` Do not print messages saying which checks are being made. To suppress all - normal output, redirect it to `/dev/null` (any error messages will still be + normal output, redirect it to `/dev/null` (any error messages are still shown). * `--srcdir=DIR` @@ -258,7 +258,7 @@ Some `./configure` options deserve additional comments: libssh2 can use the [Libgcrypt](https://www.gnupg.org/) library for cryptographic operations. One of the cryptographic libraries is required. - Configure will attempt to locate Libgcrypt automatically. + Configure attempts to locate Libgcrypt automatically. If your installation of Libgcrypt is in another location, specify it using `--with-libgcrypt-prefix`. @@ -270,7 +270,7 @@ Some `./configure` options deserve additional comments: libssh2 can use the [OpenSSL library](https://www.openssl-library.org/) for cryptographic operations. One of the cryptographic libraries is required. - Configure will attempt to locate OpenSSL in the default location. + Configure attempts to locate OpenSSL in the default location. If your installation of OpenSSL is in another location, specify it using `--with-libssl-prefix`. @@ -283,7 +283,7 @@ Some `./configure` options deserve additional comments: [mbedTLS library](https://www.trustedfirmware.org/projects/mbed-tls/) for cryptographic operations. One of the cryptographic libraries is required. - Configure will attempt to locate mbedTLS in the default location. + Configure attempts to locate mbedTLS in the default location. If your installation of mbedTLS is in another location, specify it using `--with-libmbedcrypto-prefix`. @@ -292,7 +292,7 @@ Some `./configure` options deserve additional comments: * `--without-libz` * `--with-libz-prefix=[DIR]` - If present, libssh2 will attempt to use the [zlib](https://zlib.net/) for + If present, libssh2 attempts to use the [zlib](https://zlib.net/) for payload compression, however zlib is not required. If your installation of Libz is in another location, specify it using @@ -300,5 +300,5 @@ Some `./configure` options deserve additional comments: * `--enable-debug` - Will make the build use more pedantic and strict compiler options as well + Makes the build use more pedantic and strict compiler options as well as enable the `libssh2_trace()` function (for showing debug traces). diff --git a/docs/INSTALL-CMAKE.md b/docs/INSTALL-CMAKE.md index aa11df1a..d23a4b9d 100644 --- a/docs/INSTALL-CMAKE.md +++ b/docs/INSTALL-CMAKE.md @@ -31,8 +31,8 @@ cmake -B bld cmake --build bld ``` -libssh2 will be built as a static library and will use any cryptography -library available. The library binary will be put in `bld/src`, with the +libssh2 is built as a static library and uses any cryptography library +available. The library binary is put in `bld/src`, with the examples in `bld/example` and the tests in `bld/tests`. ## Customising the build @@ -69,7 +69,7 @@ The following options are available: [`mbedTLS`](https://www.trustedfirmware.org/projects/mbed-tls/) or blank to use any library available. - CMake will attempt to locate the libraries automatically. For more + CMake attempts to locate the libraries automatically. For more information, visit: @@ -140,7 +140,7 @@ project. ## How can I use libssh2 in my project if it also uses CMake? If your own project also uses CMake, you do not need to worry about setting it -up with libssh2's location. Add the following lines and CMake will find +up with libssh2's location. Add the following lines and CMake finds libssh2 on your system, set up the necessary paths and link the library with your binary. @@ -151,9 +151,9 @@ target_link_libraries(my_project_target libssh2::libssh2) You still have to make libssh2 available on your system first. You can install it in the traditional way shown above, but you do not have to. Instead you can -build it, which will export its location to the user +build it, which exports its location to the user [package registry](https://cmake.org/cmake/help/v3.18/manual/cmake-packages.7.html#package-registry) -where `find_package` will find it. +where `find_package` finds it. You can even combine the two steps using a so-called ['superbuild' project](https://www.kitware.com/main/wp-content/uploads/2016/01/kitware_quarterly1009.pdf) diff --git a/docs/Makefile.am b/docs/Makefile.am index 6e3b2ee9..8aeefc04 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -7,7 +7,7 @@ if BUILD_DOCS # Get man_MANS variable include Makefile.inc -MANPAGES = $(man_MANS:.3=.md) +MAN_PAGESS = $(man_MANS:.3=.md) CLEANFILES = $(man_MANS) SUFFIXES = .3 .md @@ -16,6 +16,6 @@ SUFFIXES = .3 .md endif -EXTRA_DIST = $(MANPAGES) template.md AUTHORS BINDINGS.md HACKING.md \ +EXTRA_DIST = $(MAN_PAGESS) template.md AUTHORS BINDINGS.md HACKING.md \ HACKING-CRYPTO INSTALL-AUTOTOOLS.md INSTALL-CMAKE.md REQUIREMENTS.md \ SECURITY.md TODO.md CMakeLists.txt diff --git a/docs/SECURITY.md b/docs/SECURITY.md index f9db440b..874e2eba 100644 --- a/docs/SECURITY.md +++ b/docs/SECURITY.md @@ -11,7 +11,7 @@ should be handled in the libssh2 project. ## Publishing Information -All known and public libssh2 vulnerabilities will be listed on [the libssh2 +All known and public libssh2 vulnerabilities are listed on [the libssh2 web site](https://libssh2.org/). Security vulnerabilities should not be entered in the project's public bug @@ -24,7 +24,7 @@ The typical process for handling a new security vulnerability is as follows. No information should be made public about a vulnerability until it is formally announced at the end of this process. That means, for example that a -bug tracker entry must NOT be created to track the issue since that will make +bug tracker entry must NOT be created to track the issue since that makes the issue public and it should not be discussed on the project's public mailing list. Also messages associated with any commits should not make any reference to the security nature of the commit if done prior to the public @@ -38,7 +38,7 @@ announcement. security vulnerability in libssh2 are ignored and no further action is required. -- A person in the security team sends an e-mail to the original reporter to +- A person in the security team sends an email to the original reporter to acknowledge the report. - The security team investigates the report and either rejects it or accepts @@ -67,7 +67,7 @@ announcement. [distros@openwall](https://oss-security.openwall.org/wiki/mailing-lists/distros) when also informing and preparing them for the upcoming public security vulnerability announcement - attach the advisory draft for information. Note - that 'distros' will not accept an embargo longer than 14 days. + that 'distros' do not accept an embargo longer than 14 days. - Update the "security advisory" with the CVE number. @@ -86,7 +86,7 @@ announcement. the same manner we always announce releases. It gets sent to the libssh2 mailing list and the oss-security mailing list. -- The security web page on the web site should get the new vulnerability +- The security webpage on the web site should get the new vulnerability mentioned. # Not security issues @@ -140,14 +140,14 @@ security issues. # LIBSSH2-SECURITY (at haxx dot se) Who is on this list? There are a couple of criteria you must meet, and then we -might ask you to join the list or you can ask to join it. It really is not very -formal. We basically only require that you have a long-term presence in the -libssh2 project and you have shown an understanding for the project and its way -of working. You must have been around for a good while and you should have no +might ask you to join the list or you can ask to join it. It really is not +formal. We only require that you have a long-term presence in the libssh2 +project and you have shown an understanding for the project and its way of +working. You must have been around for a good while and you should have no plans in vanishing in the near future. We do not make the list of participants public mostly because it tends to vary -somewhat over time and a list somewhere will only risk getting outdated. +somewhat over time and a list somewhere only risks getting outdated. # GitHub Private Vulnerability Reporting diff --git a/docs/TODO.md b/docs/TODO.md index 99d666be..5315aeae 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-3-Clause does not then use as much memory as today. Possibly by an app-controllable "Window mode"? -* Decrease the number of mallocs. Everywhere. Will get easier once the +* Decrease the number of mallocs. Everywhere. It gets easier once the buffering improvements have been done. * Use `SO_NOSIGPIPE` for macOS/BSD systems where `MSG_NOSIGNAL` does not @@ -109,7 +109,7 @@ slow. (The original API had the `libssh2_poll_channel_read()` and much the same problems plus a few others.) Traffic in the other direction is similarly limited: the app has to try -sending to all channels, even though some of them may very well not accept any +sending to all channels, even though some of them may well not accept any data at that point. A SOLUTION @@ -119,15 +119,15 @@ I suggest we introduce two new helper functions: - `libssh2_transport_read()` Read "a bunch" of data from the given socket and returns information to the - app about what channels that are now readable (ie they will not block when - read from). The function can be called over and over and it will repeatedly - return info about what channels that are readable at that moment. + app about what channels that are now readable (i.e. they do not block when + read from). The function can be called over and over and it repeatedly + returns info about what channels that are readable at that moment. - `libssh2_transport_write()` Returns information about what channels that are writable, in the sense that they have windows set from the remote side that allows data to get - sent. Writing to one of those channels will not block. Of course, the + sent. Writing to one of those channels does not block. Of course, the underlying socket may only accept a certain amount of data, so at the first short return, nothing more should be attempted to get sent until `select()` (or equivalent) has been used on the master socket again. @@ -139,8 +139,8 @@ out. VOLUNTARY I wanted to mention that these two helper functions would not be mandatory in -any way. They would just be there for those who want them, and existing -programs can remain using the old functions only if they prefer to. +any way. They would be there for those who want them, and existing programs +can remain using the old functions only if they prefer to. ## New SFTP API diff --git a/docs/libssh2_agent_userauth.md b/docs/libssh2_agent_userauth.md index b6b08c2c..f0832d7a 100644 --- a/docs/libssh2_agent_userauth.md +++ b/docs/libssh2_agent_userauth.md @@ -29,7 +29,7 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent, *agent* - ssh-agent handle as returned by libssh2_agent_init(3) -*username* - Remote user name to authenticate as. +*username* - Remote username to authenticate as. *identity* - Public key to authenticate with, as returned by libssh2_agent_get_identity(3) diff --git a/docs/libssh2_banner_set.md b/docs/libssh2_banner_set.md index 364c1d45..89e18af0 100644 --- a/docs/libssh2_banner_set.md +++ b/docs/libssh2_banner_set.md @@ -31,10 +31,10 @@ This function is **DEPRECATED** in 1.4.0. Use the *banner* - A pointer to a user defined banner -Set the banner that will be sent to the remote host when the SSH session is +Set the banner that is sent to the remote host when the SSH session is started with libssh2_session_handshake(3) This is optional; a banner corresponding to the protocol and libssh2 version -will be sent by default. +is sent by default. # RETURN VALUE diff --git a/docs/libssh2_base64_decode.md b/docs/libssh2_base64_decode.md index 997ac03c..18c53aae 100644 --- a/docs/libssh2_base64_decode.md +++ b/docs/libssh2_base64_decode.md @@ -24,12 +24,11 @@ libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest, # DESCRIPTION -This function is deemed DEPRECATED in 1.0 and will be removed from libssh2 +This function is deemed DEPRECATED in 1.0 and is removed from libssh2 in a future version. Do not use it! Decode a base64 chunk and store it into a newly allocated buffer. 'dest_len' -will be set to hold the length of the returned buffer that '*dest' will point -to. +is set to hold the length of the returned buffer that '*dest' points to. The returned buffer is allocated by this function, but it is not clear how to free that memory! diff --git a/docs/libssh2_channel_close.md b/docs/libssh2_channel_close.md index e723a20c..df949739 100644 --- a/docs/libssh2_channel_close.md +++ b/docs/libssh2_channel_close.md @@ -28,7 +28,7 @@ libssh2_channel_close(LIBSSH2_CHANNEL *channel); Close an active data channel. In practice this means sending an SSH_MSG_CLOSE packet to the remote host which serves as instruction that no further data -will be sent to it. The remote host may still send data back until it sends +is sent to it. The remote host may still send data back until it sends its own close message in response. To wait for the remote end to close its connection as well, follow this command with libssh2_channel_wait_closed(3). diff --git a/docs/libssh2_channel_forward_listen_ex.md b/docs/libssh2_channel_forward_listen_ex.md index 8cb39ad0..bfb34976 100644 --- a/docs/libssh2_channel_forward_listen_ex.md +++ b/docs/libssh2_channel_forward_listen_ex.md @@ -29,16 +29,16 @@ libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port); # DESCRIPTION Instruct the remote SSH server to begin listening for inbound TCP/IP -connections. New connections will be queued by the library until accepted by +connections. New connections are queued by the library until accepted by *libssh2_channel_forward_accept(3)*. *session* - instance as returned by libssh2_session_init(). *host* - specific address to bind to on the remote host. Binding to -0.0.0.0 (default when NULL is passed) will bind to all available addresses. +0.0.0.0 (default when NULL is passed) binds to all available addresses. *port* - port to bind to on the remote host. When 0 is passed, the remote -host will select the first available dynamic port. +host selects the first available dynamic port. *bound_port* - Populated with the actual port bound on the remote host. Useful when requesting dynamic port numbers. diff --git a/docs/libssh2_channel_free.md b/docs/libssh2_channel_free.md index d0530802..2459b6af 100644 --- a/docs/libssh2_channel_free.md +++ b/docs/libssh2_channel_free.md @@ -26,7 +26,7 @@ libssh2_channel_free(LIBSSH2_CHANNEL *channel); *channel* - Channel stream to free. Release all resources associated with a channel stream. If the channel has -not yet been closed with libssh2_channel_close(3) it will be called +not yet been closed with libssh2_channel_close(3) it is called automatically so that the remote end may know that it can safely free its own resources. diff --git a/docs/libssh2_channel_get_exit_signal.md b/docs/libssh2_channel_get_exit_signal.md index 35643c3d..6fbb70a9 100644 --- a/docs/libssh2_channel_get_exit_signal.md +++ b/docs/libssh2_channel_get_exit_signal.md @@ -30,23 +30,23 @@ libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel, *exitsignal* - If not NULL, is populated by reference with the exit signal (without leading "SIG"). Note that the string is stored in a newly allocated buffer. If the remote program exited cleanly, the referenced string pointer -will be set to NULL. +is set to NULL. *exitsignal_len* - If not NULL, is populated by reference with the length of exitsignal. *errmsg* - If not NULL, is populated by reference with the error message -(if provided by remote server, if not it will be set to NULL). Note that the +(if provided by remote server, if not it is set to NULL). Note that the string is stored in a newly allocated buffer. *errmsg_len* - If not NULL, is populated by reference with the length of errmsg. *langtag* - If not NULL, is populated by reference with the language tag -(if provided by remote server, if not it will be set to NULL). Note that the +(if provided by remote server, if not it is set to NULL). Note that the string is stored in a newly allocated buffer. *langtag_len* - If not NULL, is populated by reference with the length of langtag. # RETURN VALUE -Numeric error code corresponding to the the Error Code constants. +Numeric error code corresponding to the Error Code constants. diff --git a/docs/libssh2_channel_handle_extended_data.md b/docs/libssh2_channel_handle_extended_data.md index 0562cc70..8ea1e915 100644 --- a/docs/libssh2_channel_handle_extended_data.md +++ b/docs/libssh2_channel_handle_extended_data.md @@ -37,7 +37,7 @@ reading **LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE**: Treat extended data and ordinary data the same. Merge all substreams such that calls to -*libssh2_channel_read(3)* will pull from all substreams on a +*libssh2_channel_read(3)* pulls from all substreams on a first-in/first-out basis. **LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE**: Discard all extended data as it diff --git a/docs/libssh2_channel_handle_extended_data2.md b/docs/libssh2_channel_handle_extended_data2.md index 0018257b..263f6082 100644 --- a/docs/libssh2_channel_handle_extended_data2.md +++ b/docs/libssh2_channel_handle_extended_data2.md @@ -35,7 +35,7 @@ reading **LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE**: Treat extended data and ordinary data the same. Merge all substreams such that calls to libssh2_channel_read(3) -will pull from all substreams on a first-in/first-out basis. +pulls from all substreams on a first-in/first-out basis. **LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE**: Discard all extended data as it arrives. diff --git a/docs/libssh2_channel_receive_window_adjust.md b/docs/libssh2_channel_receive_window_adjust.md index 26fd464b..cc3f2d40 100644 --- a/docs/libssh2_channel_receive_window_adjust.md +++ b/docs/libssh2_channel_receive_window_adjust.md @@ -30,17 +30,17 @@ This function is **DEPRECATED** in 1.1.0. Use the Adjust the receive window for a channel by adjustment bytes. If the amount to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the -adjustment amount will be queued for a later packet. +adjustment amount is queued for a later packet. # RETURN VALUE Returns the new size of the receive window (as understood by remote end). Note that the window value sent over the wire is strictly 32bit, but this API is -made to return a 'long' which may not be 32 bit on all platforms. +made to return a 'long' which may not be 32-bit on all platforms. # ERRORS In 1.0 and earlier, this function returns LIBSSH2_ERROR_EAGAIN for non-blocking channels where it would otherwise block. However, that is a negative number and this function only returns an unsigned value and this then -leads to a very strange value being returned. +leads to a strange value being returned. diff --git a/docs/libssh2_channel_receive_window_adjust2.md b/docs/libssh2_channel_receive_window_adjust2.md index 117e2baa..4bb5895a 100644 --- a/docs/libssh2_channel_receive_window_adjust2.md +++ b/docs/libssh2_channel_receive_window_adjust2.md @@ -28,7 +28,7 @@ libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL * channel, Adjust the receive window for a channel by adjustment bytes. If the amount to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the -adjustment amount will be queued for a later packet. +adjustment amount is queued for a later packet. This function stores the new size of the receive window (as understood by remote end) in the variable 'window' points to. @@ -36,7 +36,7 @@ remote end) in the variable 'window' points to. # RETURN VALUE Return 0 on success and a negative value on error. If used in non-blocking -mode it will return LIBSSH2_ERROR_EAGAIN when it would otherwise block. +mode it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. # ERRORS diff --git a/docs/libssh2_channel_request_auth_agent.md b/docs/libssh2_channel_request_auth_agent.md index 826acda4..3eb143b2 100644 --- a/docs/libssh2_channel_request_auth_agent.md +++ b/docs/libssh2_channel_request_auth_agent.md @@ -26,12 +26,12 @@ libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel); Request that agent forwarding be enabled for this SSH session. This sends the request over this specific channel, which causes the agent listener to be -started on the remote side upon success. This agent listener will then run +started on the remote side upon success. This agent listener is then run for the duration of the SSH session. To use agent forwarding, libssh2_session_callback_set2(3) must first be called to set **LIBSSH2_CALLBACK_AUTHAGENT**. -This callback will be invoked when the remote host opens a connection to the +This callback is invoked when the remote host opens a connection to the local agent. *channel* - Previously opened channel instance such as returned by diff --git a/docs/libssh2_channel_send_eof.md b/docs/libssh2_channel_send_eof.md index db8f409e..8abec891 100644 --- a/docs/libssh2_channel_send_eof.md +++ b/docs/libssh2_channel_send_eof.md @@ -24,7 +24,7 @@ libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel); # DESCRIPTION -Tell the remote host that no further data will be sent on the specified +Tell the remote host that no further data is sent on the specified channel. Processes typically interpret this as a closed stdin descriptor. # RETURN VALUE diff --git a/docs/libssh2_channel_set_blocking.md b/docs/libssh2_channel_set_blocking.md index 05bf1286..6e70afab 100644 --- a/docs/libssh2_channel_set_blocking.md +++ b/docs/libssh2_channel_set_blocking.md @@ -31,7 +31,7 @@ libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking); make it non-blocking. Currently this is a short cut call to libssh2_session_set_blocking(3) -and therefore will affect the session and all channels. +and therefore affects the session and all channels. # RETURN VALUE diff --git a/docs/libssh2_channel_signal_ex.md b/docs/libssh2_channel_signal_ex.md index 1c080772..44efffa6 100644 --- a/docs/libssh2_channel_signal_ex.md +++ b/docs/libssh2_channel_signal_ex.md @@ -27,7 +27,7 @@ libssh2_channel_signal_ex(LIBSSH2_CHANNEL *channel, # DESCRIPTION A signal can be delivered to the remote process/service. Some servers or -systems may not implement signals, in which case they will probably ignore this +systems may not implement signals, in which case they probably ignore this message. *channel* - Previously opened channel instance such as returned by libssh2_channel_open_ex(3). diff --git a/docs/libssh2_channel_window_read_ex.md b/docs/libssh2_channel_window_read_ex.md index c6ffa4c3..659e9b2c 100644 --- a/docs/libssh2_channel_window_read_ex.md +++ b/docs/libssh2_channel_window_read_ex.md @@ -28,8 +28,8 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel, Check the status of the read window. Returns the number of bytes which the remote end may send without overflowing the window limit read_avail (if -passed) will be populated with the number of bytes actually available to be -read window_size_initial (if passed) will be populated with the +passed) is populated with the number of bytes actually available to be +read window_size_initial (if passed) is populated with the window_size_initial as defined by the channel_open request # RETURN VALUE diff --git a/docs/libssh2_channel_window_write_ex.md b/docs/libssh2_channel_window_write_ex.md index fd2c3ebe..e2469189 100644 --- a/docs/libssh2_channel_window_write_ex.md +++ b/docs/libssh2_channel_window_write_ex.md @@ -27,7 +27,7 @@ libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel, Check the status of the write window Returns the number of bytes which may be safely written on the channel without blocking. 'window_size_initial' (if -passed) will be populated with the size of the initial window as defined by +passed) is populated with the size of the initial window as defined by the channel_open request # RETURN VALUE diff --git a/docs/libssh2_channel_write_ex.md b/docs/libssh2_channel_write_ex.md index 2c950d40..b9163589 100644 --- a/docs/libssh2_channel_write_ex.md +++ b/docs/libssh2_channel_write_ex.md @@ -42,7 +42,7 @@ defines a stream ID of 1 to be the stderr substream. *libssh2_channel_write(3)* and *libssh2_channel_write_stderr(3)* are convenience macros for this function. -*libssh2_channel_write_ex(3)* will use as much as possible of the buffer +*libssh2_channel_write_ex(3)* uses as much as possible of the buffer and put it into a single SSH protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function. diff --git a/docs/libssh2_channel_x11_req_ex.md b/docs/libssh2_channel_x11_req_ex.md index 5d550368..6b05136e 100644 --- a/docs/libssh2_channel_x11_req_ex.md +++ b/docs/libssh2_channel_x11_req_ex.md @@ -43,7 +43,7 @@ libssh2_channel_open_ex(3). Request an X11 forwarding on *channel*. To use X11 forwarding, libssh2_session_callback_set2(3) -must first be called to set **LIBSSH2_CALLBACK_X11**. This callback will be +must first be called to set **LIBSSH2_CALLBACK_X11**. This callback is invoked when the remote host accepts the X11 forwarding. # RETURN VALUE diff --git a/docs/libssh2_free.md b/docs/libssh2_free.md index cfb6a034..f7ec68e4 100644 --- a/docs/libssh2_free.md +++ b/docs/libssh2_free.md @@ -25,10 +25,10 @@ libssh2_free(LIBSSH2_SESSION *session, void *ptr); Deallocate memory allocated by earlier call to libssh2 functions. It uses the memory allocation callbacks provided by the application, if any. -Otherwise, this will call free(). +Otherwise, this calls free(). This function is mostly useful under Windows when libssh2 is linked to -one run-time library and the application to another. +one runtime library and the application to another. # AVAILABILITY diff --git a/docs/libssh2_init.md b/docs/libssh2_init.md index 167dbe0f..ae9f2731 100644 --- a/docs/libssh2_init.md +++ b/docs/libssh2_init.md @@ -26,7 +26,7 @@ libssh2_init(int flags); # DESCRIPTION Initialize the libssh2 functions. This typically initialize the -crypto library. It uses a global state, and is not thread safe -- you +crypto library. It uses a global state, and is not thread-safe -- you must make sure this function is not called concurrently. # RETURN VALUE diff --git a/docs/libssh2_keepalive_config.md b/docs/libssh2_keepalive_config.md index b7509475..32859fec 100644 --- a/docs/libssh2_keepalive_config.md +++ b/docs/libssh2_keepalive_config.md @@ -29,7 +29,7 @@ Set how often keepalive messages should be sent. **want_reply** indicates whether the keepalive messages should request a response from the server. **interval** is number of seconds that can pass without any I/O, use 0 (the default) to disable keepalives. To avoid some busy-loop corner-cases, if you -specify an interval of 1 it will be treated as 2. +specify an interval of 1 it is treated as 2. Note that non-blocking applications are responsible for sending the keepalive messages using **libssh2_keepalive_send(3)**. diff --git a/docs/libssh2_knownhost_add.md b/docs/libssh2_knownhost_add.md index c80a9141..3a1a43fe 100644 --- a/docs/libssh2_knownhost_add.md +++ b/docs/libssh2_knownhost_add.md @@ -38,8 +38,8 @@ future release. Adds a known host to the collection of known hosts identified by the 'hosts' handle. -*host* is a pointer the host name in plain text or hashed. If hashed, it -must be provided base64 encoded. The host name can be the IP numerical address +*host* is a pointer the hostname in plain text or hashed. If hashed, it +must be provided base64 encoded. The hostname can be the IP numerical address of the host or the full name. *saltP is a pointer to the salt used for the host hashing, if the host is @@ -52,10 +52,10 @@ The salt has to be provided base64 encoded with a trailing zero byte. argument *typemask* is a bitmask that specifies format and info about the data -passed to this function. Specifically, it details what format the host name is, +passed to this function. Specifically, it details what format the hostname is, what format the key is and what key type it is. -The host name is given as one of the following types: +The hostname is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or LIBSSH2_KNOWNHOST_TYPE_CUSTOM. diff --git a/docs/libssh2_knownhost_addc.md b/docs/libssh2_knownhost_addc.md index 7cea89c1..e6b1f80a 100644 --- a/docs/libssh2_knownhost_addc.md +++ b/docs/libssh2_knownhost_addc.md @@ -33,13 +33,13 @@ libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, Adds a known host to the collection of known hosts identified by the 'hosts' handle. -*host* is a pointer the host name in plain text or hashed. If hashed, it -must be provided base64 encoded. The host name can be the IP numerical address +*host* is a pointer the hostname in plain text or hashed. If hashed, it +must be provided base64 encoded. The hostname can be the IP numerical address of the host or the full name. If you want to add a key for a specific port number for the given host, you -must provide the host name like '[host]:port' with the actual characters '[' -and ']' enclosing the host name and a colon separating the host part from the +must provide the hostname like '[host]:port' with the actual characters '[' +and ']' enclosing the hostname and a colon separating the host part from the port number. For example: "[host.example.com]:222". *salt* is a pointer to the salt used for the host hashing, if the host is @@ -56,10 +56,10 @@ argument *commentlen* is the total size in bytes of the comment pointed to by the *comment* argument *typemask* is a bitmask that specifies format and info about the data -passed to this function. Specifically, it details what format the host name is, +passed to this function. Specifically, it details what format the hostname is, what format the key is and what key type it is. -The host name is given as one of the following types: +The hostname is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or LIBSSH2_KNOWNHOST_TYPE_CUSTOM. diff --git a/docs/libssh2_knownhost_check.md b/docs/libssh2_knownhost_check.md index 52d9f6fb..afba4eca 100644 --- a/docs/libssh2_knownhost_check.md +++ b/docs/libssh2_knownhost_check.md @@ -32,7 +32,7 @@ libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, Checks a host and its associated key against the collection of known hosts, and returns info back about the (partially) matched entry. -*host* is a pointer the host name in plain text. The host name can be the +*host* is a pointer the hostname in plain text. The hostname can be the IP numerical address of the host or the full name. *key* is a pointer to the key for the given host. @@ -41,10 +41,10 @@ IP numerical address of the host or the full name. argument *typemask* is a bitmask that specifies format and info about the data -passed to this function. Specifically, it details what format the host name is, +passed to this function. Specifically, it details what format the hostname is, what format the key is and what key type it is. -The host name is given as one of the following types: +The hostname is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM. The key is encoded using one of the following encodings: diff --git a/docs/libssh2_knownhost_checkp.md b/docs/libssh2_knownhost_checkp.md index bba88fc9..f2ac077f 100644 --- a/docs/libssh2_knownhost_checkp.md +++ b/docs/libssh2_knownhost_checkp.md @@ -32,13 +32,13 @@ libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts, Checks a host and its associated key against the collection of known hosts, and returns info back about the (partially) matched entry. -*host* is a pointer the host name in plain text. The host name can be the +*host* is a pointer the hostname in plain text. The hostname can be the IP numerical address of the host or the full name. *port* is the port number used by the host (or a negative number -to check the generic host). If the port number is given, libssh2 will -check the key for the specific host + port number combination in -addition to the plain host name only check. +to check the generic host). If the port number is given, libssh2 +checks the key for the specific host + port number combination in +addition to the plain hostname only check. *key* is a pointer to the key for the given host. @@ -46,10 +46,10 @@ addition to the plain host name only check. argument *typemask* is a bitmask that specifies format and info about the data -passed to this function. Specifically, it details what format the host name is, +passed to this function. Specifically, it details what format the hostname is, what format the key is and what key type it is. -The host name is given as one of the following types: +The hostname is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM. The key is encoded using one of the following encodings: diff --git a/docs/libssh2_knownhost_writeline.md b/docs/libssh2_knownhost_writeline.md index 361864eb..9c032c39 100644 --- a/docs/libssh2_knownhost_writeline.md +++ b/docs/libssh2_knownhost_writeline.md @@ -38,7 +38,7 @@ the 'type' output format. *buflen* is the size of the *buffer*. See RETURN VALUE about the size. -*outlen* must be a pointer to a size_t variable that will get the output +*outlen* must be a pointer to a size_t variable that gets the output length of the stored data chunk. The number does not included the trailing zero! @@ -52,9 +52,9 @@ Returns a regular libssh2 error code, where negative values are error codes and 0 indicates success. If the provided buffer is deemed too small to fit the data libssh2 wants to -store in it, LIBSSH2_ERROR_BUFFER_TOO_SMALL will be returned. The application +store in it, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned. The application is then advised to call the function again with a larger buffer. The -*outlen* size will then hold the requested size. +*outlen* size then holds the requested size. # AVAILABILITY diff --git a/docs/libssh2_scp_recv.md b/docs/libssh2_scp_recv.md index 3b8b4cf5..1f3131f6 100644 --- a/docs/libssh2_scp_recv.md +++ b/docs/libssh2_scp_recv.md @@ -30,7 +30,7 @@ This function is **DEPRECATED** in 1.7.0. Use the *session* - Session instance as returned by libssh2_session_init_ex(3) *path* - Full path and filename of file to transfer. That is the remote -file name. +filename. *sb* - Populated with remote file's size, mode, mtime, and atime diff --git a/docs/libssh2_scp_recv2.md b/docs/libssh2_scp_recv2.md index d70b45ed..7179372c 100644 --- a/docs/libssh2_scp_recv2.md +++ b/docs/libssh2_scp_recv2.md @@ -27,7 +27,7 @@ libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, struct_stat *sb); *session* - Session instance as returned by libssh2_session_init_ex(3) *path* - Full path and filename of file to transfer. That is the remote -file name. +filename. *sb* - Populated with remote file's size, mode, mtime, and atime diff --git a/docs/libssh2_scp_send64.md b/docs/libssh2_scp_send64.md index e0903cfb..7ffa0d3b 100644 --- a/docs/libssh2_scp_send64.md +++ b/docs/libssh2_scp_send64.md @@ -28,13 +28,13 @@ libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode, *session* - Session instance as returned by libssh2_session_init_ex(3) *path* - Full path and filename of file to transfer to. That is the remote -file name. +filename. *mode* - File access mode to create file with *size* - Size of file being transmitted (Must be known ahead of time). Note that this needs to be passed on as variable type -libssh2_uint64_t. This type is 64 bit on modern operating systems and +libssh2_uint64_t. This type is 64-bit on modern operating systems and compilers. *mtime* - mtime to assign to file being created diff --git a/docs/libssh2_scp_send_ex.md b/docs/libssh2_scp_send_ex.md index 3d0544df..68aaf0f6 100644 --- a/docs/libssh2_scp_send_ex.md +++ b/docs/libssh2_scp_send_ex.md @@ -31,7 +31,7 @@ This function has been deemed deprecated since libssh2 1.2.6. See *session* - Session instance as returned by libssh2_session_init_ex(3) *path* - Full path and filename of file to transfer to. That is the remote -file name. +filename. *mode* - File access mode to create file with diff --git a/docs/libssh2_session_banner_get.md b/docs/libssh2_session_banner_get.md index 44cb8ae8..7df78f26 100644 --- a/docs/libssh2_session_banner_get.md +++ b/docs/libssh2_session_banner_get.md @@ -31,8 +31,8 @@ the banner each server presents. # RETURN VALUE -A pointer to a string or NULL if something failed. The data pointed to will be -allocated and associated to the session handle and will be freed by libssh2 +A pointer to a string or NULL if something failed. The data pointed to is +allocated and associated to the session handle and is freed by libssh2 when *libssh2_session_free(3)* is used. # AVAILABILITY diff --git a/docs/libssh2_session_banner_set.md b/docs/libssh2_session_banner_set.md index f9a2becc..ecad3fd1 100644 --- a/docs/libssh2_session_banner_set.md +++ b/docs/libssh2_session_banner_set.md @@ -30,9 +30,9 @@ libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner); *banner* - A pointer to a zero-terminated string holding the user defined banner -Set the banner that will be sent to the remote host when the SSH session is +Set the banner that is sent to the remote host when the SSH session is started with *libssh2_session_handshake(3)* This is optional; a banner -corresponding to the protocol and libssh2 version will be sent by default. +corresponding to the protocol and libssh2 version is sent by default. # RETURN VALUE diff --git a/docs/libssh2_session_callback_set2.md b/docs/libssh2_session_callback_set2.md index e30222f8..ef35499f 100644 --- a/docs/libssh2_session_callback_set2.md +++ b/docs/libssh2_session_callback_set2.md @@ -53,7 +53,7 @@ Called when a SSH_MSG_DISCONNECT message is received ## LIBSSH2_CALLBACK_MACERROR Called when a mismatched MAC has been detected in the transport layer. If the -function returns 0, the packet will be accepted nonetheless. +function returns 0, the packet is accepted nonetheless. ## LIBSSH2_CALLBACK_X11 @@ -130,7 +130,7 @@ void identities(LIBSSH2_SESSION* session, void *buffer, this differently. For example, one client may pass in an unsigned char ** for this parameter, while another may pass in a pointer to a struct. -Regardless of the type of buffer used, the client will need to send back a list +Regardless of the type of buffer used, the client needs to send back a list of identities in the following format. uint32 buffer length diff --git a/docs/libssh2_session_flag.md b/docs/libssh2_session_flag.md index 4bb6b753..e9f1d473 100644 --- a/docs/libssh2_session_flag.md +++ b/docs/libssh2_session_flag.md @@ -29,13 +29,13 @@ Set options for the created session. *flag* is the option to set, while ## LIBSSH2_FLAG_SIGPIPE -If set, libssh2 will not attempt to block SIGPIPEs but will let them trigger +If set, libssh2 does not attempt to block SIGPIPEs but lets them trigger from the underlying socket layer. ## LIBSSH2_FLAG_COMPRESS -If set - before the connection negotiation is performed - libssh2 will try to -negotiate compression enabling for this connection. By default libssh2 will +If set - before the connection negotiation is performed - libssh2 tries to +negotiate compression enabling for this connection. By default libssh2 does not attempt to use compression. # RETURN VALUE diff --git a/docs/libssh2_session_handshake.md b/docs/libssh2_session_handshake.md index eedd7536..5a849225 100644 --- a/docs/libssh2_session_handshake.md +++ b/docs/libssh2_session_handshake.md @@ -27,8 +27,8 @@ libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t socket); *session* - Session instance as returned by libssh2_session_init_ex(3) *socket* - Connected socket descriptor. Typically a TCP connection -though the protocol allows for any reliable transport and the library will -attempt to use any berkeley socket. +though the protocol allows for any reliable transport and the library +attempts to use any berkeley socket. Begin transport layer protocol negotiation with the connected host. diff --git a/docs/libssh2_session_hostkey.md b/docs/libssh2_session_hostkey.md index 7442ddfc..0126dde7 100644 --- a/docs/libssh2_session_hostkey.md +++ b/docs/libssh2_session_hostkey.md @@ -25,8 +25,8 @@ libssh2_session_hostkey(LIBSSH2_SESSION *session, # DESCRIPTION -Returns a pointer to the current host key, the value *len* points to will -get the length of the key. +Returns a pointer to the current host key, the value *len* points to +gets the length of the key. The value *type* points to the type of hostkey which is one of: LIBSSH2_HOSTKEY_TYPE_RSA, LIBSSH2_HOSTKEY_TYPE_DSS (deprecated), or diff --git a/docs/libssh2_session_init_ex.md b/docs/libssh2_session_init_ex.md index f4e4fbc3..7e889400 100644 --- a/docs/libssh2_session_init_ex.md +++ b/docs/libssh2_session_init_ex.md @@ -43,11 +43,11 @@ Callbacks for implementing a reallocator callback. Pass a value of NULL to use the default system reallocator. *abstract* - Arbitrary pointer to application specific callback data. -This value will be passed to any callback function associated with the named +This value is passed to any callback function associated with the named session instance. Initializes an SSH session object. By default system memory allocators -(malloc(), free(), realloc()) will be used for any dynamically allocated memory +(malloc(), free(), realloc()) are used for any dynamically allocated memory blocks. Alternate memory allocation functions may be specified using the extended version of this API call, and/or optional application specific data may be attached to the session object. diff --git a/docs/libssh2_session_last_errno.md b/docs/libssh2_session_last_errno.md index 34044bb8..d6d6439d 100644 --- a/docs/libssh2_session_last_errno.md +++ b/docs/libssh2_session_last_errno.md @@ -31,4 +31,4 @@ Determine the most recent error condition. # RETURN VALUE -Numeric error code corresponding to the the Error Code constants. +Numeric error code corresponding to the Error Code constants. diff --git a/docs/libssh2_session_last_error.md b/docs/libssh2_session_last_error.md index d83b8acd..b173e2ad 100644 --- a/docs/libssh2_session_last_error.md +++ b/docs/libssh2_session_last_error.md @@ -32,15 +32,15 @@ libssh2_session_last_error(LIBSSH2_SESSION *session, readable form of the most recent error message. *errmsg_len* - If not NULL, is populated by reference with the length -of errmsg. (The string is NUL-terminated, so the length is only useful as +of errmsg. (The string is null-terminated, so the length is only useful as an optimization, to avoid calling strlen.) *want_buf* - If set to a non-zero value, "ownership" of the errmsg -buffer will be given to the calling scope. If necessary, the errmsg buffer -will be duplicated. +buffer is given to the calling scope. If necessary, the errmsg buffer +is duplicated. Determine the most recent error condition and its cause. # RETURN VALUE -Numeric error code corresponding to the the Error Code constants. +Numeric error code corresponding to the Error Code constants. diff --git a/docs/libssh2_session_method_pref.md b/docs/libssh2_session_method_pref.md index aae83958..d84bac21 100644 --- a/docs/libssh2_session_method_pref.md +++ b/docs/libssh2_session_method_pref.md @@ -31,7 +31,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION *session, *prefs* - Coma delimited list of preferred methods to use with the most preferred listed first and the least preferred listed last. -If a method is listed which is not supported by libssh2 it will be +If a method is listed which is not supported by libssh2 it is ignored and not sent to the remote host during protocol negotiation. Set preferred methods to be negotiated. These diff --git a/docs/libssh2_session_set_blocking.md b/docs/libssh2_session_set_blocking.md index 8a436324..8e2343f0 100644 --- a/docs/libssh2_session_set_blocking.md +++ b/docs/libssh2_session_set_blocking.md @@ -28,13 +28,13 @@ libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking); *blocking* - Set to a non-zero value to make the channel block, or zero to make it non-blocking. -Set or clear blocking mode on the selected on the session. This will -instantly affect any channels associated with this session. If a read is +Set or clear blocking mode on the selected on the session. This +instantly affects any channels associated with this session. If a read is performed on a session with no data currently available, a blocking session -will wait for data to arrive and return what it receives. A non-blocking -session will return immediately with an empty buffer. If a write is performed -on a session with no room for more data, a blocking session will wait for -room. A non-blocking session will return immediately without writing +waits for data to arrive and return what it receives. A non-blocking +session returns immediately with an empty buffer. If a write is performed +on a session with no room for more data, a blocking session waits for +room. A non-blocking session returns immediately without writing anything. # RETURN VALUE diff --git a/docs/libssh2_session_set_last_error.md b/docs/libssh2_session_set_last_error.md index c6f4c251..1b329616 100644 --- a/docs/libssh2_session_set_last_error.md +++ b/docs/libssh2_session_set_last_error.md @@ -41,7 +41,7 @@ mechanism. # RETURN VALUE -Numeric error code corresponding to the the Error Code constants. +Numeric error code corresponding to the Error Code constants. # AVAILABILITY diff --git a/docs/libssh2_session_set_read_timeout.md b/docs/libssh2_session_set_read_timeout.md index 365b9e4a..42a30fe9 100644 --- a/docs/libssh2_session_set_read_timeout.md +++ b/docs/libssh2_session_set_read_timeout.md @@ -27,7 +27,7 @@ Set the **timeout** in seconds for how long libssh2 packet read function calls may wait until they consider the situation an error and return LIBSSH2_ERROR_TIMEOUT. -By default or if you set the timeout to zero, the timeout will be set to +By default or if you set the timeout to zero, the timeout is set to 60 seconds. # RETURN VALUE diff --git a/docs/libssh2_session_startup.md b/docs/libssh2_session_startup.md index bbd94b01..2a0da957 100644 --- a/docs/libssh2_session_startup.md +++ b/docs/libssh2_session_startup.md @@ -30,8 +30,8 @@ Starting in libssh2 version 1.2.8 this function is considered deprecated. Use *session* - Session instance as returned by libssh2_session_init_ex(3) *socket* - Connected socket descriptor. Typically a TCP connection -though the protocol allows for any reliable transport and the library will -attempt to use any berkeley socket. +though the protocol allows for any reliable transport and the library +attempts to use any berkeley socket. Begin transport layer protocol negotiation with the connected host. diff --git a/docs/libssh2_session_supported_algs.md b/docs/libssh2_session_supported_algs.md index f50dfdc1..f2bc7ce7 100644 --- a/docs/libssh2_session_supported_algs.md +++ b/docs/libssh2_session_supported_algs.md @@ -27,23 +27,23 @@ libssh2_session_supported_algs(LIBSSH2_SESSION* session, # DESCRIPTION -*session* - An instance of initialized LIBSSH2_SESSION (the function will -use its pointer to the memory allocation function). *method_type* - +*session* - An instance of initialized LIBSSH2_SESSION (the function +uses its pointer to the memory allocation function). *method_type* - Method type. See *libssh2_session_method_pref(3)*. *algs* - Address -of a pointer that will point to an array of returned algorithms +of a pointer that points to an array of returned algorithms Get a list of supported algorithms for the given *method_type*. The method_type parameter is equivalent to method_type in -*libssh2_session_method_pref(3)*. If successful, the function will -allocate the appropriate amount of memory. When not needed anymore, it must be +*libssh2_session_method_pref(3)*. If successful, the function allocates +the appropriate amount of memory. When not needed anymore, it must be deallocated by calling *libssh2_free(3)*. When this function is unsuccessful, this must not be done. In order to get a list of all supported compression algorithms, libssh2_session_flag(session, LIBSSH2_FLAG_COMPRESS, 1) must be called before -calling this function, otherwise only "none" will be returned. +calling this function, otherwise only "none" is returned. -If successful, the function will allocate and fill the array with supported +If successful, the function allocates and fill the array with supported algorithms (the same names as defined in RFC 4253). The array is not NULL terminated. @@ -78,7 +78,7 @@ else { # RETURN VALUE -On success, a number of returned algorithms (i.e a positive number will be +On success, a number of returned algorithms (i.e a positive number is returned). In case of a failure, an error code (a negative number, see below) is returned. 0 should never be returned. diff --git a/docs/libssh2_sftp_fstat_ex.md b/docs/libssh2_sftp_fstat_ex.md index 9dae8f54..175159fc 100644 --- a/docs/libssh2_sftp_fstat_ex.md +++ b/docs/libssh2_sftp_fstat_ex.md @@ -35,7 +35,7 @@ libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle, *attrs* - Pointer to an LIBSSH2_SFTP_ATTRIBUTES structure to set file metadata from or into depending on the value of setstat. -*setstat* - When non-zero, the file's metadata will be updated +*setstat* - When non-zero, the file's metadata is updated with the data found in attrs according to the values of attrs-\>flags and other relevant member attributes. @@ -49,7 +49,7 @@ LIBSSH2_SFTP_ATTRIBUTES is a typedefed struct that is defined as below struct _LIBSSH2_SFTP_ATTRIBUTES { /* If flags & ATTR_* bit is set, then the value in this - * struct will be meaningful Otherwise it should be ignored + * struct is meaningful otherwise it should be ignored */ unsigned long flags; @@ -69,14 +69,14 @@ struct _LIBSSH2_SFTP_ATTRIBUTES { }; ~~~ -You will find a full set of defines and macros to identify flags and +You find a full set of defines and macros to identify flags and permissions on the **libssh2_sftp.h** header file, but some of the most common ones are: To check for specific user permissions, the set of defines are in the pattern LIBSSH2_SFTP_S_I\\ where \ is R, W or X for read, write and executable and \ is USR, GRP and OTH for user, -group and other. So, you check for a user readable file, use the bit +group and other. Thus, you check for a user readable file, use the bit *LIBSSH2_SFTP_S_IRUSR* while you want to see if it is executable for other, you use *LIBSSH2_SFTP_S_IXOTH* and so on. diff --git a/docs/libssh2_sftp_fsync.md b/docs/libssh2_sftp_fsync.md index 0563ca0c..6e933316 100644 --- a/docs/libssh2_sftp_fsync.md +++ b/docs/libssh2_sftp_fsync.md @@ -48,7 +48,7 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se. was received on the socket, or an SFTP operation caused an errorcode to be returned by the server. In particular, this can be returned if the SSH server does not support the fsync operation: the SFTP subcode -*LIBSSH2_FX_OP_UNSUPPORTED* will be returned in this case. +*LIBSSH2_FX_OP_UNSUPPORTED* is returned in this case. # AVAILABILITY diff --git a/docs/libssh2_sftp_last_error.md b/docs/libssh2_sftp_last_error.md index 86ba0dc2..25245c2e 100644 --- a/docs/libssh2_sftp_last_error.md +++ b/docs/libssh2_sftp_last_error.md @@ -29,7 +29,7 @@ libssh2_sftp_last_error(LIBSSH2_SFTP *sftp); Returns the last error code produced by the SFTP layer. Note that this only returns a sensible error code if libssh2 returned LIBSSH2_ERROR_SFTP_PROTOCOL in a previous call. Using **libssh2_sftp_last_error(3)** without a -preceding SFTP protocol error, it will return an unspecified value. +preceding SFTP protocol error, it returns an unspecified value. # RETURN VALUE diff --git a/docs/libssh2_sftp_open_ex.md b/docs/libssh2_sftp_open_ex.md index a3f7a992..d5e84a9c 100644 --- a/docs/libssh2_sftp_open_ex.md +++ b/docs/libssh2_sftp_open_ex.md @@ -51,8 +51,8 @@ Force all writes to append data at the end of the file. ## LIBSSH2_FXF_CREAT, -If this flag is specified, then a new file will be created if one does not -already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be +If this flag is specified, then a new file is created if one does not +already exist (if LIBSSH2_FXF_TRUNC is specified, the new file is truncated to zero length if it previously exists) ## LIBSSH2_FXF_TRUNC diff --git a/docs/libssh2_sftp_open_ex_r.md b/docs/libssh2_sftp_open_ex_r.md index 21bb4c47..0765240a 100644 --- a/docs/libssh2_sftp_open_ex_r.md +++ b/docs/libssh2_sftp_open_ex_r.md @@ -53,8 +53,8 @@ Force all writes to append data at the end of the file. ## LIBSSH2_FXF_CREAT, -If this flag is specified, then a new file will be created if one does not -already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be +If this flag is specified, then a new file is created if one does not +already exist (if LIBSSH2_FXF_TRUNC is specified, the new file is truncated to zero length if it previously exists) ## LIBSSH2_FXF_TRUNC diff --git a/docs/libssh2_sftp_posix_rename_ex.md b/docs/libssh2_sftp_posix_rename_ex.md index 9d1acdc5..cd5e77ea 100644 --- a/docs/libssh2_sftp_posix_rename_ex.md +++ b/docs/libssh2_sftp_posix_rename_ex.md @@ -43,11 +43,11 @@ filesystem entry This function implements the posix-rename@openssh.com extension, which is useful when, for example, moving files across filesystems on a remote server. SSH_FXP_RENAME does not specify a specific implementation, but many servers -will attempt to user hard links when moving files using SSH_FXP_RENAME. +attempt to user hard links when moving files using SSH_FXP_RENAME. -If the server does not support posix-rename@openssh.com, this function will -return LIBSSH2_FX_OP_UNSUPPORTED and you can call libssh2_sftp_rename_ex (3) as -a backup. +If the server does not support posix-rename@openssh.com, this function +returns LIBSSH2_FX_OP_UNSUPPORTED and you can call libssh2_sftp_rename_ex (3) +as a backup. # RETURN VALUE diff --git a/docs/libssh2_sftp_read.md b/docs/libssh2_sftp_read.md index 4190b26f..9ddd367a 100644 --- a/docs/libssh2_sftp_read.md +++ b/docs/libssh2_sftp_read.md @@ -36,7 +36,7 @@ libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle, Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is modelled after the POSIX read(2) function and uses the same calling semantics. libssh2_sftp_read(3) -will attempt to read as much as possible however it may not fill all of buffer +attempts to read as much as possible however it may not fill all of buffer if the file pointer reaches the end or if further reads would cause the socket to block. diff --git a/docs/libssh2_sftp_readdir_ex.md b/docs/libssh2_sftp_readdir_ex.md index 23971c57..ff2497db 100644 --- a/docs/libssh2_sftp_readdir_ex.md +++ b/docs/libssh2_sftp_readdir_ex.md @@ -37,7 +37,7 @@ information for the next entry, if any. *buffer_maxlen* bytes to read data into. *buffer_maxlen* - is the length of buffer in bytes. If the length of the -filename is longer than the space provided by buffer_maxlen it will be +filename is longer than the space provided by buffer_maxlen it is truncated to fit. *longentry* - is a pointer to a pre-allocated buffer of at least @@ -48,7 +48,7 @@ a directory listing command is to display this data). *longentry_maxlen* - is the length of longentry in bytes. If the length of the full directory entry is longer than the space provided by -*longentry_maxlen* it will be truncated to fit. +*longentry_maxlen* it is truncated to fit. *attrs* - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate statbuf style data into. diff --git a/docs/libssh2_sftp_rename_ex.md b/docs/libssh2_sftp_rename_ex.md index a532e015..28ca1352 100644 --- a/docs/libssh2_sftp_rename_ex.md +++ b/docs/libssh2_sftp_rename_ex.md @@ -53,7 +53,7 @@ Rename a filesystem object on the remote filesystem. The semantics of this command typically include the ability to move a filesystem object between folders and/or filesystem mounts. If the LIBSSH2_SFTP_RENAME_OVERWRITE flag is not set and the destfile entry already exists, the operation -will fail. Use of the other two flags indicate a preference (but not a +fails. Use of the other two flags indicate a preference (but not a requirement) for the remote end to perform an atomic rename operation and/or using native system calls when possible. diff --git a/docs/libssh2_sftp_seek64.md b/docs/libssh2_sftp_seek64.md index 0c1232ca..fb05b3c6 100644 --- a/docs/libssh2_sftp_seek64.md +++ b/docs/libssh2_sftp_seek64.md @@ -36,7 +36,7 @@ operation. The localized file pointer is used as a convenience offset during read/write operations. You MUST NOT seek during writing or reading a file with SFTP, as the internals -use outstanding packets and changing the "file position" during transit will +use outstanding packets and changing the "file position" during transit results in badness. # AVAILABILITY diff --git a/docs/libssh2_sftp_stat_ex.md b/docs/libssh2_sftp_stat_ex.md index b63dcedc..c635069e 100644 --- a/docs/libssh2_sftp_stat_ex.md +++ b/docs/libssh2_sftp_stat_ex.md @@ -48,17 +48,16 @@ stat operation to perform: metadata from or into depending on the value of stat_type. Get or Set statbuf type data on a remote filesystem object. When getting -statbuf data, libssh2_sftp_stat(3) -will follow all symlinks, while libssh2_sftp_lstat(3) -will return data about the object encountered, even if that object -happens to be a symlink. +statbuf data, libssh2_sftp_stat(3) follows all symlinks, while +libssh2_sftp_lstat(3) returns data about the object encountered, even if +that object happens to be a symlink. The LIBSSH2_SFTP_ATTRIBUTES struct looks like this: ~~~c struct LIBSSH2_SFTP_ATTRIBUTES { - /* If flags & ATTR_* bit is set, then the value in this struct will be - * meaningful Otherwise it should be ignored + /* If flags & ATTR_* bit is set, then the value in this struct is + * meaningful otherwise it should be ignored */ unsigned long flags; diff --git a/docs/libssh2_sftp_write.md b/docs/libssh2_sftp_write.md index fc478fb9..b3b4c758 100644 --- a/docs/libssh2_sftp_write.md +++ b/docs/libssh2_sftp_write.md @@ -37,7 +37,7 @@ semantics. *count* - Number of bytes from 'buffer' to write. Note that it may not be possible to write all bytes as requested. -*libssh2_sftp_handle(3)* will use as much as possible of the buffer and +*libssh2_sftp_handle(3)* uses as much as possible of the buffer and put it into a single SFTP protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function. @@ -46,24 +46,24 @@ least 32K of data to this function. Starting in libssh2 version 1.2.8, the default behavior of libssh2 is to create several smaller outgoing packets for all data you pass to this function -and it will return a positive number as soon as the first packet is -acknowledged from the server. +and it returns a positive number as soon as the first packet is acknowledged +from the server. This has the effect that sometimes more data has been sent off but is not acked yet when this function returns, and when this function is subsequently called -again to write more data, libssh2 will immediately figure out that the data is +again to write more data, libssh2 immediately figures out that the data is already received remotely. In most normal situation this should not cause any problems, but it should be noted that if you have once called libssh2_sftp_write() with data and it returns short, you MUST still assume that the rest of the data might have been cached so you need to make sure you do not alter that data and think that the version you -have in your next function invoke will be detected or used. +have in your next function invoke is detected or used. The reason for this funny behavior is that SFTP can only send 32K data in each packet and it gets all packets acked individually. This means we cannot use a simple serial approach if we want to reach high performance even on high -latency connections. And we want that. +latency connections, and we want that. # RETURN VALUE diff --git a/docs/libssh2_trace_sethandler.md b/docs/libssh2_trace_sethandler.md index db8a54f5..acc952bd 100644 --- a/docs/libssh2_trace_sethandler.md +++ b/docs/libssh2_trace_sethandler.md @@ -33,7 +33,7 @@ libssh2_trace_sethandler installs a trace output handler for your application. By default, when tracing has been switched on via a call to libssh2_trace(), all output is written to stderr. By calling this method and passing a function pointer that matches the libssh2_trace_handler_func prototype, -libssh2 will call back as it generates trace output. This can be used to +libssh2 calls back as it generates trace output. This can be used to capture the trace output and put it into a log file or diagnostic window. This function has no effect unless libssh2 was built to support this option, and a typical "release build" might not. diff --git a/docs/libssh2_userauth_banner.md b/docs/libssh2_userauth_banner.md index 3ec6d94c..432dea1f 100644 --- a/docs/libssh2_userauth_banner.md +++ b/docs/libssh2_userauth_banner.md @@ -36,7 +36,7 @@ yet been attempted, returns **LIBSSH2_ERROR_MISSING_USERAUTH_BANNER**. # RETURN VALUE -On success returns 0 and an UTF-8 NUL-terminated string is stored in the -*banner*. This string is internally managed by libssh2 and will be -deallocated upon session termination. +On success returns 0 and an UTF-8 null-terminated string is stored in the +*banner*. This string is internally managed by libssh2 and is deallocated +upon session termination. On failure returns **LIBSSH2_ERROR_MISSING_USERAUTH_BANNER**. diff --git a/docs/libssh2_userauth_keyboard_interactive_ex.md b/docs/libssh2_userauth_keyboard_interactive_ex.md index 6d4d37f3..58db9b9f 100644 --- a/docs/libssh2_userauth_keyboard_interactive_ex.md +++ b/docs/libssh2_userauth_keyboard_interactive_ex.md @@ -36,10 +36,10 @@ for. *username_len* - Length of username parameter. *response_callback* - As authentication proceeds, the host issues several -(1 or more) challenges and requires responses. This callback will be called at +(1 or more) challenges and requires responses. This callback is called at this moment. The callback is responsible to obtain responses for the challenges, fill the provided data structure and then return -control. Responses will be sent to the host. String values will be free(3)ed +control. Responses are sent to the host. String values are free(3)ed by the library. The callback prototype must match this: ~~~c @@ -54,7 +54,7 @@ void response(const char *name, Attempts keyboard-interactive (challenge/response) authentication. -Note that many SSH servers will always issue a single "password" challenge, +Note that many SSH servers always issue a single "password" challenge, requesting actual password as response, but it is not required by the protocol, and various authentication schemes, such as smartcard authentication may use keyboard-interactive authentication type too. diff --git a/docs/libssh2_userauth_list.md b/docs/libssh2_userauth_list.md index 4f6b59f7..4419fc9a 100644 --- a/docs/libssh2_userauth_list.md +++ b/docs/libssh2_userauth_list.md @@ -27,16 +27,16 @@ libssh2_userauth_list(LIBSSH2_SESSION *session, *session* - Session instance as returned by libssh2_session_init_ex(3) -*username* - Username which will be used while authenticating. Note that +*username* - Username which is used while authenticating. Note that most server implementations do not permit attempting authentication with different usernames between requests. Therefore this must be the same username -you will use on later userauth calls. +you use on later userauth calls. *username_len* - Length of username parameter. Send a **SSH_USERAUTH_NONE** request to the remote host. Unless the remote host is configured to accept none as a viable authentication scheme -(unlikely), it will return **SSH_USERAUTH_FAILURE** along with a listing of +(unlikely), it returns **SSH_USERAUTH_FAILURE** along with a listing of what authentication schemes it does support. In the unlikely event that none authentication succeeds, this method with return NULL. This case may be distinguished from a failing case by examining diff --git a/docs/libssh2_userauth_password_ex.md b/docs/libssh2_userauth_password_ex.md index 3f590a68..65cdbd84 100644 --- a/docs/libssh2_userauth_password_ex.md +++ b/docs/libssh2_userauth_password_ex.md @@ -44,9 +44,9 @@ libssh2_userauth_password_ex(LIBSSH2_SESSION *session, *password_len* - Length of password parameter. *passwd_change_cb* - If the host accepts authentication but -requests that the password be changed, this callback will be issued. +requests that the password be changed, this callback is issued. If no callback is defined, but server required password change, -authentication will fail. +authentication fails. Attempt basic password authentication. Note that many SSH servers which appear to support ordinary password authentication actually have diff --git a/docs/libssh2_userauth_publickey_fromfile_ex.md b/docs/libssh2_userauth_publickey_fromfile_ex.md index f7da16a8..042ea021 100644 --- a/docs/libssh2_userauth_publickey_fromfile_ex.md +++ b/docs/libssh2_userauth_publickey_fromfile_ex.md @@ -31,7 +31,7 @@ libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session, *session* - Session instance as returned by **libssh2_session_init_ex(3)** -*username* - Pointer to user name to authenticate as. +*username* - Pointer to username to authenticate as. *username_len* - Length of *username*. diff --git a/docs/libssh2_userauth_publickey_frommemory.md b/docs/libssh2_userauth_publickey_frommemory.md index dd113f42..13e0c40d 100644 --- a/docs/libssh2_userauth_publickey_frommemory.md +++ b/docs/libssh2_userauth_publickey_frommemory.md @@ -32,7 +32,7 @@ libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, *session* - Session instance as returned by libssh2_session_init_ex(3) -*username* - Remote user name to authenticate as. +*username* - Remote username to authenticate as. *username_len* - Length of username. diff --git a/docs/libssh2_userauth_publickey_sk.md b/docs/libssh2_userauth_publickey_sk.md index 8c55c388..83a74ac3 100644 --- a/docs/libssh2_userauth_publickey_sk.md +++ b/docs/libssh2_userauth_publickey_sk.md @@ -61,7 +61,7 @@ int name(LIBSSH2_SESSION *session, LIBSSH2_SK_SIG_INFO *sig_info, *username_len* - Length of username parameter. *publickeydata* - Buffer containing the contents of a public key file. If -NULL, the public key will be extracted from the privatekeydata. When using +NULL, the public key is extracted from the privatekeydata. When using certificate authentication, this buffer should contain the public certificate data. @@ -128,14 +128,14 @@ to the callback. *sig_r* - For Ed25519 signatures, this contains the entire signature, as returned directly from the authenticator. For ECDSA signatures, this contains the r component of the signature in a big-endian binary representation. For -both algorithms, use LIBSSH2_ALLOC to allocate memory. It will be freed by the +both algorithms, use LIBSSH2_ALLOC to allocate memory. It is freed by the caller. *sig_r_len* - The length of the sig_r parameter. *sig_s* - For ECDSA signatures, this contains the s component of the signature in a big-endian binary representation. Use LIBSSH2_ALLOC to allocate -memory. It will be freed by the caller. For Ed25519 signatures, set this to +memory. It is freed by the caller. For Ed25519 signatures, set this to NULL. *sig_s_len* - The length of the sig_s parameter. diff --git a/docs/libssh2_version.md b/docs/libssh2_version.md index 7f5d01b7..22ee1c8c 100644 --- a/docs/libssh2_version.md +++ b/docs/libssh2_version.md @@ -24,7 +24,7 @@ libssh2_version(int required_version); If *required_version* is lower than or equal to the version number of the libssh2 in use, the version number of libssh2 is returned as a pointer to a -zero terminated string. +null-terminated string. The *required_version* should be the version number as constructed by the LIBSSH2_VERSION_NUM define in the libssh2.h public header file, which is a 24 @@ -33,7 +33,7 @@ number. # RETURN VALUE -The version number of libssh2 is returned as a pointer to a zero terminated +The version number of libssh2 is returned as a pointer to a null-terminated string or NULL if the *required_version* is not fulfilled. # EXAMPLE @@ -56,4 +56,4 @@ printf(\&"libssh2 version: %s\&", libssh2_version(0)); # AVAILABILITY This function was added in libssh2 1.1, in previous versions there way no way -to extract this info in run-time. +to extract this info in runtime. diff --git a/example/direct_tcpip.c b/example/direct_tcpip.c index 2d830ae7..0b2e84bd 100644 --- a/example/direct_tcpip.c +++ b/example/direct_tcpip.c @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/scp.c b/example/scp.c index 664fd9e2..c06448ec 100644 --- a/example/scp.c +++ b/example/scp.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/scp_nonblock.c b/example/scp_nonblock.c index 01c2315d..db2c844f 100644 --- a/example/scp_nonblock.c +++ b/example/scp_nonblock.c @@ -2,7 +2,7 @@ * * Sample showing how to do SCP transfers in a non-blocking manner. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./scp_nonblock 192.168.0.1 user password /tmp/secrets @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) gettimeofday(&start, NULL); #endif - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -187,7 +187,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/scp_write.c b/example/scp_write.c index e9e054b1..f6956555 100644 --- a/example/scp_write.c +++ b/example/scp_write.c @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/scp_write_nonblock.c b/example/scp_write_nonblock.c index f2262afc..48201f81 100644 --- a/example/scp_write_nonblock.c +++ b/example/scp_write_nonblock.c @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp.c b/example/sftp.c index 1c0befe9..4ee86e60 100644 --- a/example/sftp.c +++ b/example/sftp.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP transfers. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are blocking */ libssh2_session_set_blocking(session, 1); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_RW_nonblock.c b/example/sftp_RW_nonblock.c index f62f5a79..5e044fd5 100644 --- a/example/sftp_RW_nonblock.c +++ b/example/sftp_RW_nonblock.c @@ -2,8 +2,8 @@ * * Sample showing how to do SFTP transfers in a non-blocking manner. * - * It will first download a given source file, store it locally and then - * upload the file again to a given destination file. + * It first downloads a given source file, stores it locally and then + * uploads the file again to a given destination file. * * Using the SFTP server running on 127.0.0.1 * @@ -42,7 +42,7 @@ static const char *username = "username"; static const char *password = "password"; static const char *sftppath = "/tmp/TEST"; /* source path */ static const char *dest = "/tmp/TEST2"; /* destination path */ -static const char *storage = "/tmp/sftp-storage"; /* local file name to store +static const char *storage = "/tmp/sftp-storage"; /* local filename to store the downloaded file in */ static int waitsocket(libssh2_socket_t socket_fd, LIBSSH2_SESSION *session) @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -165,7 +165,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -286,12 +286,12 @@ int main(int argc, char *argv[]) tempstorage = fopen(storage, "rb"); if(!tempstorage) { - /* weird, we cannot read the file we just wrote to... */ + /* weird, we cannot read the file we wrote to... */ fprintf(stderr, "Cannot open %s for reading\n", storage); goto shutdown; } - /* we're done downloading, now reverse the process and upload the + /* we are done downloading, now reverse the process and upload the temporarily stored data to the destination path */ sftp_handle = libssh2_sftp_open(sftp_session, dest, LIBSSH2_FXF_WRITE | diff --git a/example/sftp_append.c b/example/sftp_append.c index f33cb78e..0646d45b 100644 --- a/example/sftp_append.c +++ b/example/sftp_append.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP append of a local file onto a remote one. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_append 192.168.0.1 user password localfile /tmp/remotefile @@ -123,7 +123,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are blocking */ libssh2_session_set_blocking(session, 1); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_mkdir.c b/example/sftp_mkdir.c index 6ee77cef..97688ef6 100644 --- a/example/sftp_mkdir.c +++ b/example/sftp_mkdir.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP mkdir * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_mkdir 192.168.0.1 user password /tmp/sftp_mkdir @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_mkdir_nonblock.c b/example/sftp_mkdir_nonblock.c index 7b865dd8..dd9b0a46 100644 --- a/example/sftp_mkdir_nonblock.c +++ b/example/sftp_mkdir_nonblock.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP non-blocking mkdir. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_mkdir_nonblock 192.168.0.1 user password /tmp/sftp_write_nonblock.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_nonblock.c b/example/sftp_nonblock.c index 05b5cbe3..80195789 100644 --- a/example/sftp_nonblock.c +++ b/example/sftp_nonblock.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP non-blocking transfers. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_nonblock 192.168.0.1 user password /tmp/secrets @@ -174,7 +174,7 @@ int main(int argc, char *argv[]) gettimeofday(&start, NULL); #endif - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -188,7 +188,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_write.c b/example/sftp_write.c index b178195c..258fce19 100644 --- a/example/sftp_write.c +++ b/example/sftp_write.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP write transfers. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_write 192.168.0.1 user password sftp_write.c /tmp/secrets @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are blocking */ libssh2_session_set_blocking(session, 1); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_write_nonblock.c b/example/sftp_write_nonblock.c index d1910a83..503c80a9 100644 --- a/example/sftp_write_nonblock.c +++ b/example/sftp_write_nonblock.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP non-blocking write transfers. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_write_nonblock 192.168.0.1 user password thisfile /tmp/storehere @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftp_write_sliding.c b/example/sftp_write_sliding.c index c95fc3e7..ac3929ca 100644 --- a/example/sftp_write_sliding.c +++ b/example/sftp_write_sliding.c @@ -2,7 +2,7 @@ * * Sample showing how to do SFTP non-blocking write transfers. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./sftp_write_sliding 192.168.0.1 user password thisfile /tmp/storehere @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -184,7 +184,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/example/sftpdir.c b/example/sftpdir.c index 16f65b42..cf10f58c 100644 --- a/example/sftpdir.c +++ b/example/sftpdir.c @@ -2,7 +2,7 @@ * * Sample doing an SFTP directory listing. * - * The sample code has default values for host name, user name, password and + * The sample code has default values for hostname, username, password and * path, but you can specify them on the command line like: * * $ ./sftpdir 192.168.0.1 user password /tmp/secretdir @@ -131,7 +131,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -143,7 +143,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -247,8 +247,7 @@ int main(int argc, char *argv[]) rc = libssh2_sftp_readdir_ex(sftp_handle, mem, sizeof(mem), longentry, sizeof(longentry), &attrs); if(rc > 0) { - /* rc is the length of the file name in the mem - buffer */ + /* rc is the length of the filename in the mem buffer */ if(longentry[0] != '\0') { printf("%s\n", longentry); diff --git a/example/sftpdir_nonblock.c b/example/sftpdir_nonblock.c index a13ee136..1cd5d4ba 100644 --- a/example/sftpdir_nonblock.c +++ b/example/sftpdir_nonblock.c @@ -2,7 +2,7 @@ * * Sample doing an SFTP directory listing. * - * The sample code has default values for host name, user name, password and + * The sample code has default values for hostname, username, password and * path, but you can specify them on the command line like: * * $ ./sftpdir_nonblock 192.168.0.1 user password /tmp/secretdir @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) /* Since we have set non-blocking, tell libssh2 we are non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -192,8 +192,7 @@ int main(int argc, char *argv[]) &attrs)) == LIBSSH2_ERROR_EAGAIN) ; if(rc > 0) { - /* rc is the length of the file name in the mem - buffer */ + /* rc is the length of the filename in the mem buffer */ if(attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) { /* this should check what permissions it diff --git a/example/ssh2.c b/example/ssh2.c index 5be349eb..24eb61bf 100644 --- a/example/ssh2.c +++ b/example/ssh2.c @@ -2,7 +2,7 @@ * * Sample showing how to do SSH2 connect. * - * The sample code has default values for host name, user name, password + * The sample code has default values for hostname, username, password * and path to copy, but you can specify them on the command line like: * * $ ./ssh2 hostip user password [[-p|-i|-k] [command]] @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* Create a session instance and start it up. This will trade welcome + /* Create a session instance and start it up. This trades welcome * banners, exchange keys, and setup crypto, compression, and MAC layers */ session = libssh2_session_init(); @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) } /* Some environment variables may be set, - * It's up to the server which ones it'll allow though + * It is up to the server which ones it allows though */ libssh2_channel_setenv(channel, "FOO", "bar"); @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "Unable to request command on channel\n"); goto shutdown; } - /* Instead of just running a single command with libssh2_channel_exec, + /* Instead of running a single command with libssh2_channel_exec, * a shell can be opened on the channel instead, for interactive use. * You usually want a pty allocated first in that case (see above). */ #if 0 @@ -300,14 +300,14 @@ int main(int argc, char *argv[]) * * Blocking mode may be (en|dis)abled with: * libssh2_channel_set_blocking() - * If the server send EOF, libssh2_channel_eof() will return non-0 + * If the server send EOF, libssh2_channel_eof() returns non-0 * To send EOF to the server use: libssh2_channel_send_eof() * A channel can be closed with: libssh2_channel_close() * A channel can be freed with: libssh2_channel_free() */ /* Read and display all the data received on stdout (ignoring stderr) - * until the channel closes. This will eventually block if the command + * until the channel closes. This eventually blocks if the command * produces too much data on stderr; the loop must be rewritten to use * non-blocking mode and include interspersed calls to * libssh2_channel_read_stderr() to avoid this. See ssh2_echo.c for diff --git a/example/ssh2_agent.c b/example/ssh2_agent.c index e6981433..ab01ea01 100644 --- a/example/ssh2_agent.c +++ b/example/ssh2_agent.c @@ -2,7 +2,7 @@ * * Sample showing how to do SSH2 connect using ssh-agent. * - * The sample code has default values for host name, user name: + * The sample code has default values for hostname, username: * * $ ./ssh2_agent host user * @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) } } - /* We're authenticated now. */ + /* We are authenticated now. */ /* Request a shell */ channel = libssh2_channel_open_session(session); @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) } /* Some environment variables may be set, - * It's up to the server which ones it'll allow though + * It is up to the server which ones it allows though */ libssh2_channel_setenv(channel, "FOO", "bar"); @@ -205,7 +205,7 @@ int main(int argc, char *argv[]) * libssh2_channel_write_stderr() * * Blocking mode may be (en|dis)abled with: libssh2_channel_set_blocking() - * If the server send EOF, libssh2_channel_eof() will return non-0 + * If the server send EOF, libssh2_channel_eof() returns non-0 * To send EOF to the server use: libssh2_channel_send_eof() * A channel can be closed with: libssh2_channel_close() * A channel can be freed with: libssh2_channel_free() diff --git a/example/ssh2_agent_forwarding.c b/example/ssh2_agent_forwarding.c index 0049ebd5..07853229 100644 --- a/example/ssh2_agent_forwarding.c +++ b/example/ssh2_agent_forwarding.c @@ -1,7 +1,7 @@ /* Copyright (C) The libssh2 project and its contributors. * * Sample showing how to use libssh2 to request agent forwarding - * on the remote host. The command executed will run with agent forwarded + * on the remote host. The command executed runs with agent forwarded * so you should be able to do things like clone out protected git * repos and such. * diff --git a/example/ssh2_echo.c b/example/ssh2_echo.c index 7e5f7ef7..40f35cfe 100644 --- a/example/ssh2_echo.c +++ b/example/ssh2_echo.c @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) /* tell libssh2 we want it all done non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == @@ -273,7 +273,7 @@ int main(int argc, char *argv[]) if(n == LIBSSH2_ERROR_EAGAIN) { rereads++; - fprintf(stderr, "will read again\n"); + fprintf(stderr, "read again\n"); } else if(n < 0) { fprintf(stderr, "read failed\n"); @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) if(n == LIBSSH2_ERROR_EAGAIN) { rewrites++; - fprintf(stderr, "will write again\n"); + fprintf(stderr, "write again\n"); } else if(n < 0) { fprintf(stderr, "write failed\n"); @@ -319,7 +319,7 @@ int main(int argc, char *argv[]) rc = libssh2_channel_send_eof(channel); if(rc == LIBSSH2_ERROR_EAGAIN) { - fprintf(stderr, "will send eof again\n"); + fprintf(stderr, "send eof again\n"); } else if(rc < 0) { fprintf(stderr, "send eof failed\n"); @@ -327,7 +327,8 @@ int main(int argc, char *argv[]) } else { fprintf(stderr, "sent eof\n"); - /* we're done writing, stop listening for OUT events */ + /* we are done writing, stop listening for OUT + events */ fds[0].events &= ~(unsigned long)LIBSSH2_POLLFD_POLLOUT; } @@ -335,7 +336,7 @@ int main(int argc, char *argv[]) } if(fds[0].revents & LIBSSH2_POLLFD_CHANNEL_CLOSED) { - if(!act) /* don't leave loop until we have read all data */ + if(!act) /* do not leave loop until we have read all data */ running = 0; } } while(running); diff --git a/example/ssh2_exec.c b/example/ssh2_exec.c index c4191567..5f04f3bc 100644 --- a/example/ssh2_exec.c +++ b/example/ssh2_exec.c @@ -2,7 +2,7 @@ * * Sample showing how to use libssh2 to execute a command remotely. * - * The sample code has fixed values for host name, user name, password + * The sample code has fixed values for hostname, username, password * and command to run. * * $ ./ssh2_exec 127.0.0.1 user password "uptime" @@ -154,7 +154,7 @@ int main(int argc, char *argv[]) /* tell libssh2 we want it all done non-blocking */ libssh2_session_set_blocking(session, 0); - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ while((rc = libssh2_session_handshake(session, sock)) == diff --git a/example/subsystem_netconf.c b/example/subsystem_netconf.c index 1fc2ccb4..db931c70 100644 --- a/example/subsystem_netconf.c +++ b/example/subsystem_netconf.c @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* NETCONF: https://tools.ietf.org/html/draft-ietf-netconf-ssh-06 */ + /* NETCONF: https://datatracker.ietf.org/doc/html/draft-ietf-netconf-ssh-06 */ fprintf(stderr, "Sending NETCONF client \n"); len = snprintf(buf, sizeof(buf), diff --git a/example/tcpip-forward.c b/example/tcpip-forward.c index 303e1f67..e2f5711a 100644 --- a/example/tcpip-forward.c +++ b/example/tcpip-forward.c @@ -135,7 +135,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* ... start it up. This will trade welcome banners, exchange keys, + /* ... start it up. This trades welcome banners, exchange keys, * and setup crypto, compression, and MAC layers */ rc = libssh2_session_handshake(session, sock); @@ -147,7 +147,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); diff --git a/include/libssh2.h b/include/libssh2.h index feb3ca63..8d58d380 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -44,7 +44,7 @@ #define LIBSSH2_COPYRIGHT "The libssh2 project and its contributors." -/* We use underscore instead of dash when appending DEV in dev versions just +/* We use underscore instead of dash when appending DEV in dev versions to make the BANNER define (used by src/session.c) be a valid SSH banner. Release versions have no appended strings and may of course not have dashes either. The release version (without "_DEV") is not stored in @@ -59,8 +59,8 @@ #define LIBSSH2_VERSION_PATCH 1 /* This is the numeric version of the libssh2 version number, meant for easier - parsing and comparisons by programs. The LIBSSH2_VERSION_NUM define will - always follow this syntax: + parsing and comparisons by programs. The LIBSSH2_VERSION_NUM define + always follows this syntax: 0xXXYYZZ @@ -172,7 +172,7 @@ typedef struct _stati64 libssh2_struct_stat; typedef __int64 libssh2_struct_stat_size; #else # ifdef __VMS -/* We have to roll our own format here because %z is a C99-ism we don't +/* We have to roll our own format here because %z is a C99-ism we do not have. */ # if __USE_OFF64_T || __USING_STD_STAT # define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%Ld" @@ -410,7 +410,7 @@ typedef struct _LIBSSH2_POLLFD { #define LIBSSH2_POLLFD_CHANNEL 2 #define LIBSSH2_POLLFD_LISTENER 3 -/* Note: Win32 Doesn't actually have a poll() implementation, so some of these +/* Note: Win32 does not actually have a poll() implementation, so some of these values are faked with select() data */ /* Poll FD events/revents -- Match sys/poll.h where possible */ #define LIBSSH2_POLLFD_POLLIN 0x0001 /* Data available to be read or @@ -547,7 +547,7 @@ typedef struct _LIBSSH2_POLLFD { * libssh2_init() * * Initialize the libssh2 functions. This typically initializes the - * crypto library. It uses a global state, and is not thread safe -- + * crypto library. It uses a global state, and is not thread-safe -- * you must make sure this function is not called concurrently. * * Flags can be: @@ -732,7 +732,7 @@ libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session, /* * response_callback is provided with filled by library prompts array, * but client must allocate and fill individual responses. Responses - * array is already allocated. Responses data will be freed by libssh2 + * array is already allocated. Responses data is freed by libssh2 * after callback return, but before subsequent callback invocation. */ LIBSSH2_API int @@ -958,7 +958,7 @@ LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, * 0.1 * * Future uses should use libssh2_channel_handle_extended_data() directly if - * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read + * LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data is read * (FIFO) from the standard data channel */ /* DEPRECATED since 0.3.0. Use libssh2_channel_handle_extended_data2(). */ @@ -1044,7 +1044,7 @@ libssh2_crypto_engine_t libssh2_crypto_engine(void); struct libssh2_knownhost { unsigned int magic; /* magic stored by the library */ void *node; /* handle to the internal representation of this host */ - char *name; /* this is NULL if no plain text host name exists */ + char *name; /* this is NULL if no plain text hostname exists */ char *key; /* key in base64/printable format */ int typemask; }; @@ -1116,9 +1116,9 @@ libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, * Add a host and its associated key to the collection of known hosts. * * Takes a comment argument that may be NULL. A NULL comment indicates - * there is no comment and the entry will end directly after the key - * when written out to a file. An empty string "" comment will indicate an - * empty comment which will cause a single space to be written after the key. + * there is no comment and the entry ends directly after the key + * when written out to a file. An empty string "" comment indicates an + * empty comment which causes a single space to be written after the key. * * The 'type' argument specifies on what format the given host and keys are: * @@ -1150,13 +1150,13 @@ libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, * * Check a host and its associated key against the collection of known hosts. * - * The type is the type/format of the given host name. + * The type is the type/format of the given hostname. * * plain - ascii "hostname.domain.tld" * custom - prehashed base64 encoded. Note that this cannot use any salts. * * - * 'knownhost' may be set to NULL if you don't care about that info. + * 'knownhost' may be set to NULL if you do not care about that info. * * Returns: * @@ -1413,7 +1413,7 @@ libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent); * from the server. INTERVAL is number of seconds that can pass * without any I/O, use 0 (the default) to disable keepalives. To * avoid some busy-loop corner-cases, if you specify an interval of 1 - * it will be treated as 2. + * it is treated as 2. * * Note that non-blocking applications are responsible for sending the * keepalive messages using libssh2_keepalive_send(). @@ -1434,7 +1434,7 @@ LIBSSH2_API int libssh2_keepalive_send(LIBSSH2_SESSION *session, int *seconds_to_next); /* NOTE NOTE NOTE - libssh2_trace() has no function in builds that aren't built with debug + libssh2_trace() has no function in builds that are not built with debug enabled */ LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION *session, int bitmask); diff --git a/include/libssh2_sftp.h b/include/libssh2_sftp.h index 13448f6e..ab54e896 100644 --- a/include/libssh2_sftp.h +++ b/include/libssh2_sftp.h @@ -96,8 +96,8 @@ typedef struct _LIBSSH2_SFTP_STATVFS LIBSSH2_SFTP_STATVFS; #define LIBSSH2_SFTP_ST_NOSUID 0x00000002 struct _LIBSSH2_SFTP_ATTRIBUTES { - /* If flags & ATTR_* bit is set, then the value in this struct will be - * meaningful Otherwise it should be ignored + /* If flags & ATTR_* bit is set, then the value in this struct is + * meaningful otherwise it should be ignored */ unsigned long flags; @@ -182,7 +182,8 @@ struct _LIBSSH2_SFTP_STATVFS { (((m) & LIBSSH2_SFTP_S_IFMT) == LIBSSH2_SFTP_S_IFSOCK) /* SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open()) - * Danger will robinson... APPEND doesn't have any effect on OpenSSH servers */ + * Danger Will Robinson... APPEND does not have any effect on OpenSSH servers + */ #define LIBSSH2_FXF_READ 0x00000001 #define LIBSSH2_FXF_WRITE 0x00000002 #define LIBSSH2_FXF_APPEND 0x00000004 diff --git a/m4/libssh2-link.m4 b/m4/libssh2-link.m4 index 394414c1..c96e99f5 100644 --- a/m4/libssh2-link.m4 +++ b/m4/libssh2-link.m4 @@ -11,7 +11,7 @@ dnl From Bruno Haible. AC_PREREQ([2.54]) dnl LIBSSH2_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have +dnl variables prefix and exec_prefix bound to the values they have dnl at the end of the configure script. AC_DEFUN([LIBSSH2_WITH_FINAL_PREFIX], [ @@ -26,7 +26,7 @@ AC_DEFUN([LIBSSH2_WITH_FINAL_PREFIX], dnl LIBSSH2_PREPARE_PREFIX creates variables acl_final_prefix, dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. +dnl $exec_prefix expands at the end of the configure script. AC_DEFUN([LIBSSH2_PREPARE_PREFIX], [ dnl Unfortunately, prefix and exec_prefix get only finally determined @@ -154,7 +154,7 @@ AC_DEFUN([LIBSSH2_HAVE_LINKFLAGS], AC_MSG_RESULT([$LIB[]NAME]) else HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl If $LIB[]NAME did not lead to a usable library, we do not need dnl $INC[]NAME either. CPPFLAGS="$ac_save_CPPFLAGS" LIB[]NAME= @@ -223,7 +223,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], ]) AC_ARG_WITH([lib]N_A_M_E[-prefix], [ --with-lib]N_A_M_E[-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib - --without-lib]N_A_M_E[-prefix don't search for lib$1 in includedir and libdir], + --without-lib]N_A_M_E[-prefix do not search for lib$1 in includedir and libdir], [ if test "X$withval" = "Xno"; then use_additional=no @@ -274,7 +274,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" else dnl An earlier call to LIBSSH2_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. + dnl that this library does not exist. So drop it. : fi else @@ -392,7 +392,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the + dnl directory into the executable's runpath, unless it is the dnl standard /usr/lib. if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/$acl_libdirstem"; then dnl No hardcoding is needed. @@ -401,7 +401,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], dnl Use an explicit option to hardcode DIR into the resulting dnl binary. dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + dnl The ltrpathdirs is appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then @@ -423,7 +423,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], dnl binary. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. + dnl The rpathdirs is appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then @@ -436,7 +436,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], fi else dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS + dnl But do not add it if it is already contained in the LDFLAGS dnl or the already constructed $LIBNAME haveit= for x in $LDFLAGS $LIB[]NAME; do @@ -456,9 +456,9 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" else dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the + dnl here, because this does not fit in flags passed to the dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. + dnl old systems. dnl FIXME: Not sure whether we should use dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" dnl here. @@ -472,7 +472,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], dnl Linking with a static library. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" else - dnl We shouldn't come here, but anyway it's good to have a + dnl We should not come here, but anyway it is good to have a dnl fallback. LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" fi @@ -488,12 +488,12 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], esac if test "X$additional_includedir" != "X"; then dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already + dnl But do not add it + dnl 1. if it is the standard /usr/include, + dnl 2. if it is /usr/local/include and we are using GCC on Linux, + dnl 3. if it is already present in $CPPFLAGS or the already dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. + dnl 4. if it does not exist as a directory. if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then @@ -537,12 +537,12 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already + dnl But do not add it + dnl 1. if it is the standard /usr/lib, + dnl 2. if it is /usr/local/lib and we are using GCC on Linux, + dnl 3. if it is already present in $LDFLAGS or the already dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. + dnl 4. if it does not exist as a directory. if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then @@ -588,7 +588,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. + dnl The rpathdirs is appended to $LIBNAME at the end. haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then @@ -600,7 +600,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], rpathdirs="$rpathdirs $dir" fi dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + dnl The ltrpathdirs is appended to $LTLIBNAME at the end. haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then @@ -632,7 +632,7 @@ AC_DEFUN([LIBSSH2_LINKFLAGS_BODY], done fi else - dnl Didn't find the library; assume it is in the system directories + dnl Did not find the library; assume it is in the system directories dnl known to the linker and runtime loader. (All the system dnl directories known to the linker should also be known to the dnl runtime loader, otherwise the system is severely misconfigured.) diff --git a/os400/README400 b/os400/README400 index 86c286a4..1f654165 100644 --- a/os400/README400 +++ b/os400/README400 @@ -21,7 +21,7 @@ Crypto API is provided by the IBM QC3 API library. It supports RSA and EC, but not DSA. Standard compilation environment does support neither autotools nor make; -in fact, very few common utilities are available. As a consequence, the +in fact, few common utilities are available. As a consequence, the libssh2_config.h has been coded manually and the compilation scripts are a set of shell scripts stored in subdirectory os400. @@ -30,7 +30,7 @@ a set of shell scripts stored in subdirectory os400. Compiling on OS/400: These instructions target people who knows about OS/400, compiling, IFS and -archive extraction. Do not ask questions about these subjects if you're not +archive extraction. Do not ask questions about these subjects if you are not familiar with. _ As a prerequisite, QADRT development environment >= 20211112 must be @@ -56,16 +56,16 @@ _ Copy any file in the current directory to makelog (i.e.: _ Enter the command "sh make.sh > makelog 2>&1' _ Examine the makelog file to check for compilation errors. - Without configuration parameters override, this will produce the following + Without configuration parameters override, this produces the following OS/400 objects: -_ Library LIBSSH2. All other objects will be stored in this library. +_ Library LIBSSH2. All other objects are stored in this library. _ Modules for all libssh2 units. _ Binding directory LIBSSH2_A, to be used at calling program link time for statically binding the modules (specify BNDSRVPGM(QADRTTS) when creating a program using LIBSSH2_A. Also give access to the zlib BNDDIR/SRVPGM if libssh2 is compiled with zlib). _ Service program LIBSSH2., where is extracted from the - src/Makefile.am VERSION variable. To be used at calling program run-time + src/Makefile.am VERSION variable. To be used at calling program runtime when this program has dynamically bound libssh2 at link time. _ Binding directory LIBSSH2. To be used to dynamically bind libssh2 when linking a calling program. @@ -132,7 +132,7 @@ where: string is the string to convert. inlen is the source string length in bytes: set to -1 if null-terminated. - outlen if not NULL, is the address of a variable that will receive + outlen if not NULL, is the address of a variable that receives the transcoded string length upon return. libssh2_from_ccsid() transcodes the string from the given CCSID to libssh2 diff --git a/os400/libssh2_config.h b/os400/libssh2_config.h index 6eb18f2e..b1634338 100644 --- a/os400/libssh2_config.h +++ b/os400/libssh2_config.h @@ -140,7 +140,7 @@ _libssh2_os400_snprintf */ #define HAVE_SNPRINTF 1 -/* Define to the sub-directory in which libtool stores uninstalled libraries. +/* Define to the subdirectory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" @@ -169,7 +169,7 @@ #define PACKAGE_VERSION "-" /* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be + direction of stack growth for your system; otherwise it is automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses @@ -195,8 +195,8 @@ /* Define to empty if `const' does not conform to ANSI C. */ #undef const -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ +/* Define to `__inline__' or `__inline' if that is what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #define inline #endif diff --git a/os400/libssh2rpg/libssh2.rpgle.in b/os400/libssh2rpg/libssh2.rpgle.in index 14ef5521..f7326125 100644 --- a/os400/libssh2rpg/libssh2.rpgle.in +++ b/os400/libssh2rpg/libssh2.rpgle.in @@ -44,7 +44,7 @@ d its contributors.' * We use underscore instead of dash when appending DEV in dev versions - * just to make the BANNER define (used by src/session.c) be a valid SSH + * to make the BANNER define (used by src/session.c) be a valid SSH * banner. Release versions have no appended strings and may of course not * have dashes either. d LIBSSH2_VERSION... @@ -61,7 +61,7 @@ * This is the numeric version of the libssh2 version number, meant for * easier parsing and comparisons by programs. The LIBSSH2_VERSION_NUM - * define will always follow this syntax: + * define always follows this syntax: * * X'XXYYZZ' * @@ -560,7 +560,7 @@ * libssh2_init() * * Initialize the libssh2 functions. This typically initialize the - * crypto library. It uses a global state, and is not thread safe -- + * crypto library. It uses a global state, and is not thread-safe -- * you must make sure this function is not called concurrently. * * Flags can be: @@ -872,7 +872,7 @@ * response_callback is provided with filled by library prompts array, * but client must allocate and fill individual responses. Responses - * array is already allocated. Responses data will be freed by libssh2 + * array is already allocated. Responses data is freed by libssh2 * after callback return, but before subsequent callback invocation. d libssh2_userauth_keyboard_interactive_ex... @@ -1566,9 +1566,9 @@ * Add a host and its associated key to the collection of known hosts. * * Takes a comment argument that may be NULL. A NULL comment indicates - * there is no comment and the entry will end directly after the key - * when written out to a file. An empty string "" comment will indicate an - * empty comment which will cause a single space to be written after the + * there is no comment and the entry ends directly after the key + * when written out to a file. An empty string "" comment indicates an + * empty comment which causes a single space to be written after the * key. * * The 'type' argument specifies on what format the given host and keys @@ -1607,13 +1607,13 @@ * Check a host and its associated key against the collection of known * hosts. * - * The type is the type/format of the given host name. + * The type is the type/format of the given hostname. * * plain - ascii "hostname.domain.tld" * custom - prehashed base64 encoded. Note that this cannot use any salts. * * - * 'knownhost' may be set to NULL if you don't care about that info. + * 'knownhost' may be set to NULL if you do not care about that info. * * Returns: * @@ -1897,7 +1897,7 @@ * from the server. INTERVAL is number of seconds that can pass * without any I/O, use 0 (the default) to disable keepalives. To * avoid some busy-loop corner-cases, if you specify an interval of 1 - * it will be treated as 2. + * it is treated as 2. * * Note that non-blocking applications are responsible for sending the * keepalive messages using libssh2_keepalive_send(). @@ -1923,7 +1923,7 @@ d like(libssh2_Cint) * NOTE NOTE NOTE - * libssh2_trace() has no function in builds that aren't built with debug + * libssh2_trace() has no function in builds that are not built with debug * enabled. d libssh2_trace pr extproc('libssh2_trace') diff --git a/os400/libssh2rpg/libssh2_sftp.rpgle b/os400/libssh2rpg/libssh2_sftp.rpgle index 4ccb81b5..b6547d01 100644 --- a/os400/libssh2rpg/libssh2_sftp.rpgle +++ b/os400/libssh2rpg/libssh2_sftp.rpgle @@ -104,8 +104,8 @@ d LIBSSH2_SFTP_ATTRIBUTES... d ds based(######typedef######) d align qualified - * If flags & ATTR_* bit is set, then the value in this struct will be - * meaningful Otherwise it should be ignored. + * If flags & ATTR_* bit is set, then the value in this struct is + * meaningful otherwise it should be ignored. d flags like(libssh2_Culong) d filesize like(libssh2_uint64_t) d uid like(libssh2_Culong) @@ -244,7 +244,7 @@ d permissions value like(libssh2_Culong) * SFTP File Transfer Flags -- (e.g. flags parameter to sftp_open()) - * Danger will robinson... APPEND doesn't have any effect on OpenSSH + * Danger Will Robinson... APPEND does not have any effect on OpenSSH * servers. d LIBSSH2_FXF_READ... d c X'00000001' diff --git a/os400/make-rpg.sh b/os400/make-rpg.sh index ed768a59..297bc3ae 100755 --- a/os400/make-rpg.sh +++ b/os400/make-rpg.sh @@ -19,7 +19,7 @@ then CMD="CRTSRCPF FILE(${TARGETLIB}/LIBSSH2RPG) RCDLEN(112)" system "${CMD}" fi -# Map file names to DB2 name syntax. +# Map filenames to DB2 name syntax. for HFILE in *.rpgle *.rpgle.in do NAME="$(basename "${HFILE}" .in)" @@ -31,7 +31,7 @@ do NAME="$(basename "${HFILE}" .in)" done > tmpsubstfile1 # Order substitution commands so that a prefix appears after all -# file names beginning with the prefix. +# filenames beginning with the prefix. sort -r tmpsubstfile1 | sed 's/^[^ ]*[ ]*//' > tmpsubstfile2 diff --git a/os400/rpg-examples/SFTPXMPLE b/os400/rpg-examples/SFTPXMPLE index 051ddda2..997ebc16 100644 --- a/os400/rpg-examples/SFTPXMPLE +++ b/os400/rpg-examples/SFTPXMPLE @@ -96,7 +96,7 @@ d sin ds likeds(sockaddr_in) Remote IP address d sock s 10i 0 inz(LIBSSH2_INVALID_SOCKET) Socket descriptor d rc s 10i 0 Result code - d hostlen s 10u 0 Host name length + d hostlen s 10u 0 Hostname length * ************************************************************************** * Main program @@ -161,7 +161,7 @@ // Since we have set non-blocking, tell libssh2 we are blocking libssh2_session_set_blocking(session: 1); - // ... start it up. This will trade welcome banners, exchange keys, + // ... start it up. This trades welcome banners, exchange keys, // and setup crypto, compression, and MAC layers rc = libssh2_session_handshake(session: sock); if rc <> 0; diff --git a/scripts/badwords b/scripts/badwords new file mode 100755 index 00000000..f833573a --- /dev/null +++ b/scripts/badwords @@ -0,0 +1,336 @@ +#!/usr/bin/env perl +# Copyright (C) Daniel Stenberg, , et al. +# +# SPDX-License-Identifier: curl +# +# bad[:=]correct +# +# If separator is '=', the string is compared case sensitively. +# If separator is ':', the check is done case insensitively. +# +# To add white listed uses of bad words that are removed before checking for +# the bad ones: +# +# ---(accepted word) +# ---:[path]:(accepted word) +# + +use strict; +use warnings; + +use File::Basename; + +# +## States +# +# 0 - default, initial state +# 1 - there was a slash +# 2 - quoted string +# 3 - // comment +# 4 - /* comment +# 5 - asterisk found within a /* comment +# 6 - #include line +# 7 - backslash in a string +# +## Flags +# +# 1 - include preprocessor line, ignore strings + +sub srcline { + my ($state, $flags, $l) = @_; + my $line = ""; + + if(($state == 0) && ($l =~ /^ *\# *include/)) { + # preprocessor include line + $flags |= 1; + } + else { + # not preprocessor + $flags &= ~1; + } + + if($state == 3) { + # // ended on the prev line, go back to init + $state = 0; + } + + my @c = split(//, $l); + + # state machine this line + for my $c (@c) { + if($state == 1) { + # we had a slash + if($c eq "/") { + # // confirmed, the rest of the line is a comment + $line .= "//"; + $state = 3; + } + elsif($c eq "*") { + # /* confirmed + $state = 4; + $line .= "/*"; + } + else { + # back to normal + $line .= " "; + $state = 0; + } + } + elsif($state == 2) { + # a string + if($c eq "\\") { + $line .= "\\"; + $state = 7; + } + elsif($c eq "\"") { + # end of the string + $line .= "\""; + $state = 0; + } + else { + $line .= $c; + } + } + elsif($state == 3) { + # a // comment + $line .= $c; + } + elsif($state == 4) { + # a /* comment + if($c eq "*") { + # could be a comment close + $state = 5; + } + else { + $line .= $c; + } + } + elsif($state == 5) { + if($c eq "/") { + # a /* */ comment ended here */ + $line .= "*/"; + $state = 0; + } + else { + # the /* comment continues + $line .= "*$c"; + $state = 4; + } + } + elsif($state == 7) { + # the prev was a backslash in a string + $line .= $c; + # switch back to normal string + $state = 2; + } + else { + if($c eq "/") { + $state = 1; # got a slash + } + elsif(($c eq "\"") && !($flags & 1)) { + # start of a string, not within a preprocessor line + $line .= "\""; + $state = 2; + } + elsif($c eq "\n") { + $line .= "\n"; + } + else { + $line .= " "; + } + } + } + return $state, $flags, $line; +} + +sub sourcecode { + my ($f) = @_; + my $state = 0; + my $flags = 0; + my @lines; + my $line; + open(F, "<$f"); + while() { + my $l = $_; + ($state, $flags, $line) = srcline($state, $flags, $l); + push @lines, $line; + } + close(F); + return @lines; +} + +my @whitelist = ( + # ignore what looks like URLs + '(^|\W)((https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&\'\(\)*+,;=]+)', + # remove bolded sections + '\*\*.*?\*\*', + # remove backticked texts + '\`.*?\`' + ); +my %alt; +my %exactcase; + +my %wl; + +my @w; +my @exact; +my $file = shift @ARGV; +open(CONFIG, "<$file") or die "Cannot open '$file': $!"; +while() { + chomp; + if($_ =~ /^#/) { + next; + } + if(/^---:([^:]*):(.*)/) { + # whitelist file + word + my $word = lc($2); + $wl{"$1:$word"}=1; + } + elsif($_ =~ /^---(.+)/) { + # whitelist word + push @whitelist, $1; + } + elsif($_ =~ /^(.*)([:=])(.*)/) { + my ($bad, $sep, $better)=($1, $2, $3); + if($sep eq "=") { + $alt{$bad} = $better; + push @exact, $bad; + } + else { + $alt{lc($bad)} = $better; + push @w, $bad; + } + } +} +close(CONFIG); + +# Build a single combined regex for case-insensitive words +my $re_ci; +if(@w) { + my $pat = join('|', map { quotemeta($_) } @w); + $re_ci = qr/\b($pat)\b/i; +} + +# Build a single combined regex for case-sensitive (exact) words +my $re_cs; +if(@exact) { + my $pat = join('|', map { quotemeta($_) } @exact); + $re_cs = qr/\b($pat)\b/; +} + +# Build a single combined regex for removing whitelisted content +my $pat = join('|', map { $_ } @whitelist); +my $re_wl = qr/($pat)/; + +my $errors = 0; + +sub highlight { + my ($p, $w, $in, $f, $l, $lookup) = @_; + + my $c = length($p)+1; + my $ch; + + my $dir = dirname($f); + $ch = $dir . "/" . ":" . lc($w); + if($wl{$ch}) { + # whitelisted dirname + word + return; + } + my $updir = dirname($dir); + if($dir ne $updir) { + $ch = $updir . "/" . ":" . lc($w); + if($wl{$ch}) { + # whitelisted upper dirname + word + return; + } + } + $ch = $f . ":" . lc($w); + if($wl{$ch}) { + # whitelisted filename + word + return; + } + + print STDERR "$f:$l:$c: error: found bad word \"$w\"\n"; + printf STDERR " %4d | %s\n", $l, $in; + printf STDERR " | %*s^%s\n", length($p), " ", + "~" x (length($w)-1); + printf STDERR " maybe use \"%s\" instead?\n", $alt{$lookup}; + $errors++; +} + +sub document { + my ($f) = @_; + my @lines; + open(F, "<$f"); + while() { + push @lines, $_; + } + close(F); + return @lines; +} + +sub file { + my ($f) = @_; + my $l = 0; + + my $skip_indented = 0; + my $source_code = 0; + if($f =~ /\.[ch]$/) { + $source_code = 1; + } + else { + # markdown + $skip_indented = 1; + } + + my @lines; + if($source_code) { + @lines = sourcecode($f); + } + else { + @lines = document($f); + } + for my $in (@lines) { + $l++; + chomp $in; + if($skip_indented && $in =~ /^ /) { + next; + } + # remove the link part + $in =~ s/(\[.*\])\(.*\)/$1/g; + # remove whitelisted patterns (pre-compiled) + if($re_wl) { + $in =~ s/${re_wl}//ig; + } + # case-insensitive bad words + if($re_ci) { + if($in =~ /^(.*)$re_ci/i) { + highlight($1, $2, $in, $f, $l, lc($2)); + } + } + # case-sensitive (exact) bad words + if($re_cs) { + if($in =~ /^(.*)$re_cs/) { + highlight($1, $2, $in, $f, $l, $2); + } + } + } +} + +my @filemasks = @ARGV; +open(my $git_ls_files, '-|', 'git', 'ls-files', '--', ":!:$file", @filemasks) or die "Failed running git ls-files: $!"; +my @files; +while(my $each = <$git_ls_files>) { + chomp $each; + push @files, $each; +} +close $git_ls_files; + +my $onum = scalar(@files); +my $num; +for my $e (@files) { + #printf STDERR "Complete: %d%%\r", $num++ * 100 / $onum; + file($e); +} + +exit $errors; diff --git a/scripts/badwords-all b/scripts/badwords-all new file mode 100755 index 00000000..b2eb133a --- /dev/null +++ b/scripts/badwords-all @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +# Copyright (C) Daniel Stenberg, , et al. +# +# SPDX-License-Identifier: curl + +use strict; +use warnings; + +use File::Basename; + +chdir dirname(__FILE__) . '/..'; + +exit system('scripts/badwords', ('scripts/badwords.txt')) >> 8; diff --git a/scripts/badwords.txt b/scripts/badwords.txt new file mode 100644 index 00000000..4996b229 --- /dev/null +++ b/scripts/badwords.txt @@ -0,0 +1,126 @@ +# Copyright (C) Daniel Stenberg, , et al. +# +# SPDX-License-Identifier: curl +# +# whitelisted uses of bad words (case insensitive) can be done in two ways, +# globally and per-file. +# +# ---[word] +# ---:[file]:[word] +# +back-end:backend +e-mail:email +run-time:runtime +set-up:setup +tool chain:toolchain +tool-chain:toolchain +well known:well-known +wild-card:wildcard +wild card:wildcard +threadsafe:thread-safe +thread safe:thread-safe +thread safety:thread-safety +thread unsafe:thread-unsafe +multi thread:multi-thread +nul terminate:null-terminate +null terminate:null-terminate +zero terminate:null-terminate +nul terminated:null-terminated +null terminated:null-terminated +zero terminated:null-terminated +nul terminator:null-terminator +null terminator:null-terminator +zero terminator:null-terminator +work-around:workaround or work around +work-arounds:workarounds or works around +it's:it is +aren't:are not +can't:cannot +could've:could have +couldn't:could not +didn't:did not +doesn't:does not +don't:do not +haven't:have not +i'd:I would +i'll:I will +i'm:I am +i've:I have +isn't:is not +it'd:it would +it'll:it will +might've:might have +needn't:need not +should've:should have +shouldn't:should not +that's:that is +there's:there is +they'd:They would +they'll:They will +they're:They are +they've:They have +this'll:this will +wasn't:was not +we'd:we would +we'll:we will +we're:we are +we've:we have +weren't:were not +won't:will not +would've:would have +wouldn't:would not +you'd:you would +you'll:you will +you're:you are +you've:you have +a html:an html +a http:an http +a ftp:an ftp +a IPv4:an IPv4 +a IPv6:an IPv6 + url= URL +internet=Internet +isation:ization +So=Rewrite it somehow? +And=Rewrite it somehow? +But=Rewrite it somehow? +sub-directory:subdirectory +web page:webpage +host name:hostname +host names:hostnames +file name:filename +file names:filenames +fist:first +user name:username +user names:usernames +pass phrase:passphrase +will:rewrite to present tense +7 bit:7-bit +8 bit:8-bit +16 bit:16-bit +24 bit:24-bit +32 bit:32-bit +56 bit:56-bit +63 bit:63-bit +64 bit:64-bit +128 bit:128-bit +8-bits:8 bits +16-bits:16 bits +32-bits:32 bits +64-bits:64 bits +initialise:initialize +very:rephrase using an alternative word +just:rephrase using an alternative word +simply:rephrase using an alternative word +Curl=curl +cURL=curl +Libcurl=libcurl +LibCurl=libcurl +manpages:man pages +manpage:man page +favour:favor +basically:rephrase? +However,:rephrase? +the the:the +with with:with +---Will diff --git a/scripts/cd2nroff b/scripts/cd2nroff index 251b240a..abcb7632 100755 --- a/scripts/cd2nroff +++ b/scripts/cd2nroff @@ -393,7 +393,7 @@ sub single { print STDERR "$f:$line:1:ERROR: un-escaped < or > used\n"; $errors++; } - # convert backslash-'<' or '> to just the second character + # convert backslash-'<' or '> to the second character $d =~ s/\\([<>])/$1/g; # mentions of curl symbols with man pages use italics by default diff --git a/scripts/checksrc.pl b/scripts/checksrc.pl index d796bc5d..41bf846b 100755 --- a/scripts/checksrc.pl +++ b/scripts/checksrc.pl @@ -201,6 +201,7 @@ my %warnings = ( 'TRAILINGSPACE' => 'Trailing whitespace on the line', 'TYPEDEFSTRUCT' => 'typedefed struct', 'UNUSEDIGNORE' => 'a warning ignore was not used', + 'USESAFEFREE' => 'replace curlx_free() + NULL assignment with curlx_safefree()', ); sub readskiplist { @@ -532,6 +533,8 @@ sub scanfile { my $l = ""; my $prep = 0; my $prevp = 0; + my $prevfreeindent = ""; + my $prevfreevar = ""; if($verbose) { printf "Checking file: $file\n"; @@ -751,7 +754,7 @@ sub scanfile { my $cond = $4; if($cond =~ / = /) { checkwarn("ASSIGNWITHINCONDITION", - $line, $pos+1, $file, $l, + $line, $pos + 1, $file, $l, "assignment within conditional expression"); } my $temp = $cond; @@ -876,7 +879,7 @@ sub scanfile { } } - # check for "return" with parentheses around just a value/name + # check for "return" with parentheses around a value/name if($l =~ /^(.*\W)return \(\w*\);/) { checkwarn("RETURNPAREN", $line, length($1)+7, $file, $l, "return with paren"); @@ -973,6 +976,24 @@ sub scanfile { $line, length($1), $file, $ol, "no space before label"); } + if($prevfreevar ne "") { + if(rindex($l, "$prevfreeindent$prevfreevar = NULL;", 0) == 0) { + checkwarn("USESAFEFREE", + $line, length($prevfreeindent), $file, $ol, + "replace curlx_free() + NULL assignment with curlx_safefree()"); + } + } + if($l) { + if($l =~ /^( *)curlx_free\(([^)]+)\);/) { + $prevfreeindent = $1; + $prevfreevar = $2; + } + else { + $prevfreeindent = ""; + $prevfreevar = ""; + } + } + # scan for use of banned functions my $bl = $l; again: @@ -1199,7 +1220,7 @@ sub scanfile { # A rather more interesting, and correct, check would be to not test # only locally committed files but inspect all files wrt the year of # their last commit. Removing the `git rev-list origin/master..HEAD` - # condition below will enforce copyright year checks against the year + # condition below enforces copyright year checks against the year # the file was last committed (and thus edited to some degree). my $commityear = undef; @copyright = sort {$$b{year} cmp $$a{year}} @copyright; diff --git a/scripts/cmakelint.sh b/scripts/cmakelint.sh index 88506384..fc0a3d22 100755 --- a/scripts/cmakelint.sh +++ b/scripts/cmakelint.sh @@ -7,7 +7,7 @@ # https://cmake-format.readthedocs.io/en/latest/lint-usage.html # https://github.com/cheshirekow/cmake_format/blob/master/cmakelang/configuration.py -# Run cmakelint on the curl source code. It will check all files given on the +# Run cmakelint on the curl source code. It checks all files given on the # command-line, or else all relevant files in git, or if not in a git # repository, all files starting in the tree rooted in the current directory. # @@ -16,8 +16,8 @@ # # The xargs invocation is portable, but does not preserve spaces in filenames. # If such a file is ever added, then this can be portably fixed by switching to -# "xargs -I{}" and appending {} to the end of the xargs arguments (which will -# call cmakelint once per file) or by using the GNU extension "xargs -d'\n'". +# "xargs -I{}" and appending {} to the end of the xargs arguments (which calls +# cmakelint once per file) or by using the GNU extension "xargs -d'\n'". set -eu diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c7c55423..0e2d7ecf 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -236,8 +236,8 @@ if(NOT LIBSSH2_DISABLE_INSTALL) set(_explicit_libs "") get_target_property(_imported "${_lib}" IMPORTED) if(NOT _imported) - # Reading the LOCATION property on non-imported target will error out. - # Assume the user will not need this information in the .pc file. + # Reading the LOCATION property on non-imported target errors out. + # Assume the user does not need this information in the .pc file. continue() endif() get_target_property(_libname "${_lib}" LOCATION) diff --git a/src/Makefile.am b/src/Makefile.am index 87b7dc4c..d343e127 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -24,8 +24,8 @@ AM_CFLAGS = @LIBSSH2_CFLAG_EXTRAS@ VERSION=-version-info 1:1:0 -# This flag accepts an argument of the form current[:revision[:age]]. So, -# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to +# This flag accepts an argument of the form current[:revision[:age]]. +# Passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # 1. # # If either revision or age are omitted, they default to 0. Also note that age diff --git a/src/agent.c b/src/agent.c index 4fdd716c..7619d16e 100644 --- a/src/agent.c +++ b/src/agent.c @@ -270,9 +270,9 @@ static int agent_connect_openssh(LIBSSH2_AGENT *agent) OPEN_EXISTING, /* Non-blocking mode for agent connections is not implemented at * the point this was implemented. The code for Win32 OpenSSH - * should support non-blocking IO, but the code calling it doesn't + * should support non-blocking IO, but the code calling it does not * support it as of yet. - * When non-blocking IO is implemented for the surrounding code, + * When non-blocking I/O is implemented for the surrounding code, * uncomment the following line to enable support within the Win32 * OpenSSH code. */ diff --git a/src/bcrypt_pbkdf.c b/src/bcrypt_pbkdf.c index 253fdb83..9435204a 100644 --- a/src/bcrypt_pbkdf.c +++ b/src/bcrypt_pbkdf.c @@ -45,7 +45,7 @@ * attacker can merely run once through the outer loop below, but the user * always runs it twice. Shuffling output bytes requires computing the * entirety of the key material to assemble any subkey. This is something a - * wise caller could do; we just do it for you. + * wise caller could do; we do it for you. */ #define BCRYPT_BLOCKS 8 diff --git a/src/blowfish.c b/src/blowfish.c index b1d9e92f..83c66c4d 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -65,9 +65,9 @@ struct blf_ctx { }; /* Raw access to customized Blowfish - * blf_key is just: - * Blowfish_initstate( state ) - * Blowfish_expand0state( state, key, keylen ) + * blf_key is: + * Blowfish_initstate(state) + * Blowfish_expand0state(state, key, keylen) */ /* Standard Blowfish */ diff --git a/src/channel.c b/src/channel.c index 62d263c9..d534ce88 100644 --- a/src/channel.c +++ b/src/channel.c @@ -72,9 +72,9 @@ uint32_t _libssh2_channel_nextid(LIBSSH2_SESSION *session) channel = _libssh2_list_next(&channel->node); } - /* This is a shortcut to avoid waiting for close packets on channels we've - * forgotten about, This *could* be a problem if we request and close 4 - * billion or so channels in too rapid succession for the remote end to + /* This is a shortcut to avoid waiting for close packets on channels we + * have forgotten about, This *could* be a problem if we request and close + * 4 billion or so channels in too rapid succession for the remote end to * respond, but the worst case scenario is that some data meant for * another channel Gets picked up by the new one.... Pretty unlikely all * told... @@ -101,7 +101,7 @@ LIBSSH2_CHANNEL *_libssh2_channel_locate(LIBSSH2_SESSION *session, return channel; } - /* We didn't find the channel in the session, let's then check its + /* We did not find the channel in the session, let us then check its listeners since each listener may have its own set of pending channels */ for(l = _libssh2_list_first(&session->listeners); l; @@ -746,7 +746,7 @@ int _libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener) _libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send global-request packet for forward " "listen request"); - /* set the state to something we don't check for, for the + /* set the state to something we do not check for, for the unfortunate situation where we get an EAGAIN further down when trying to bail out due to errors! */ listener->chanFwdCncl_state = libssh2_NB_state_sent; @@ -1189,7 +1189,7 @@ int libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel) rc = LIBSSH2_ERROR_CHANNEL_UNKNOWN; - /* The current RFC draft for agent forwarding says you're supposed to + /* The current RFC draft for agent forwarding says you are supposed to * send "auth-agent-req," but most SSH servers out there right now * actually expect "auth-agent-req@openssh.com", so we try that * first. */ @@ -1272,7 +1272,7 @@ static int channel_request_pty_size(LIBSSH2_CHANNEL *channel, int width, _libssh2_store_u32(&s, channel->remote.id); _libssh2_store_str(&s, (const char *)"window-change", sizeof("window-change") - 1); - *(s++) = 0x00; /* Don't reply */ + *(s++) = 0x00; /* Do not reply */ _libssh2_store_u32(&s, width); _libssh2_store_u32(&s, height); _libssh2_store_u32(&s, width_px); @@ -1381,8 +1381,8 @@ static int channel_x11_req(LIBSSH2_CHANNEL *channel, int single_connection, } else { int i; - /* note: the snprintf() loop will always write 3 bytes so the - last one will write the trailing zero after the + /* note: the snprintf() loop always writes 3 bytes so the + last one writes the trailing zero after the LIBSSH2_X11_RANDOM_COOKIE_LEN border in s, but s has extra 4 bytes of size (for screen_number) */ unsigned char buffer[LIBSSH2_X11_RANDOM_COOKIE_LEN / 2]; @@ -1600,7 +1600,7 @@ int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel, } /* - * Set a channel's BEHAVIOR blocking on or off. The socket will remain non- + * Set a channel's BEHAVIOR blocking on or off. The socket remains non- * blocking. */ LIBSSH2_API @@ -1639,7 +1639,7 @@ int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid) (packet_type == SSH_MSG_CHANNEL_EXTENDED_DATA)) && ((packet->data_len >= 5) && (_libssh2_ntohu32(packet->data + 1) == channel->local.id))) { - /* It's our channel at least */ + /* It is our channel at least */ int packet_stream_id; if(packet_type == SSH_MSG_CHANNEL_DATA) { @@ -1670,7 +1670,7 @@ int _libssh2_channel_flush(LIBSSH2_CHANNEL *channel, int streamid) (long)bytes_to_flush, packet_stream_id, channel->local.id, channel->remote.id)); - /* It's one of the streams we wanted to flush */ + /* It is one of the streams we wanted to flush */ channel->flush_refund_bytes += packet->data_len - 13; channel->flush_flush_bytes += bytes_to_flush; @@ -1801,7 +1801,7 @@ int libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel, /* * Adjust the receive window for a channel by adjustment bytes. If the amount * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the - * adjustment amount will be queued for a later packet. + * adjustment amount is queued for a later packet. * * Calls _libssh2_error() ! */ @@ -1834,7 +1834,7 @@ int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, adjustment += channel->adjust_queue; channel->adjust_queue = 0; - /* Adjust the window based on the block we just freed */ + /* Adjust the window based on the block we freed */ channel->adjust_adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST; _libssh2_htonu32(&channel->adjust_adjust[1], channel->remote.id); _libssh2_htonu32(&channel->adjust_adjust[5], adjustment); @@ -1880,7 +1880,7 @@ int _libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, * * Adjust the receive window for a channel by adjustment bytes. If the amount * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the - * adjustment amount will be queued for a later packet. + * adjustment amount is queued for a later packet. * * Returns the new size of the receive window (as understood by remote end). * Note that it might return EAGAIN too which is highly stupid. @@ -1902,7 +1902,7 @@ unsigned long libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, (uint32_t)adjustment, force, &window)); - /* stupid - but this is how it was made to work before and this is just + /* stupid - but this is how it was made to work before and this is kept for backwards compatibility */ return rc ? (unsigned long)rc : window; } @@ -1911,7 +1911,7 @@ unsigned long libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, /* * Adjust the receive window for a channel by adjustment bytes. If the amount * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the - * adjustment amount will be queued for a later packet. + * adjustment amount is queued for a later packet. * * Stores the new size of the receive window in the data 'window' points to. * @@ -2165,7 +2165,7 @@ ssize_t _libssh2_channel_read(LIBSSH2_CHANNEL *channel, int stream_id, * was no payload data to fill in the buffer with, we MUST make sure to return * LIBSSH2_ERROR_EAGAIN. * - * This function will first make sure there's a receive window enough to + * This function first makes sure there is a receive window enough to * receive a full buffer's wort of contents. An application may choose to * adjust the receive window more to increase transfer performance. */ @@ -2195,7 +2195,7 @@ ssize_t libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id, /* * Return the size of the data block of the current packet, or 0 if there - * isn't a packet. + * is not a packet. */ size_t _libssh2_channel_packet_data_len(LIBSSH2_CHANNEL *channel, int stream_id) @@ -2306,7 +2306,7 @@ ssize_t _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, } if(channel->local.window_size <= 0) { - /* there's no room for data so we stop */ + /* there is no room for data so we stop */ /* Waiting on the socket to be writable would be wrong because we * would be back here immediately, but a readable socket might @@ -2325,7 +2325,7 @@ ssize_t _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, if(stream_id) _libssh2_store_u32(&s, stream_id); - /* Don't exceed the remote end's limits */ + /* Do not exceed the remote end's limits */ /* REMEMBER local means local as the SOURCE of the data */ if(channel->write_bufwrite > channel->local.window_size) { _libssh2_debug((session, LIBSSH2_TRACE_CONN, @@ -2377,10 +2377,9 @@ ssize_t _libssh2_channel_write(LIBSSH2_CHANNEL *channel, int stream_id, We cannot move on to send the next piece of data that may already have been provided in this same function call, as we - risk getting EAGAIN for that and we can't return information - both about sent data as well as EAGAIN. So, by returning short - now, the caller will call this function again with new data to - send */ + risk getting EAGAIN for that and we cannot return information + both about sent data as well as EAGAIN. By returning short now, + the caller calls this function again with new data to send */ channel->write_state = libssh2_NB_state_idle; @@ -2482,7 +2481,7 @@ int libssh2_channel_eof(LIBSSH2_CHANNEL *channel) (packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)) && ((packet->data_len >= 5) && (channel->local.id == _libssh2_ntohu32(packet->data + 1)))) { - /* There's data waiting to be read yet, mask the EOF status */ + /* There is data waiting to be read yet, mask the EOF status */ return 0; } packet = next_packet; @@ -2509,7 +2508,7 @@ static int channel_wait_eof(LIBSSH2_CHANNEL *channel) /* * While channel is not eof, read more packets from the network. - * Either the EOF will be set or network timeout will occur. + * Either the EOF is set or network timeout occurs. */ do { if(channel->remote.eof) { @@ -2560,7 +2559,7 @@ int _libssh2_channel_close(LIBSSH2_CHANNEL *channel) if(channel->local.close) { /* Already closed, act like we sent another close, - * even though we didn't... shhhhhh */ + * even though we did not... shhhhhh */ channel->close_state = libssh2_NB_state_idle; return 0; } @@ -2616,7 +2615,7 @@ int _libssh2_channel_close(LIBSSH2_CHANNEL *channel) } if(rc != LIBSSH2_ERROR_EAGAIN) { - /* set the local close state first when we're perfectly confirmed to + /* set the local close state first when we are perfectly confirmed to not do any more EAGAINs */ channel->local.close = 1; @@ -2672,7 +2671,7 @@ static int channel_wait_closed(LIBSSH2_CHANNEL *channel) /* * While channel is not closed, read more packets from the network. - * Either the channel will be closed or network timeout will occur. + * Either the channel is closed or network timeout occurs. */ if(!channel->remote.close) { do { @@ -2749,8 +2748,8 @@ int _libssh2_channel_free(LIBSSH2_CHANNEL *channel) /* * channel->remote.close *might* not be set yet, Well... - * We've sent the close packet, what more do you want? - * Just let packet_add ignore it when it finally arrives + * We have sent the close packet, what more do you want? + * Let packet_add ignore it when it finally arrives */ /* Clear out packets meant for this channel */ @@ -2851,8 +2850,8 @@ int libssh2_channel_free(LIBSSH2_CHANNEL *channel) /* * Check the status of the read window. Returns the number of bytes which the * remote end may send without overflowing the window limit read_avail (if - * passed) will be populated with the number of bytes actually available to be - * read window_size_initial (if passed) will be populated with the + * passed) is populated with the number of bytes actually available to be + * read window_size_initial (if passed) is populated with the * window_size_initial as defined by the channel_open request */ LIBSSH2_API @@ -2906,7 +2905,7 @@ unsigned long libssh2_channel_window_read_ex( /* * Check the status of the write window Returns the number of bytes which may * be safely written on the channel without blocking window_size_initial (if - * passed) will be populated with the size of the initial window as defined by + * passed) is populated with the size of the initial window as defined by * the channel_open request */ LIBSSH2_API @@ -2918,7 +2917,7 @@ unsigned long libssh2_channel_window_write_ex( return 0; /* no channel, no window! */ if(window_size_initial) { - /* For locally initiated channels this is very often 0, so it's not + /* For locally initiated channels this is often 0, so it is not * *that* useful as information goes */ *window_size_initial = channel->local.window_size_initial; } @@ -2936,7 +2935,7 @@ unsigned long libssh2_channel_window_write_ex( boolean FALSE string signal name (without the "SIG" prefix) - 'signal name' values will be encoded as discussed in the passage + 'signal name' values are encoded as discussed in the passage describing SSH_MSG_CHANNEL_REQUEST messages using "exit-signal" in this section. */ @@ -2965,7 +2964,7 @@ static int channel_signal(LIBSSH2_CHANNEL *channel, *(s++) = SSH_MSG_CHANNEL_REQUEST; _libssh2_store_u32(&s, channel->remote.id); _libssh2_store_str(&s, "signal", sizeof("signal") - 1); - *(s++) = 0x00; /* Don't reply */ + *(s++) = 0x00; /* Do not reply */ _libssh2_store_str(&s, signame, signame_len); channel->sendsignal_state = libssh2_NB_state_created; diff --git a/src/channel.h b/src/channel.h index f05a6573..420c80e7 100644 --- a/src/channel.h +++ b/src/channel.h @@ -43,7 +43,7 @@ /* * Adjust the receive window for a channel by adjustment bytes. If the amount * to be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the - * adjustment amount will be queued for a later packet. + * adjustment amount is queued for a later packet. * * Always non-blocking. */ diff --git a/src/comp.c b/src/comp.c index 45d200a6..47fd5a4a 100644 --- a/src/comp.c +++ b/src/comp.c @@ -95,7 +95,7 @@ static int comp_method_none_decomp(LIBSSH2_SESSION *session, static const struct comp_method comp_method_none = { "none", 0, /* not really compressing */ - 0, /* isn't used in userauth, go figure */ + 0, /* is not used in userauth, go figure */ NULL, comp_method_none_comp, comp_method_none_decomp, @@ -108,7 +108,7 @@ static const struct comp_method comp_method_none = { ****** */ /* Memory management wrappers - * Yes, I realize we're doing a callback to a callback, + * Yes, I realize we are doing a callback to a callback, * Deal... */ @@ -246,7 +246,7 @@ static int comp_method_zlib_decomp(LIBSSH2_SESSION *session, return _libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate decompression buffer"); - /* Loop until it's all inflated or hit error */ + /* Loop until it is all inflated or hit error */ for(;;) { int status; size_t out_ofs; @@ -257,7 +257,7 @@ static int comp_method_zlib_decomp(LIBSSH2_SESSION *session, if(status == Z_OK) { if(strm->avail_out > 0) /* status is OK and the output buffer has not been exhausted - so we're done */ + so we are done */ break; } else if(status == Z_BUF_ERROR) { @@ -342,7 +342,7 @@ static const struct comp_method comp_method_zlib = { static const struct comp_method comp_method_zlib_openssh = { "zlib@openssh.com", 1, /* yes, this compresses */ - 0, /* don't use compression during userauth */ + 0, /* do not use compression during userauth */ comp_method_zlib_init, comp_method_zlib_comp, comp_method_zlib_decomp, diff --git a/src/crypt.c b/src/crypt.c index 8ec72291..d38f71b2 100644 --- a/src/crypt.c +++ b/src/crypt.c @@ -52,7 +52,7 @@ * typically disabled on SSH2 implementations and is disabled in libssh2 * by default as well. * - * Enabling this option will allow for "none" as a negotiable method, + * Enabling this option allows for "none" as a negotiable method, * however it still requires that the method be advertised by the remote * end and that no more-preferable methods are available. * @@ -327,7 +327,7 @@ static int crypt_init_arcfour128(LIBSSH2_SESSION *session, for(; discard; discard -= 8) _libssh2_cipher_crypt(&cctx->h, cctx->algo, cctx->encrypt, block, method->blocksize, MIDDLE_BLOCK); - /* Not all middle, but here it doesn't matter */ + /* Not all middle, but here it does not matter */ } return rc; @@ -436,12 +436,12 @@ static int crypt_encrypt_chacha20_poly_buffer(LIBSSH2_SESSION *session, } else { /* buf is full packet including size and auth tag but buf_len - doesn't include size */ + does not include size */ ret = chachapoly_crypt(&ctx->chachapoly_ctx, seqno, buf, buf, buf_len, 4, ctx->encrypt); /* the api expects the size field to already be removed - from the decrypted packet so we'll help it out */ + from the decrypted packet so we help it out */ if(ret == 0) { memmove(buf, buf + 4, buf_len - 4); } diff --git a/src/crypto.h b/src/crypto.h index fb68164a..712c0b1d 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -337,7 +337,7 @@ int _libssh2_sk_pub_keyfilememory(LIBSSH2_SESSION *session, * @abstract Returns supported algorithms used for upgrading public * key signing RFC 8332 * @discussion Based on the incoming key_method value, this function - * will return supported algorithms that can upgrade the key method + * returns supported algorithms that can upgrade the key method * @related _libssh2_key_sign_algorithm() * @param key_method current key method, usually the default key sig method * @param key_method_len length of the key method buffer diff --git a/src/kex.c b/src/kex.c index cc75d8f3..22d4de96 100644 --- a/src/kex.c +++ b/src/kex.c @@ -110,7 +110,7 @@ * @note The following are wrapper functions used by diffie_hellman_sha_algo(). * TODO: Switch backend SHA macros to functions to allow function pointers * @discussion Ideally these would be function pointers but the backend macros - * don't allow it so we have to wrap them up in helper functions + * do not allow it so we have to wrap them up in helper functions */ static int sha_algo_ctx_init(int sha_algo, void *ctx) @@ -375,7 +375,7 @@ static int finish_kex(LIBSSH2_SESSION *session, session->state |= LIBSSH2_STATE_NEWKEYS; _libssh2_debug((session, LIBSSH2_TRACE_KEX, "Received NEWKEYS message")); - /* This will actually end up being just packet_type(1) + /* This actually ends up being packet_type(1) for this packet type anyway */ LIBSSH2_FREE(session, exchange_state->tmp); @@ -711,7 +711,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, if(_libssh2_bn_to_bin(exchange_state->e, exchange_state->e_packet + 5)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->e"); + "Cannot write exchange_state->e"); goto clean_exit; } } @@ -720,7 +720,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, if(_libssh2_bn_to_bin(exchange_state->e, exchange_state->e_packet + 6)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->e"); + "Cannot write exchange_state->e"); goto clean_exit; } } @@ -746,7 +746,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, if(exchange_state->state == libssh2_NB_state_sent) { if(session->burn_optimistic_kexinit) { - /* The first KEX packet to come along will be the guess initially + /* The first KEX packet to come along is the guess initially * sent by the server. That guess turned out to be wrong so we * need to silently ignore it */ int burn_type; @@ -825,7 +825,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, exchange_state->f, p, exchange_state->ctx); exchange_state->k_value_len = _libssh2_bn_bytes(exchange_state->k) + 5; if(_libssh2_bn_bits(exchange_state->k) % 8) { - /* don't need leading 00 */ + /* do not need leading 00 */ exchange_state->k_value_len--; } exchange_state->k_value = @@ -841,7 +841,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 4)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -850,7 +850,7 @@ static int diffie_hellman_sha_algo(LIBSSH2_SESSION *session, if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 5)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -2065,7 +2065,7 @@ static int ecdh_sha2_nistp(LIBSSH2_SESSION *session, libssh2_curve_type type, exchange_state->k_value_len = _libssh2_bn_bytes(exchange_state->k) + 5; if(_libssh2_bn_bits(exchange_state->k) % 8) { - /* don't need leading 00 */ + /* do not need leading 00 */ exchange_state->k_value_len--; } exchange_state->k_value = @@ -2081,7 +2081,7 @@ static int ecdh_sha2_nistp(LIBSSH2_SESSION *session, libssh2_curve_type type, if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 4)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -2090,7 +2090,7 @@ static int ecdh_sha2_nistp(LIBSSH2_SESSION *session, libssh2_curve_type type, if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 5)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -2462,7 +2462,7 @@ static int mlkem_nistp(LIBSSH2_SESSION *session, shared_secret + LIBSSH2_MLKEM_SHARED_SECRET_LEN)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write shared secret"); + "Cannot write shared secret"); goto clean_exit; } @@ -2809,7 +2809,7 @@ static int curve25519_sha256( exchange_state->k_value_len = _libssh2_bn_bytes(exchange_state->k) + 5; if(_libssh2_bn_bits(exchange_state->k) % 8) { - /* don't need leading 00 */ + /* do not need leading 00 */ exchange_state->k_value_len--; } exchange_state->k_value = @@ -2825,7 +2825,7 @@ static int curve25519_sha256( if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 4)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -2834,7 +2834,7 @@ static int curve25519_sha256( if(_libssh2_bn_to_bin(exchange_state->k, exchange_state->k_value + 5)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write exchange_state->k"); + "Cannot write exchange_state->k"); goto clean_exit; } } @@ -3131,7 +3131,7 @@ static int mlkem768x25519_sha256( shared_secret + LIBSSH2_MLKEM_SHARED_SECRET_LEN)) { ret = _libssh2_error(session, LIBSSH2_ERROR_OUT_OF_BOUNDARY, - "Can't write shared secret"); + "Cannot write shared secret"); goto clean_exit; } @@ -3474,8 +3474,8 @@ struct common_method { /* * Calculate the length of a particular method list's resulting string * Includes SUM(strlen() of each individual method plus 1 (for coma)) - 1 - * (because the last coma isn't used) - * Another sign of bad coding practices gone mad. Pretend you don't see this. + * (because the last coma is not used) + * Another sign of bad coding practices gone mad. Pretend you do not see this. */ static size_t kex_method_strlen(const struct common_method **method) { @@ -3798,16 +3798,16 @@ static int kex_agree_hostkey(LIBSSH2_SESSION *session, return -1; } - /* So far so good, but does it suit our purposes? (Encrypting + /* OK so far, but does it suit our purposes? (Encrypting vs Signing) */ if(((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY) == 0) || (method->encrypt)) { - /* Either this hostkey can do encryption or this kex just - doesn't require it */ + /* Either this hostkey can do encryption or this kex + does not require it */ if(((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY) == 0) || (method->sig_verify)) { - /* Either this hostkey can do signing or this kex just - doesn't require it */ + /* Either this hostkey can do signing or this kex + does not require it */ session->hostkey = method; return 0; } @@ -3824,16 +3824,16 @@ static int kex_agree_hostkey(LIBSSH2_SESSION *session, (const unsigned char *)(*hostkeyp)->name, strlen((*hostkeyp)->name)); if(s) { - /* So far so good, but does it suit our purposes? (Encrypting vs + /* OK so far, but does it suit our purposes? (Encrypting vs Signing) */ if(((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_ENC_HOSTKEY) == 0) || ((*hostkeyp)->encrypt)) { - /* Either this hostkey can do encryption or this kex just - doesn't require it */ + /* Either this hostkey can do encryption or this kex + does not require it */ if(((kex_flags & LIBSSH2_KEX_METHOD_FLAG_REQ_SIGN_HOSTKEY) == 0) || ((*hostkeyp)->sig_verify)) { - /* Either this hostkey can do signing or this kex just - doesn't require it */ + /* Either this hostkey can do signing or this kex + does not require it */ session->hostkey = *hostkeyp; return 0; } @@ -3879,7 +3879,7 @@ static int kex_agree_kex_hostkey(LIBSSH2_SESSION *session, unsigned char *kex, return -1; } - /* We've agreed on a key exchange method, + /* We have agreed on a key exchange method, * Can we agree on a hostkey that works with this kex? */ if(kex_agree_hostkey(session, method->flags, hostkey, @@ -3905,7 +3905,7 @@ static int kex_agree_kex_hostkey(LIBSSH2_SESSION *session, unsigned char *kex, (const unsigned char *)(*kexp)->name, strlen((*kexp)->name)); if(s) { - /* We've agreed on a key exchange method, + /* We have agreed on a key exchange method, * Can we agree on a hostkey that works with this kex? */ if(kex_agree_hostkey(session, (*kexp)->flags, hostkey, @@ -4116,7 +4116,7 @@ static int kex_agree_methods(LIBSSH2_SESSION *session, unsigned char *data, buf.dataptr = buf.data; buf.dataptr++; /* advance past packet type */ - /* Skip cookie, don't worry, it's preserved in the kexinit field */ + /* Skip cookie, do not worry, it is preserved in the kexinit field */ buf.dataptr += 16; /* Locate each string */ @@ -4139,7 +4139,7 @@ static int kex_agree_methods(LIBSSH2_SESSION *session, unsigned char *data, /* If the server sent an optimistic packet, assume that it guessed wrong. * If the guess is determined to be right (by kex_agree_kex_hostkey) - * This flag will be reset to zero so that it's not ignored */ + * This flag is reset to zero so that it is not ignored */ if(_libssh2_check_length(&buf, 1)) { session->burn_optimistic_kexinit = *(buf.dataptr++); } @@ -4556,12 +4556,13 @@ int libssh2_session_supported_algs(LIBSSH2_SESSION *session, mlist is looped through twice. The first time to find the number od supported algorithms (needed to allocate the proper size of array) and the second time to actually copy the pointers. Typically this function - will not be called often (typically at the beginning of a session) and - the number of algorithms (i.e. number of iterations in one loop) will - not be high (typically it will not exceed 20) for quite a long time. + it not called often (typically at the beginning of a session) and + the number of algorithms (i.e. number of iterations in one loop) are + not expected to become high (typically it does not exceed 20) for quite + a long time. - So double looping really shouldn't be an issue and it is definitely a - better solution than reallocation several times. + Thus double looping really should not be an issue and it is definitely + a better solution than reallocation several times. */ /* count the number of supported algorithms */ diff --git a/src/knownhost.c b/src/knownhost.c index 7fc0d14b..7aa0e8b0 100644 --- a/src/knownhost.c +++ b/src/knownhost.c @@ -156,7 +156,7 @@ static int knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, entry->name = LIBSSH2_ALLOC(hosts->session, hostlen + 1); if(!entry->name) { rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, - "Unable to allocate memory for host name"); + "Unable to allocate memory for hostname"); goto error; } memcpy(entry->name, host, hostlen + 1); @@ -201,7 +201,7 @@ static int knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, break; default: rc = _libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, - "Unknown host name type"); + "Unknown hostname type"); goto error; } @@ -309,9 +309,9 @@ int libssh2_knownhost_add(LIBSSH2_KNOWNHOSTS *hosts, * Add a host and its associated key to the collection of known hosts. * * Takes a comment argument that may be NULL. A NULL comment indicates - * there is no comment and the entry will end directly after the key - * when written out to a file. An empty string "" comment will indicate an - * empty comment which will cause a single space to be written after the key. + * there is no comment and the entry ends directly after the key + * when written out to a file. An empty string "" comment indicates an + * empty comment which causes a single space to be written after the key. * * The 'type' argument specifies on what format the given host and keys are: * @@ -343,7 +343,7 @@ int libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts, /* * Check a host and its associated key against the collection of known hosts. * - * The typemask is the type/format of the given host name and key + * The typemask is the type/format of the given hostname and key * * plain - ascii "hostname.domain.tld" * sha1 - NOT SUPPORTED AS INPUT @@ -367,13 +367,13 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, int type = typemask & LIBSSH2_KNOWNHOST_TYPE_MASK; char *keyalloc = NULL; int rc = LIBSSH2_KNOWNHOST_CHECK_NOTFOUND; - char hostbuff[270]; /* most host names can't be longer than like 256 */ + char hostbuff[270]; /* most hostnames cannot be longer than like 256 */ const char *host; int numcheck; /* number of host combos to check */ int match = 0; if(type == LIBSSH2_KNOWNHOST_TYPE_SHA1) - /* we can't work with a sha1 as given input */ + /* we cannot work with a sha1 as given input */ return LIBSSH2_KNOWNHOST_CHECK_MISMATCH; /* if a port number is given, check for a '[host]:port' first before the @@ -433,7 +433,7 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, if(SHA_DIGEST_LENGTH != node->name_len) { /* the name hash length must be the sha1 size or - we can't match it */ + we cannot match it */ break; } if(!_libssh2_hmac_sha1_init(&ctx, @@ -447,7 +447,7 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, _libssh2_hmac_cleanup(&ctx); if(!memcmp(hash, node->name, SHA_DIGEST_LENGTH)) - /* this is a node we're interested in */ + /* this is a node we are interested in */ match = 1; } break; @@ -466,7 +466,7 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, if(host_key_type != LIBSSH2_KNOWNHOST_KEY_UNKNOWN && (host_key_type == 0 || host_key_type == known_key_type)) { - /* host name and key type match, now compare the keys */ + /* hostname and key type match, now compare the keys */ if(!strcmp(key, node->key)) { /* they match! */ if(store) @@ -483,7 +483,7 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, badkey = node; } } - match = 0; /* don't count this as a match anymore */ + match = 0; /* do not count this as a match anymore */ } node = _libssh2_list_next(&node->node); } @@ -506,7 +506,7 @@ static int knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, /* * Check a host and its associated key against the collection of known hosts. * - * The typemask is the type/format of the given host name and key + * The typemask is the type/format of the given hostname and key * * plain - ascii "hostname.domain.tld" * sha1 - NOT SUPPORTED AS INPUT @@ -533,10 +533,10 @@ int libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts, * hosts. * * Note that if 'port' is specified as greater than zero, the check function - * will be able to check for a dedicated key for this particular host+port + * is able to check for a dedicated key for this particular host+port * combo, and if 'port' is negative it only checks for the generic host key. * - * The typemask is the type/format of the given host name and key + * The typemask is the type/format of the given hostname and key * * plain - ascii "hostname.domain.tld" * sha1 - NOT SUPPORTED AS INPUT @@ -624,26 +624,26 @@ static int oldstyle_hostline(LIBSSH2_KNOWNHOSTS *hosts, return _libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, "Failed to parse known_hosts line " - "(no host names)"); + "(no hostnames)"); while(name > host) { --name; ++namelen; - /* when we get the the start or see a comma coming up, add the host + /* when we get to the start or see a comma coming up, add the host name to the collection */ if((name == host) || (*(name - 1) == ',')) { char hostbuf[256]; - /* make sure we don't overflow the buffer */ + /* make sure we do not overflow the buffer */ if(namelen >= sizeof(hostbuf) - 1) return _libssh2_error(hosts->session, LIBSSH2_ERROR_METHOD_NOT_SUPPORTED, "Failed to parse known_hosts line " "(unexpected length)"); - /* copy host name to the temp buffer and zero terminate */ + /* copy hostname to the temp buffer and null-terminate */ memcpy(hostbuf, name, namelen); hostbuf[namelen] = 0; @@ -694,7 +694,7 @@ static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts, "(unexpectedly long salt)"); memcpy(saltbuf, salt, saltlen); - saltbuf[saltlen] = 0; /* zero terminate */ + saltbuf[saltlen] = 0; /* null-terminate */ salt = saltbuf; /* point to the stack based buffer */ hash = p + 1; /* the host hash is after the separator */ @@ -721,14 +721,14 @@ static int hashed_hostline(LIBSSH2_KNOWNHOSTS *hosts, LIBSSH2_KNOWNHOST_KEYENC_BASE64, NULL); } else - return 0; /* XXX: This should be an error, shouldn't it? */ + return 0; /* XXX: This should be an error, should not it? */ } /* * Parse a single known_host line pre-split into host and key. * - * The key part may include an optional comment which will be parsed here - * for ssh-rsa and ssh-dsa keys. Comments in other key types aren't handled. + * The key part may include an optional comment which is parsed here + * for ssh-rsa and ssh-dsa keys. Comments in other key types are not handled. * * The function assumes new-lines have already been removed from the arguments. */ @@ -762,7 +762,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts, case '9': key_type = LIBSSH2_KNOWNHOST_KEY_RSA1; - /* Note that the old-style keys (RSA1) aren't truly base64, but we + /* Note that the old-style keys (RSA1) are not truly base64, but we * claim it is for now since we can get away with strcmp()ing the * entire anything anyway! We need to check and fix these to make them * work properly. @@ -931,9 +931,9 @@ int libssh2_knownhost_readline(LIBSSH2_KNOWNHOSTS *hosts, len--; } - /* zero terminate where the newline is */ + /* null-terminate where the newline is */ if(*cp == '\n') - keylen--; /* don't include this in the count */ + keylen--; /* do not include this in the count */ /* deal with this one host+key line */ rc = hostline(hosts, hostp, hostlen, keyp, keylen); @@ -986,7 +986,7 @@ int libssh2_knownhost_readfile(LIBSSH2_KNOWNHOSTS *hosts, * * Note that this function returns LIBSSH2_ERROR_BUFFER_TOO_SMALL if the given * output buffer is too small to hold the desired output. The 'outlen' field - * will then contain the size libssh2 wanted to store, which then is the + * then contains the size libssh2 wanted to store, which then is the * smallest sufficient buffer it would require. */ static int knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, @@ -1068,7 +1068,7 @@ static int knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, ("%s %s\n", host, key) Even if the buffer is too small, we have to set outlen to the number of - characters the complete line would have taken. We also don't write + characters the complete line would have taken. We also do not write anything to the buffer unless we are sure we can write everything to the buffer. */ @@ -1091,7 +1091,7 @@ static int knownhost_writeline(LIBSSH2_KNOWNHOSTS *hosts, if(!name_base64_len) return _libssh2_error(hosts->session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for " - "base64-encoded host name"); + "base64-encoded hostname"); salt_base64_len = _libssh2_base64_encode(hosts->session, node->salt, node->salt_len, diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index fec906c9..b66e5b40 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -183,7 +183,7 @@ int _libssh2_gettimeofday(struct timeval *tp, void *tzp); #define inline __inline #endif -/* 3DS doesn't seem to have iovec */ +/* 3DS does not seem to have iovec */ #if defined(_WIN32) || defined(_3DS) struct iovec { @@ -427,7 +427,7 @@ struct packet { size_t data_len; /* Where to start reading data from, - * used for channel data that's been partially consumed */ + * used for channel data that is been partially consumed */ size_t data_head; }; @@ -736,8 +736,8 @@ struct _LIBSSH2_SESSION { /* (local as source of data -- packet_write ) */ struct endpoint_data local; - /* Inbound Data linked list -- Sometimes the packet that comes in isn't the - packet we're ready for */ + /* Inbound Data linked list -- Sometimes the packet that comes in is not + the packet we are ready for */ struct list_head packets; /* Active connection channels */ @@ -956,15 +956,15 @@ struct _LIBSSH2_SESSION { #define LIBSSH2_SOCKET_RECV_FLAGS(session) \ ((session)->flag.sigpipe ? 0 : MSG_NOSIGNAL) #else -/* If MSG_NOSIGNAL isn't defined we're SOL on blocking SIGPIPE */ +/* If MSG_NOSIGNAL is not defined we are SOL on blocking SIGPIPE */ #define LIBSSH2_SOCKET_SEND_FLAGS(session) 0 #define LIBSSH2_SOCKET_RECV_FLAGS(session) 0 #endif /* --------- */ -/* libssh2 extensible ssh api, ultimately I'd like to allow loading additional - methods via .so/.dll */ +/* libssh2 extensible SSH API, ultimately I would like to allow loading + additional methods via .so/.dll */ struct kex_method { const char *name; @@ -1065,7 +1065,7 @@ struct crypt_method { struct comp_method { const char *name; - int compress; /* 1 if it does compress, 0 if it doesn't */ + int compress; /* 1 if it does compress, 0 if it does not */ int use_in_auth; /* 1 if compression should be used in userauth */ int (*init)(LIBSSH2_SESSION *session, int compress, void **abstract); int (*comp)(LIBSSH2_SESSION *session, @@ -1101,14 +1101,14 @@ void _libssh2_debug_low(LIBSSH2_SESSION *session, int context, /* When MAC type is "none" (proto initiation phase) all packets are deemed "confirmed" */ #define LIBSSH2_MAC_CONFIRMED 0 -/* Something very bad is going on */ +/* Something bad is going on */ #define LIBSSH2_MAC_INVALID (-1) /* Flags for _libssh2_error_flags */ /* Error message is allocated on the heap */ #define LIBSSH2_ERR_FLAG_DUP 1 -/* SSH Packet Types -- Defined by internet draft */ +/* SSH Packet Types -- Defined by Internet draft */ /* Transport Layer */ #define SSH_MSG_DISCONNECT 1 #define SSH_MSG_IGNORE 2 diff --git a/src/mac.c b/src/mac.c index 497e4aaa..2b1919a0 100644 --- a/src/mac.c +++ b/src/mac.c @@ -49,7 +49,7 @@ * a "none" cipher, it is still not recommended as disabling MAC hashes * removes a layer of security. * - * Enabling this option will allow for "none" as a negotiable method, + * Enabling this option allows for "none" as a negotiable method, * however it still requires that the method be advertised by the remote * end and that no more-preferable methods are available. */ diff --git a/src/mbedtls.c b/src/mbedtls.c index 00d8d9b4..377ecd11 100644 --- a/src/mbedtls.c +++ b/src/mbedtls.c @@ -122,7 +122,7 @@ int _libssh2_mbedtls_cipher_init(libssh2_cipher_ctx *h, /* libssh2 computes and adds SSH packet padding itself, so for CBC * tell mbedTLS to expect no padding on the cipher layer. Only call * set_padding_mode for CBC ciphers since other modes (CTR, stream) - * are not applicable and will cause an error. */ + * are not applicable and causes an error. */ if(!ret) { if(algo == MBEDTLS_CIPHER_AES_128_CBC || algo == MBEDTLS_CIPHER_AES_192_CBC || @@ -345,8 +345,8 @@ static int mbed_bignum_random(libssh2_bn *bn, int bits, int top, int bottom) /* If `top` is -1, the most significant bit of the random number can be zero. If top is 0, the most significant bit of the random number is set to 1, and if top is 1, the two most significant bits of the number - will be set to 1, so that the product of two such random numbers will - always have 2*bits length. + is set to 1, so that the product of two such random numbers always + have 2 * bits length. */ if(top >= 0) { for(i = 0; i <= (size_t)top; ++i) { @@ -491,7 +491,7 @@ int _libssh2_mbedtls_rsa_new_private_frommemory( /* mbedtls checks in "mbedtls/pkparse.c:1184" if "key[keylen - 1] != '\0'" - private-key from memory will fail if the last byte is not a null byte + private-key from memory fails if the last byte is not a null byte */ filedata_nullterm = mbedtls_calloc(filedata_len + 1, 1); if(!filedata_nullterm) { @@ -790,7 +790,7 @@ int _libssh2_mbedtls_pub_priv_keyfilememory(LIBSSH2_SESSION *session, /* mbedtls checks in "mbedtls/pkparse.c:1184" if "key[keylen - 1] != '\0'" - private-key from memory will fail if the last byte is not a null byte + private-key from memory fails if the last byte is not a null byte */ privatekeydata_nullterm = mbedtls_calloc(privatekeydata_len + 1, 1); if(!privatekeydata_nullterm) { diff --git a/src/misc.c b/src/misc.c index 29af61de..b3c41ccb 100644 --- a/src/misc.c +++ b/src/misc.c @@ -64,7 +64,7 @@ /* Want safe, 'n += snprintf(b + n ...)' like function. If cp_max_len is 1 * then assume cp is pointing to a null char and do nothing. Returns number -* number of chars placed in cp excluding the trailing null char. So for +* number of chars placed in cp excluding the trailing null char. For * cp_max_len > 0 the return value is always < cp_max_len; for cp_max_len * <= 0 the return value is 0 (and no chars are written to cp). */ int _libssh2_snprintf(char *cp, size_t cp_max_len, const char *fmt, ...) @@ -105,7 +105,7 @@ int _libssh2_error_flags(LIBSSH2_SESSION *session, int errcode, session->err_msg = copy; } else - /* Out of memory: this code path is very unlikely */ + /* Out of memory: this code path is unlikely */ session->err_msg = "former error forgotten (OOM)"; } else @@ -113,7 +113,7 @@ int _libssh2_error_flags(LIBSSH2_SESSION *session, int errcode, #ifdef LIBSSH2DEBUG if((errcode == LIBSSH2_ERROR_EAGAIN) && !session->api_block_mode) - /* if this is EAGAIN and we're in non-blocking mode, don't generate + /* if this is EAGAIN and we are in non-blocking mode, do not generate a debug output for this */ return errcode; _libssh2_debug((session, LIBSSH2_TRACE_ERROR, "%d - %s", session->err_code, @@ -143,8 +143,7 @@ int _libssh2_wsa2errno(void) default: /* It is most important to ensure errno does not stay at EAGAIN - * when a different error occurs so just set errno to a generic - * error */ + * when a different error occurs so set errno to a generic error */ return EIO; } } @@ -740,7 +739,7 @@ void _libssh2_list_insert(struct list_node *after, /* insert before this */ * This source code is offered for use in the public domain. You may * use, modify or distribute it freely. * - * This code is distributed in the hope that it will be useful but + * This code is distributed in the hope that it is useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/src/openssl.c b/src/openssl.c index 1a74b8cc..861d7a23 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -223,7 +223,7 @@ static unsigned char *write_bn(unsigned char *buf, const BIGNUM *bn, { unsigned char *p = buf; - /* Left space for bn size which will be written below. */ + /* Left space for bn size which is written below. */ p += 4; *p = 0; @@ -1093,7 +1093,7 @@ int _libssh2_cipher_crypt(libssh2_cipher_ctx *ctx, } } /* Copy en/decrypted data back to the caller. - The first aadlen should not be touched because they weren't + The first aadlen should not be touched because they were not encrypted and are unmodified. */ memcpy(block + aadlen, buf + aadlen, cryptlen); rc = !ret; @@ -3387,9 +3387,9 @@ int _libssh2_sha512(const unsigned char *message, size_t len, int _libssh2_md5_init(libssh2_md5_ctx *ctx) { /* MD5 digest is not supported in OpenSSL FIPS mode - * Trying to init it will result in a latent OpenSSL error: + * Trying to init it results in a latent OpenSSL error: * "digital envelope routines:FIPS_DIGESTINIT:disabled for fips" - * So, just return 0 in FIPS mode + * Thus, return 0 in FIPS mode */ #if !defined(USE_OPENSSL_3) && \ !defined(LIBRESSL_VERSION_NUMBER) && \ diff --git a/src/openssl.h b/src/openssl.h index 9a4e7511..258a366c 100644 --- a/src/openssl.h +++ b/src/openssl.h @@ -70,7 +70,7 @@ #define OPENSSL_NO_DES #endif -/* wolfSSL doesn't support Blowfish or CAST. */ +/* wolfSSL does not support Blowfish or CAST. */ #define OPENSSL_NO_BF #define OPENSSL_NO_CAST @@ -118,7 +118,7 @@ #if !defined(LIBRESSL_VERSION_NUMBER) || defined(LIBSSH2_WOLFSSL) || \ (defined(LIBRESSL_VERSION_NUMBER) && \ LIBRESSL_VERSION_NUMBER >= 0x3050000fL) -/* For wolfSSL, whether the structs are truly opaque or not, it's best to not +/* For wolfSSL, whether the structs are truly opaque or not, it is best to not * rely on their internal data members being exposed publicly. */ # define HAVE_OPAQUE_STRUCTS 1 #endif diff --git a/src/os400qc3.c b/src/os400qc3.c index 25b20487..1fc915ee 100644 --- a/src/os400qc3.c +++ b/src/os400qc3.c @@ -567,7 +567,7 @@ static char *getASN1Element(struct asn1Element *elem, char *beg, char *end) len = 0; do { if(len & 0xFF000000L) - return NULL; /* Lengths > 32 bits are not supported. */ + return NULL; /* Lengths > 32-bit are not supported. */ len = (len << 8) | (unsigned char)*beg++; } while(--b); } @@ -1732,7 +1732,7 @@ static int pkcs8kek(LIBSSH2_SESSION *session, struct os400qc3_crypto_ctx **ctx, Qc3_Format_ALGD0200_T algd; Qus_EC_t errcode; - /* Determine if the PKCS#8 data is encrypted and, if so, set-up a + /* Determine if the PKCS#8 data is encrypted and, if so, setup a key encryption key and algorithm in context. Return 1 if encrypted, 0, if not, -1 if error. */ @@ -1814,7 +1814,7 @@ static int pkcs8kek(LIBSSH2_SESSION *session, struct os400qc3_crypto_ctx **ctx, *ctx = NULL; return -1; } - return 1; /* Tell it's encrypted. */ + return 1; /* Tell it is encrypted. */ } static int rsapkcs8privkey(LIBSSH2_SESSION *session, diff --git a/src/packet.c b/src/packet.c index f97c0a83..bd6ae92d 100644 --- a/src/packet.c +++ b/src/packet.c @@ -248,7 +248,7 @@ static inline int packet_queue_listener( listen_state->state = libssh2_NB_state_sent; } - /* We're not listening to you */ + /* We are not listening to you */ p = listen_state->packet; *(p++) = SSH_MSG_CHANNEL_OPEN_FAILURE; _libssh2_store_u32(&p, listen_state->sender_channel); @@ -591,7 +591,7 @@ static inline int packet_authagent_open( /* Link the channel into the session */ _libssh2_list_add(&session->channels, &channel->node); - /* mess with stuff so we don't keep reading the same packet + /* mess with stuff so we do not keep reading the same packet over and over */ session->packet.total_num = 0; session->fullpacket_state = libssh2_NB_state_idle; @@ -634,10 +634,10 @@ authagent_exit: * Create a new packet and attach it to the brigade. Called from the transport * layer when it has received a packet. * - * The input pointer 'data' is pointing to allocated data that this function - * will be freed unless return the code is LIBSSH2_ERROR_EAGAIN. + * The input pointer 'data' is pointing to allocated data that in this function + * is freed unless return the code is LIBSSH2_ERROR_EAGAIN. * - * This function will always be called with 'datalen' greater than zero. + * This function is always called with 'datalen' greater than zero. */ int _libssh2_packet_add(LIBSSH2_SESSION *session, unsigned char *data, size_t datalen, int macstate, uint32_t seq) @@ -1005,7 +1005,7 @@ libssh2_packet_add_jump_point5: if((channelp->remote.extended_data_ignore_mode == LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE) && (msg == SSH_MSG_CHANNEL_EXTENDED_DATA)) { - /* Pretend we didn't receive this */ + /* Pretend we did not receive this */ LIBSSH2_FREE(session, data); _libssh2_debug((session, LIBSSH2_TRACE_CONN, @@ -1027,7 +1027,7 @@ libssh2_packet_add_jump_point5: session->packAdd_channelp = channelp; - /* Adjust the window based on the block we just freed */ + /* Adjust the window based on the block we freed */ libssh2_packet_add_jump_point1: session->packAdd_state = libssh2_NB_state_jump1; rc = _libssh2_channel_receive_window_adjust(session-> @@ -1079,7 +1079,7 @@ libssh2_packet_add_jump_point1: channelp->read_avail + data_head; } - /* Update the read_avail counter. The window size will be + /* Update the read_avail counter. The window size is * updated once the data is actually read from the queue * from an upper layer */ channelp->read_avail += datalen - data_head; @@ -1103,7 +1103,7 @@ libssh2_packet_add_jump_point1: _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(!channelp) - /* We may have freed already, just quietly ignore this... */ + /* We may have freed already, quietly ignore this... */ ; else { _libssh2_debug((session, LIBSSH2_TRACE_CONN, @@ -1163,7 +1163,8 @@ libssh2_packet_add_jump_point1: if(len == strlen("exit-status") && !memcmp("exit-status", request, strlen("exit-status"))) { - /* we've got "exit-status" packet. Set the session value */ + /* we have got "exit-status" packet. Set the session value. + */ if(datalen >= 20) channelp = _libssh2_channel_locate(session, channel); @@ -1264,7 +1265,7 @@ clean_exit: _libssh2_channel_locate(session, _libssh2_ntohu32(data + 1)); if(!channelp) { - /* We may have freed already, just quietly ignore this... */ + /* We may have freed already, quietly ignore this... */ LIBSSH2_FREE(session, data); session->packAdd_state = libssh2_NB_state_idle; return 0; @@ -1409,9 +1410,9 @@ libssh2_packet_add_jump_authagent: if(session->packAdd_state == libssh2_NB_state_sent1) { /* - * Remote wants new keys - * Well, it's already in the brigade, - * let's just call back into ourselves + * Remote wants new keys. + * It is already in the brigade, + * let's call back into ourselves */ _libssh2_debug((session, LIBSSH2_TRACE_TRANS, "Renegotiating Keys")); @@ -1434,8 +1435,8 @@ libssh2_packet_add_jump_authagent: sizeof(session->startup_key_state)); /* - * If there was a key reexchange failure, let's just hope we didn't - * send NEWKEYS yet, otherwise remote will drop us like a rock + * If there was a key reexchange failure, let's hope we did not + * send NEWKEYS yet, otherwise remote drops us like a rock */ rc = _libssh2_kex_exchange(session, 1, &session->startup_key_state); if(rc == LIBSSH2_ERROR_EAGAIN) @@ -1516,7 +1517,7 @@ int _libssh2_packet_askv(LIBSSH2_SESSION *session, /* * Loops _libssh2_transport_read() until the packet requested is available - * SSH_DISCONNECT or a SOCKET_DISCONNECTED will cause a bailout + * SSH_DISCONNECT or a SOCKET_DISCONNECTED causes a bailout * * Returns negative on error * Returns 0 when it has taken care of the requested packet. @@ -1549,7 +1550,7 @@ int _libssh2_packet_require(LIBSSH2_SESSION *session, return ret; else if(ret < 0) { state->start = 0; - /* an error which is not just because of blocking */ + /* an error which is not because of blocking */ return ret; } else if(ret == packet_type) { @@ -1638,8 +1639,8 @@ int _libssh2_packet_burn(LIBSSH2_SESSION *session, /* * Loops _libssh2_transport_read() until one of a list of packet types - * requested is available. SSH_DISCONNECT or a SOCKET_DISCONNECTED will cause - * a bailout. packet_types is a null terminated list of packet_type numbers + * requested is available. SSH_DISCONNECT or a SOCKET_DISCONNECTED causes + * a bailout. packet_types is a null-terminated list of packet_type numbers */ int _libssh2_packet_requirev(LIBSSH2_SESSION *session, const unsigned char *packet_types, diff --git a/src/publickey.c b/src/publickey.c index cefaf92b..58ef5a2f 100644 --- a/src/publickey.c +++ b/src/publickey.c @@ -45,7 +45,7 @@ #define LIBSSH2_PUBLICKEY_VERSION 2 -/* Numericised response codes -- Not IETF, just local representation */ +/* Numericised response codes -- Not IETF, but local representation */ #define LIBSSH2_PUBLICKEY_RESPONSE_STATUS 0 #define LIBSSH2_PUBLICKEY_RESPONSE_VERSION 1 #define LIBSSH2_PUBLICKEY_RESPONSE_PUBLICKEY 2 @@ -180,7 +180,7 @@ static int publickey_packet_receive(LIBSSH2_PUBLICKEY *pkey, /* * Translate a string response name to a numeric code - * Data will be incremented by 4 + response_len on success only + * Data is incremented by 4 + response_len on success only */ static int publickey_response_id(unsigned char **pdata, size_t data_len) { diff --git a/src/scp.c b/src/scp.c index 787b757c..a818b1be 100644 --- a/src/scp.c +++ b/src/scp.c @@ -58,7 +58,7 @@ /* This function quotes a string in a way suitable to be used with a - shell, e.g. the file name + shell, e.g. the filename one two becomes 'one two' @@ -318,7 +318,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, path_len = strlen(path); - /* no NUL-termination needed, so memcpy will do */ + /* no null-termination needed, so use memcpy */ memcpy(&session->scpRecv_command[cmd_len], path, path_len); cmd_len += path_len; } @@ -328,7 +328,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, session->scpRecv_command_len - cmd_len); } - /* the command to exec should _not_ be NUL-terminated */ + /* the command to exec should _not_ be null-terminated */ session->scpRecv_command_len = cmd_len; _libssh2_debug((session, LIBSSH2_TRACE_SCP, @@ -458,7 +458,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, err_msg, err_len); /* If it failed for any reason, we ignore it anyway. */ - /* zero terminate the error */ + /* null-terminate the error */ err_msg[err_len] = 0; _libssh2_debug((session, LIBSSH2_TRACE_SCP, "got %02x %s", @@ -503,7 +503,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, continue; } - /* We're guaranteed not to go under response_len == 0 by the + /* We are guaranteed not to go under response_len == 0 by the logic above */ while( (session->scpRecv_response[session->scpRecv_response_len - @@ -534,7 +534,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, } *(p++) = '\0'; - /* Make sure we don't get fooled by leftover values */ + /* Make sure we do not get fooled by leftover values */ session->scpRecv_mtime = strtol((char *)s, NULL, 10); s = (unsigned char *)strchr((char *)p, ' '); @@ -558,7 +558,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, } *p = '\0'; - /* Make sure we don't get fooled by leftover values */ + /* Make sure we do not get fooled by leftover values */ session->scpRecv_atime = strtol((char *)s, NULL, 10); /* SCP ACK */ @@ -659,7 +659,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, continue; } - /* We're guaranteed not to go under response_len == 0 by the + /* We are guaranteed not to go under response_len == 0 by the logic above */ while( (session->scpRecv_response[session->scpRecv_response_len - @@ -691,7 +691,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, } *(p++) = '\0'; - /* Make sure we don't get fooled by leftover values */ + /* Make sure we do not get fooled by leftover values */ session->scpRecv_mode = strtol(s, &e, 8); if(e && *e) { _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, @@ -710,7 +710,7 @@ static LIBSSH2_CHANNEL *scp_recv(LIBSSH2_SESSION *session, } *s = '\0'; - /* Make sure we don't get fooled by leftover values */ + /* Make sure we do not get fooled by leftover values */ session->scpRecv_size = scpsize_strtol(p, &e, 10); if(e && *e) { _libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL, @@ -879,7 +879,7 @@ static LIBSSH2_CHANNEL *scp_send(LIBSSH2_SESSION *session, path_len = strlen(path); - /* no NUL-termination needed, so memcpy will do */ + /* no null-termination needed, so use memcpy */ memcpy(&session->scpSend_command[cmd_len], path, path_len); cmd_len += path_len; } @@ -888,7 +888,7 @@ static LIBSSH2_CHANNEL *scp_send(LIBSSH2_SESSION *session, session->scpSend_command_len - cmd_len); } - /* the command to exec should _not_ be NUL-terminated */ + /* the command to exec should _not_ be null-terminated */ session->scpSend_command_len = cmd_len; _libssh2_debug((session, LIBSSH2_TRACE_SCP, diff --git a/src/session.c b/src/session.c index 231e7e35..4681c09c 100644 --- a/src/session.c +++ b/src/session.c @@ -205,7 +205,7 @@ static int banner_send(LIBSSH2_SESSION *session) if(session->banner_TxRx_state == libssh2_NB_state_idle) { if(session->local.banner) { - /* setopt_string will have given us our \r\n characters */ + /* setopt_string has given us our \r\n characters */ banner_len = strlen((char *)session->local.banner); banner = (char *)session->local.banner; } @@ -390,7 +390,7 @@ int libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner) memcpy(session->local.banner, banner, banner_len); - /* first zero terminate like this so that the debug output is nice */ + /* first null-terminate like this so that the debug output is nice */ session->local.banner[banner_len] = '\0'; _libssh2_debug((session, LIBSSH2_TRACE_TRANS, "Setting local Banner: %s", session->local.banner)); @@ -414,7 +414,7 @@ int libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner) /* * Allocate and initialize a libssh2 session structure. Allows for malloc - * callbacks in case the calling program has its own memory manager It's + * callbacks in case the calling program has its own memory manager. It is * allowable (but unadvisable) to define some but not all of the malloc * callbacks An additional pointer value may be optionally passed to be sent * to the callbacks (so they know who's asking) @@ -546,7 +546,7 @@ libssh2_cb_generic *libssh2_session_callback_set2(LIBSSH2_SESSION *session, * Returns the prior address * * ALERT: this function relies on that we can typecast function pointers - * to void pointers, which isn't allowed in ISO C! + * to void pointers, which is not allowed in ISO C! */ #ifdef _MSC_VER #pragma warning(push) @@ -602,7 +602,7 @@ int _libssh2_wait_socket(LIBSSH2_SESSION *session, time_t start_time) if(!dir) { _libssh2_debug((session, LIBSSH2_TRACE_SOCKET, "Nothing to wait for in wait_socket")); - /* To avoid that we hang below just because there's nothing set to + /* To avoid that we hang below because there is nothing set to wait for, we timeout on 1 second to also avoid busy-looping during this condition */ ms_to_next = 1000; @@ -841,7 +841,7 @@ static int session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock) return 0; } - /* just for safety return some error */ + /* for safety return some error */ return LIBSSH2_ERROR_INVAL; } @@ -1740,7 +1740,7 @@ int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout) } if(active_fds) { - /* Don't block on the sockets if we have channels/listeners which + /* Do not block on the sockets if we have channels/listeners which are ready */ timeout_remaining = 0; } @@ -1862,7 +1862,7 @@ int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout) } } #endif /* !HAVE_POLL && !HAVE_SELECT -- timeout (and by extension - * timeout_remaining) will be equal to 0 */ + * timeout_remaining) is equal to 0 */ } while((timeout_remaining > 0) && !active_fds); return active_fds; diff --git a/src/sftp.c b/src/sftp.c index b5e71372..b3f37850 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -51,10 +51,10 @@ /* This release of libssh2 implements Version 5 with automatic downgrade * based on server's declaration - * https://www.ietf.org/archive/id/draft-ietf-secsh-filexfer-05.txt + * https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-05 * * Version 6: - * https://www.ietf.org/archive/id/draft-ietf-secsh-filexfer-13.txt + * https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-13 */ /* SFTP packet types */ @@ -226,7 +226,7 @@ static int sftp_packet_add(LIBSSH2_SFTP *sftp, _libssh2_debug((session, LIBSSH2_TRACE_SFTP, "Received packet id %d", request_id)); - /* Don't add the packet if it answers a request we've given up on. */ + /* Do not add the packet if it answers a request we have given up on. */ if((data[0] == SSH_FXP_STATUS || data[0] == SSH_FXP_DATA) && find_zombie_request(sftp, request_id)) { @@ -289,10 +289,10 @@ static int sftp_packet_read(LIBSSH2_SFTP *sftp) LIBSSH2_FALLTHROUGH(); default: if(!packet) { - /* only do this if there's not already a packet buffer allocated + /* only do this if there is not already a packet buffer allocated to use */ - /* each packet starts with a 32 bit length field */ + /* each packet starts with a 32-bit length field */ rc = _libssh2_channel_read(channel, 0, (char *)&sftp->packet_header[ sftp->packet_header_len], @@ -314,7 +314,7 @@ static int sftp_packet_read(LIBSSH2_SFTP *sftp) packet_type = sftp->packet_header[4]; request_id = _libssh2_ntohu32(sftp->packet_header + 5); - /* make sure we don't proceed if the packet size is unreasonably + /* make sure we do not proceed if the packet size is unreasonably large */ if(sftp->partial_len > LIBSSH2_SFTP_PACKET_MAXLEN && /* exception: response to SSH_FXP_READDIR request */ @@ -404,7 +404,7 @@ window_adjust: return packet_type; } } - /* WON'T REACH */ + /* NOT REACHED */ } /* @@ -446,7 +446,7 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle) } /* - * Checks if there's a matching SFTP packet available. + * Checks if there is a matching SFTP packet available. */ static int sftp_packet_ask(LIBSSH2_SFTP *sftp, unsigned char packet_type, uint32_t request_id, @@ -600,7 +600,7 @@ static int sftp_packet_requirev(LIBSSH2_SFTP *sftp, int num_valid_responses, } /* - * Size that attr with this flagset will occupy when turned into a bin struct + * Size that attr with this flagset occupies when turned into a bin struct */ static int sftp_attrsize(unsigned long flags) { @@ -1256,8 +1256,8 @@ static LIBSSH2_SFTP_HANDLE *sftp_open(LIBSSH2_SFTP *sftp, return NULL; } - /* OPEN can basically get STATUS or HANDLE back, where HANDLE implies - a fine response while STATUS means error. It seems though that at + /* OPEN can get STATUS or HANDLE back, where HANDLE implies a fine + response while STATUS means error. It seems though that at times we get an SSH_FX_OK back in a STATUS, followed the "real" HANDLE so we need to properly deal with that. */ if(data[0] == SSH_FXP_STATUS) { @@ -1330,7 +1330,7 @@ static LIBSSH2_SFTP_HANDLE *sftp_open(LIBSSH2_SFTP *sftp, fp->handle_len = _libssh2_ntohu32(data + 5); if(fp->handle_len > SFTP_HANDLE_MAXLEN) - /* SFTP doesn't allow handles longer than 256 characters */ + /* SFTP does not allow handles longer than 256 characters */ fp->handle_len = SFTP_HANDLE_MAXLEN; if(fp->handle_len > (data_len - 9)) @@ -1425,10 +1425,10 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, libssh2_NB_state_idle: The first phase is where we prepare multiple FXP_READ packets to do optimistic read-ahead. We send off as many as possible in the second phase without waiting for a response to each - one; this is the key to fast reads. But we may have to adjust the - channel window size to do this which may interrupt this function while - waiting. The state machine saves the phase as libssh2_NB_state_idle so - it returns here on the next call. + one; this is the key to fast reads. We may have to adjust the channel + window size to do this which may interrupt this function while waiting. + The state machine saves the phase as libssh2_NB_state_idle so it + returns here on the next call. libssh2_NB_state_sent: The second phase is where we send the FXP_READ packets. Writing them to the channel can be interrupted with EAGAIN @@ -1446,8 +1446,8 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, sftp->last_errno = LIBSSH2_FX_OK; /* Some data may already have been read from the server in the - previous call but didn't fit in the buffer at the time. If so, we - return that now as we can't risk being interrupted later with data + previous call but did not fit in the buffer at the time. If so, we + return that now as we cannot risk being interrupted later with data partially written to the buffer. */ if(filep->data_left) { size_t copy = LIBSSH2_MIN(buffer_size, filep->data_left); @@ -1473,7 +1473,7 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, /* We allow a number of bytes being requested at any given time without having been acked - until we reach EOF. */ - /* Number of bytes asked for that haven't been acked yet */ + /* Number of bytes asked for that have not been acked yet */ size_t already = (size_t)(filep->offset_sent - filep->offset); size_t max_read_ahead = buffer_size * 4; @@ -1483,40 +1483,40 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, max_read_ahead = LIBSSH2_CHANNEL_WINDOW_DEFAULT * 4; /* if the buffer_size passed in now is smaller than what has - already been sent, we risk getting count become a very large + already been sent, we risk getting count become a large number */ if(max_read_ahead > already) count = max_read_ahead - already; /* 'count' is how much more data to ask for, and 'already' is how much data that already has been asked for but not yet returned. - Specifically, 'count' means how much data that have or will be - asked for by the nodes that are already added to the linked - list. Some of those read requests may not actually have been - sent off successfully yet. + Specifically, 'count' means how much data that have or is going + to be asked for by the nodes that are already added to the + linked list. Some of those read requests may not actually have + been sent off successfully yet. - If 'already' is very large it should be perfectly fine to have - count set to 0 as then we don't have to ask for more data + If 'already' is large it should be perfectly fine to have + count set to 0 as then we do not have to ask for more data (right now). - buffer_size*4 is just picked more or less out of the air. The + buffer_size*4 is picked more or less out of the air. The idea is that when reading SFTP from a remote server, we send - away multiple read requests guessing that the client will read - more than only this 'buffer_size' amount of memory. So we ask + away multiple read requests guessing that the client reads + more than only this 'buffer_size' amount of memory. We thus ask for maximum buffer_size*4 amount of data so that we can return - them very fast in subsequent calls. + them fast in subsequent calls. */ recv_window = libssh2_channel_window_read_ex(sftp->channel, NULL, NULL); if(max_read_ahead > recv_window) { - /* more data will be asked for than what the window currently + /* more data is asked for than what the window currently allows, expand it! */ rc = _libssh2_channel_receive_window_adjust(sftp->channel, (uint32_t)(max_read_ahead * 8), 1, NULL); - /* if this returns EAGAIN, we will get back to this function + /* if this returns EAGAIN, we get back to this function at next call */ assert(rc != LIBSSH2_ERROR_EAGAIN || !filep->data_left); assert(rc != LIBSSH2_ERROR_EAGAIN || !filep->eof); @@ -1577,8 +1577,8 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, sftp->read_state = libssh2_NB_state_idle; - /* move through the READ packets that haven't been sent and send as - many as possible - remember that we don't block */ + /* move through the READ packets that have not been sent and send as + many as possible - remember that we do not block */ chunk = _libssh2_list_first(&handle->packet_list); while(chunk) { @@ -1632,8 +1632,8 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, }; if(chunk->lefttosend) { - /* if the chunk still has data left to send, we shouldn't wait - for an ACK for it just yet */ + /* if the chunk still has data left to send, we should not wait + for an ACK for it yet */ if(bytes_in_buffer > 0) { return bytes_in_buffer; } @@ -1671,13 +1671,13 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, switch(data[0]) { case SSH_FXP_STATUS: - /* remove the chunk we just processed */ + /* remove the chunk we processed */ _libssh2_list_remove(&chunk->node); LIBSSH2_FREE(session, chunk); /* we must remove all outstanding READ requests, as either we - got an error or we're at end of file */ + got an error or we are at end of file */ sftp_packetlist_flush(handle); rc32 = _libssh2_ntohu32(data + 5); @@ -1696,9 +1696,9 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, case SSH_FXP_DATA: if(chunk->offset != filep->offset) { /* This could happen if the server returns less bytes than - requested, which shouldn't happen for normal files. See: - https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02 - #section-6.4 + requested, which should not happen for normal files. + See: + https://datatracker.ietf.org/doc/html/draft-ietf-secsh-filexfer-02#section-6.4 */ return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "Read Packet At Unexpected Offset"); @@ -1711,7 +1711,7 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, if(rc32 > chunk->len) { /* A chunk larger than we requested was returned to us. - This is a protocol violation and we don't know how to + This is a protocol violation and we do not know how to deal with it. Bail out! */ return _libssh2_error(session, LIBSSH2_ERROR_SFTP_PROTOCOL, "FXP_READ response too big"); @@ -1750,7 +1750,7 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE *handle, /* free the allocated data if not stored to keep */ LIBSSH2_FREE(session, data); - /* remove the chunk we just processed keeping track of the + /* remove the chunk we processed keeping track of the * next one in case we need it */ next = _libssh2_list_next(&chunk->node); _libssh2_list_remove(&chunk->node); @@ -1859,7 +1859,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, if(buffer_maxlen >= filename_len && names_packet_len >= filename_len) { memcpy(buffer, s, filename_len); - buffer[filename_len] = '\0'; /* zero terminate */ + buffer[filename_len] = '\0'; /* null-terminate */ s += real_filename_len; names_packet_len -= real_filename_len; } @@ -1888,7 +1888,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, } memcpy(longentry, s, longentry_len); - longentry[longentry_len] = '\0'; /* zero terminate */ + longentry[longentry_len] = '\0'; /* null-terminate */ } if(real_longentry_len <= names_packet_len) { @@ -2043,7 +2043,7 @@ int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, * Write data to an SFTP handle. Returns the number of bytes written, or * a negative error code. * - * We recommend sending very large data buffers to this function! + * We recommend sending large data buffers to this function! * * Concept: * @@ -2057,7 +2057,7 @@ int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, * * - Add all created outgoing packets to the linked list. * - * - Walk through the list and send the chunks that haven't been sent, + * - Walk through the list and send the chunks that have not been sent, * as many as possible until EAGAIN. Some of the chunks may have been put * in the list in a previous invoke. * @@ -2072,7 +2072,7 @@ int libssh2_sftp_readdir_ex(LIBSSH2_SFTP_HANDLE *handle, * * TODO: * Introduce an option that disables this sort of "speculative" ahead writing - * as there's a risk that it will do harm to some app. + * as there is a risk that it does harm to some app. */ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, @@ -2097,11 +2097,11 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, case libssh2_NB_state_idle: sftp->last_errno = LIBSSH2_FX_OK; - /* Number of bytes sent off that haven't been acked and therefore we - will get passed in here again. + /* Number of bytes sent off that have not been acked and therefore we + get passed in here again. Also, add up the number of bytes that actually already have been - acked but we haven't been able to return as such yet, so we will + acked but we have not been able to return as such yet, so we get that data as well passed in here again. */ already = (size_t)(handle->u.file.offset_sent - @@ -2118,8 +2118,8 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, sftp->write_state = libssh2_NB_state_idle; while(count) { - /* TODO: Possibly this should have some logic to prevent a very - very small fraction to be left but lets ignore that for now */ + /* TODO: Possibly this should have some logic to prevent a tiny + fraction to be left but lets ignore that for now */ uint32_t size = (uint32_t)(LIBSSH2_MIN(MAX_SFTP_OUTGOING_SIZE, count)); uint32_t request_id; @@ -2158,8 +2158,8 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, to create more packets */ } - /* move through the WRITE packets that haven't been sent and send as - many as possible - remember that we don't block */ + /* move through the WRITE packets that have not been sent and send as + many as possible - remember that we do not block */ chunk = _libssh2_list_first(&handle->packet_list); while(chunk) { @@ -2196,8 +2196,8 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, while(chunk) { if(chunk->lefttosend) - /* if the chunk still has data left to send, we shouldn't wait - for an ACK for it just yet */ + /* if the chunk still has data left to send, we should not wait + for an ACK for it yet */ break; else if(acked) @@ -2243,7 +2243,7 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, /* flush all pending packets from the outgoing list */ sftp_packetlist_flush(handle); - /* since we return error now, the application will not get any + /* since we return error now, the application does not get any outstanding data acked, so we need to rewind the offset to where the application knows it has reached with acked data */ @@ -2265,7 +2265,7 @@ static ssize_t sftp_write(LIBSSH2_SFTP_HANDLE *handle, const char *buffer, break; } - /* if there were acked data in a previous call that wasn't returned then, + /* if there were acked data in a previous call that was not returned then, add that up and try to return it all now. This can happen if the app first sends a huge buffer of data, and then in a second call it sends a smaller one. */ @@ -2571,7 +2571,7 @@ size_t libssh2_sftp_tell(LIBSSH2_SFTP_HANDLE *handle) if(!handle) return 0; /* no handle, no size */ - /* NOTE: this may very well truncate the size if it is larger than what + /* NOTE: this may well truncate the size if it is larger than what size_t can hold, so libssh2_sftp_tell64() is really the function you should use */ return (size_t)(handle->u.file.offset); diff --git a/src/sftp.h b/src/sftp.h index 3d244358..2f29d543 100644 --- a/src/sftp.h +++ b/src/sftp.h @@ -75,7 +75,7 @@ struct sftp_packet { size_t data_len; /* payload size */ }; -/* Increasing from 256 to 4092 since OpenSSH doesn't honor it. */ +/* Increasing from 256 to 4092 since OpenSSH does not honor it. */ #define SFTP_HANDLE_MAXLEN 4092 /* according to spec, this should be 256! */ struct _LIBSSH2_SFTP_HANDLE { @@ -95,11 +95,11 @@ struct _LIBSSH2_SFTP_HANDLE { struct libssh2_sftp_handle_file_data { libssh2_uint64_t offset; libssh2_uint64_t offset_sent; - size_t acked; /* container for acked data that hasn't been + size_t acked; /* container for acked data that has not been returned to caller yet, used for sftp_write */ /* 'data' is used by sftp_read() and is allocated data that has - been received already from the server but wasn't returned to + been received already from the server but was not returned to the caller yet. It is of size 'data_len' and 'data_left is the number of bytes not yet returned, counted from the end of the buffer. */ @@ -155,7 +155,7 @@ struct _LIBSSH2_SFTP { /* State variables used in libssh2_sftp_open_ex() */ libssh2_nonblocking_states open_state; unsigned char *open_packet; - uint32_t open_packet_len; /* 32 bit on the wire */ + uint32_t open_packet_len; /* 32-bit on the wire */ size_t open_packet_sent; uint32_t open_request_id; diff --git a/src/transport.c b/src/transport.c index 954e3ab5..8ae661ff 100644 --- a/src/transport.c +++ b/src/transport.c @@ -127,9 +127,9 @@ static int decrypt(LIBSSH2_SESSION *session, unsigned char *source, struct transportpacket *p = &session->packet; int blocksize = session->remote.crypt->blocksize; - /* if we get called with a len that isn't an even number of blocksizes + /* if we get called with a len that is not an even number of blocksizes we risk losing those extra bytes. AAD is an exception, since those first - few bytes aren't encrypted so it throws off the rest of the count. */ + few bytes are not encrypted so it throws off the rest of the count. */ if(!CRYPT_FLAG_R(session, PKTLEN_AAD)) assert((len % blocksize) == 0); @@ -138,8 +138,8 @@ static int decrypt(LIBSSH2_SESSION *session, unsigned char *source, ssize_t decryptlen = LIBSSH2_MIN(blocksize, len); /* The first block is special (since it needs to be decoded to get the length of the remainder of the block) and takes priority. When the - length finally gets to the last blocksize bytes, and there's no - more data to come, it's the end. */ + length finally gets to the last blocksize bytes, and there is no + more data to come, it is the end. */ int lowerfirstlast = IS_FIRST(firstlast) ? FIRST_BLOCK : ((len <= blocksize) ? firstlast : MIDDLE_BLOCK); /* If the last block would be less than a whole blocksize, combine it @@ -160,7 +160,7 @@ static int decrypt(LIBSSH2_SESSION *session, unsigned char *source, } /* if the crypt() function would write to a given address it - wouldn't have to memcpy() and we could avoid this memcpy() + would not have to memcpy() and we could avoid this memcpy() too */ memcpy(dest, source, decryptlen); @@ -218,8 +218,8 @@ static int fullpacket(LIBSSH2_SESSION *session, int encrypted /* 1 or 0 */) &session->remote.mac_abstract); } - /* Compare the calculated hash with the MAC we just read from - * the network. The read one is at the very end of the payload + /* Compare the calculated hash with the MAC we read from + * the network. The read one is at the end of the payload * buffer. Note that 'payload_len' here is the packet_length * field which includes the padding but not the MAC. */ @@ -393,20 +393,20 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) /* * All channels, systems, subsystems, etc eventually make it down here * when looking for more incoming data. If a key exchange is going on - * (LIBSSH2_STATE_EXCHANGING_KEYS bit is set) then the remote end will - * ONLY send key exchange related traffic. In non-blocking mode, there is + * (LIBSSH2_STATE_EXCHANGING_KEYS bit is set) then the remote end + * ONLY sends key exchange related traffic. In non-blocking mode, there is * a chance to break out of the kex_exchange function with an EAGAIN * status, and never come back to it. If LIBSSH2_STATE_EXCHANGING_KEYS is * active, then we must redirect to the key exchange. However, if * kex_exchange is active (as in it is the one that calls this execution - * of packet_read, then don't redirect, as that would be an infinite loop! + * of packet_read, then do not redirect, as that would be an infinite loop! */ if(session->state & LIBSSH2_STATE_EXCHANGING_KEYS && !(session->state & LIBSSH2_STATE_KEX_ACTIVE)) { - /* Whoever wants a packet won't get anything until the key re-exchange - * is done! + /* Whoever wants a packet does not get anything until the key + * re-exchange is done! */ _libssh2_debug((session, LIBSSH2_TRACE_TRANS, "Redirecting into the" " key re-exchange from _libssh2_transport_read")); @@ -417,7 +417,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) /* * =============================== NOTE =============================== - * I know this is very ugly and not a really good use of "goto", but + * I know this is ugly and not a really good use of "goto", but * this case statement would be even uglier to do it any other way */ if(session->readPack_state == libssh2_NB_state_jump1) { @@ -453,9 +453,9 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) etm = encrypted && remote_mac ? remote_mac->etm : 0; /* read/use a whole big chunk into a temporary area stored in - the LIBSSH2_SESSION struct. We will decrypt data from that - buffer into the packet buffer so this temp one doesn't have - to be able to keep a whole SSH packet, just be large enough + the LIBSSH2_SESSION struct. We decrypt data from that + buffer into the packet buffer so this temp one does not have + to be able to keep a whole SSH packet, be large enough so that we can read big chunks from the network layer. */ /* how much data there is remaining in the buffer to deal with @@ -480,7 +480,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) p->writeidx = remainbuf; } else { - /* nothing to move, just zero the indexes */ + /* nothing to move, zero the indexes */ p->readidx = p->writeidx = 0; } @@ -587,7 +587,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) memcpy(p->init, block, 5); } else { - /* the data is plain, just copy it verbatim to + /* the data is plain, copy it verbatim to the working block buffer */ memcpy(block, &p->buf[p->readidx], blocksize); } @@ -610,7 +610,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) } if(etm) { - /* don't know what padding is until we decrypt the full + /* do not know what padding is until we decrypt the full packet */ p->padding_length = 0; @@ -621,7 +621,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) } else { /* padding_length has not been authenticated yet, but it - won't actually be used (except for the sanity check + is not actually used (except for the sanity check immediately following) until after the entire packet is authenticated, so this is safe. */ p->padding_length = block[4]; @@ -640,7 +640,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) length is not required for decryption */ /* add size field to be included in total packet size - * calculation so it doesn't get dropped off on subsequent + * calculation so it does not get dropped off on subsequent * partial reads */ total_num = 4; @@ -656,7 +656,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) total_num += p->packet_length + (remote_mac ? remote_mac->mac_len : 0) + auth_len; - /* don't know what padding is until we decrypt the full + /* do not know what padding is until we decrypt the full packet */ p->padding_length = 0; } @@ -713,7 +713,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) numbytes -= blocksize; } else { - /* haven't started reading payload yet */ + /* have not started reading payload yet */ p->data_num = 0; /* we already dealt with packet size worth of data */ @@ -748,7 +748,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) if(encrypted && !etm) { /* At the end of the incoming stream, there is a MAC, - and we don't want to decrypt that since we need it + and we do not want to decrypt that since we need it "raw". We MUST however decrypt the padding data since it is used for the hash later on. */ int skip = (remote_mac ? remote_mac->mac_len : 0) + auth_len; @@ -813,8 +813,8 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) memcpy(p->wptr, &p->buf[p->readidx], numbytes); - /* advance read index past size field now that we've decrypted - full packet */ + /* advance read index past size field now that we have + decrypted full packet */ p->readidx += 4; /* include auth tag in bytes decrypted */ @@ -849,7 +849,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) numbytes -= numdecrypt; } - /* if there are bytes to copy that aren't decrypted, + /* if there are bytes to copy that are not decrypted, copy them as-is to the target buffer */ if(numbytes > 0) { @@ -871,7 +871,7 @@ int _libssh2_transport_read(LIBSSH2_SESSION *session) p->data_num += numbytes; } - /* now check how much data there's left to read to finish the + /* now check how much data there is left to read to finish the current packet */ remainpack = p->total_num - p->data_num; @@ -922,8 +922,8 @@ static int send_existing(LIBSSH2_SESSION *session, const unsigned char *data, /* send as much as possible of the existing packet */ if((data != p->odata) || (data_len != p->olen)) { /* When we are about to complete the sending of a packet, it is vital - that the caller doesn't try to send a new/different packet since - we don't add this one up until the previous one has been sent. To + that the caller does not try to send a new/different packet since + we do not add this one up until the previous one has been sent. To make the caller really notice his/hers flaw, we return error for this case */ _libssh2_debug((session, LIBSSH2_TRACE_SOCKET, @@ -955,7 +955,7 @@ static int send_existing(LIBSSH2_SESSION *session, const unsigned char *data, p->ototal_num = 0; p->olen = 0; /* we leave *ret set so that the parent returns as we MUST return back - a send success now, so that we don't risk sending EAGAIN later + a send success now, so that we do not risk sending EAGAIN later which then would confuse the parent function */ return LIBSSH2_ERROR_NONE; } @@ -1025,7 +1025,7 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, */ if(session->state & LIBSSH2_STATE_EXCHANGING_KEYS && !(session->state & LIBSSH2_STATE_KEX_ACTIVE)) { - /* Don't write any new packets if we're still in the middle of a key + /* Do not write any new packets if we are still in the middle of a key * exchange. */ _libssh2_debug((session, LIBSSH2_TRACE_TRANS, "Redirecting into the" " key re-exchange from _libssh2_transport_send")); @@ -1069,8 +1069,8 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, if(encrypted && compressed && session->local.comp_abstract) { /* the idea here is that these function must fail if the output gets - larger than what fits in the assigned buffer so thus they don't - check the input size as we don't know how much it compresses */ + larger than what fits in the assigned buffer so thus they do not + check the input size as we do not know how much it compresses */ size_t dest_len = MAX_SSH_PACKET_LEN - 5 - 256; size_t dest2_len = dest_len; @@ -1136,7 +1136,7 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, padding_length = blocksize - ((packet_length - crypt_offset) % blocksize); /* if the padding becomes too small we add another blocksize worth - of it (taken from the original libssh2 where it didn't have any + of it (taken from the original libssh2 where it did not have any real explanation) */ if(padding_length < 4) { padding_length += blocksize; @@ -1212,14 +1212,14 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, size_t bsize = LIBSSH2_MIN(session->local.crypt->blocksize, (int)(packet_length - i)); /* The INTEGRATED_MAC case always has an extra call below, so - it will never be LAST_BLOCK up here. */ + it never is LAST_BLOCK up here. */ int firstlast = i == 0 ? FIRST_BLOCK : (!CRYPT_FLAG_L(session, INTEGRATED_MAC) && (i == packet_length - session->local.crypt->blocksize) ? LAST_BLOCK : MIDDLE_BLOCK); /* In the AAD case, the last block would be only 4 bytes because everything is offset by 4 since the initial - packet_length isn't encrypted. In this case, combine that + packet_length is not encrypted. In this case, combine that last short packet with the previous one since AES-GCM crypt() assumes that the entire MAC is available in that packet so it can set that to the authentication tag. */ diff --git a/src/transport.h b/src/transport.h index f8e8e8e7..68d50897 100644 --- a/src/transport.h +++ b/src/transport.h @@ -74,7 +74,7 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, * to wait for a packet to start. * * Returns packet type added to input brigade (PACKET_NONE if nothing added), - * or PACKET_FAIL on failure and PACKET_EAGAIN if it couldn't process a full + * or PACKET_FAIL on failure and PACKET_EAGAIN if it could not process a full * packet. */ diff --git a/src/userauth.c b/src/userauth.c index 49efca1e..3b1a58ea 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -66,9 +66,9 @@ /* * List authentication methods - * Will yield successful login if "none" happens to be allowable for this user + * Yields successful login if "none" happens to be allowable for this user * Not a common configuration for any SSH server though - * username should be NULL, or a null terminated string + * username should be NULL, or a null-terminated string */ static char *userauth_list(LIBSSH2_SESSION *session, const char *username, unsigned int username_len) @@ -254,9 +254,9 @@ static char *userauth_list(LIBSSH2_SESSION *session, const char *username, /* * List authentication methods - * Will yield successful login if "none" happens to be allowable for this user + * Yields successful login if "none" happens to be allowable for this user * Not a common configuration for any SSH server though - * username should be NULL, or a null terminated string + * username should be NULL, or a null-terminated string */ LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session, @@ -633,7 +633,7 @@ static int memory_read_publickey(LIBSSH2_SESSION *session, sp2 = memchr(sp1, ' ', pubkey_len - (sp1 - pubkey)); if(!sp2) { - /* Assume that the id string is missing, but that it's okay */ + /* Assume that the id string is missing, but that it is okay */ sp2 = pubkey + pubkey_len; } @@ -644,8 +644,8 @@ static int memory_read_publickey(LIBSSH2_SESSION *session, "Invalid key data, not base64 encoded"); } - /* Wasting some bytes here (okay, more than some), but since it's likely - * to be freed soon anyway, we'll just avoid the extra free/alloc and call + /* Wasting some bytes here (okay, more than some), but since it is likely + * to be freed soon anyway, we avoid the extra free/alloc and call * it a wash */ *method = pubkey; @@ -735,7 +735,7 @@ static int file_read_publickey(LIBSSH2_SESSION *session, sp_len = sp1 > pubkey ? (sp1 - pubkey) : 0; sp2 = memchr(sp1, ' ', pubkey_len - sp_len); if(!sp2) { - /* Assume that the id string is missing, but that it's okay */ + /* Assume that the id string is missing, but that it is okay */ sp2 = pubkey + pubkey_len; } @@ -746,8 +746,8 @@ static int file_read_publickey(LIBSSH2_SESSION *session, "Invalid key data, not base64 encoded"); } - /* Wasting some bytes here (okay, more than some), but since it's likely - * to be freed soon anyway, we'll just avoid the extra free/alloc and call + /* Wasting some bytes here (okay, more than some), but since it is likely + * to be freed soon anyway, we avoid the extra free/alloc and call * it a wash */ *method = pubkey; *method_len = sp1 - pubkey - 1; @@ -1112,8 +1112,8 @@ static int userauth_hostbased_fromfile(LIBSSH2_SESSION *session, local_username_len + pubkeydata_len + 52; /* - * Preallocate space for an overall length, method name again, - * and the signature, which won't be any larger than the size of + * Preallocate space for an overall length, method name again, + * and the signature, which is not any larger than the size of * the publickeydata itself */ session->userauth_host_s = session->userauth_host_packet = @@ -1271,7 +1271,7 @@ static int userauth_hostbased_fromfile(LIBSSH2_SESSION *session, if(session->userauth_host_data[0] == SSH_MSG_USERAUTH_SUCCESS) { _libssh2_debug((session, LIBSSH2_TRACE_AUTH, "Hostbased authentication successful")); - /* We are us and we've proved it. */ + /* We are us and we have proved it. */ LIBSSH2_FREE(session, session->userauth_host_data); session->userauth_host_data = NULL; session->state |= LIBSSH2_STATE_AUTHENTICATED; @@ -1394,7 +1394,7 @@ static int is_version_less_than_78(const char *version) /** * @abstract Upgrades the algorithm used for public key signing RFC 8332 * @discussion Based on the incoming key_method value, this function - * will upgrade the key method input based on user preferences, + * Upgrades the key method input based on user preferences, * server support algos and crypto backend support * @related _libssh2_supported_key_sign_algorithms() * @param key_method current key method, usually the default key sig method @@ -1662,11 +1662,11 @@ retry_auth: /* * Preallocate space for an overall length, method name again, and the - * signature, which won't be any larger than the size of the + * signature, which is not any larger than the size of the * publickeydata itself. * - * Note that the 'pubkeydata_len' extra bytes allocated here will not - * be used in this first send, but will be used in the later one where + * Note that the 'pubkeydata_len' extra bytes allocated here are not + * used in this first send, but are used in the later one where * this same allocation is reused. */ s = session->userauth_pblc_packet = @@ -1834,7 +1834,7 @@ retry_auth: /* * If this function was restarted, pubkeydata_len might still be 0 - * which will cause an unnecessary but harmless realloc here. + * which causes an unnecessary but harmless realloc here. */ if(sig_len > pubkeydata_len) { unsigned char *newpacket; @@ -1943,7 +1943,7 @@ retry_auth: if(session->userauth_pblc_data[0] == SSH_MSG_USERAUTH_SUCCESS) { _libssh2_debug((session, LIBSSH2_TRACE_AUTH, "Publickey authentication successful")); - /* We are us and we've proved it. */ + /* We are us and we have proved it. */ LIBSSH2_FREE(session, session->userauth_pblc_data); session->userauth_pblc_data = NULL; session->state |= LIBSSH2_STATE_AUTHENTICATED; @@ -2185,7 +2185,7 @@ static int userauth_keyboard_interactive( session->userauth_kybd_packet_len = 1 /* byte SSH_MSG_USERAUTH_REQUEST */ - + 4 + username_len /* string user name (ISO-10646 UTF-8, as + + 4 + username_len /* string username (ISO-10646 UTF-8, as defined in [RFC-3629]) */ + 4 + 14 /* string service name (US-ASCII) */ + 4 + 20 /* string "keyboard-interactive" (US-ASCII) */ @@ -2204,7 +2204,7 @@ static int userauth_keyboard_interactive( *s++ = SSH_MSG_USERAUTH_REQUEST; - /* user name */ + /* username */ _libssh2_store_str(&s, username, username_len); /* service name */ @@ -2375,7 +2375,7 @@ static int userauth_keyboard_interactive( cleanup: /* - * It's safe to clean all the data here, because unallocated pointers + * It is safe to clean all the data here, because unallocated pointers * are filled by zeroes */ diff --git a/src/wincng.c b/src/wincng.c index e91ee947..d02db1df 100644 --- a/src/wincng.c +++ b/src/wincng.c @@ -2000,7 +2000,7 @@ static int wincng_p1363signature_from_point(IN const unsigned char *r, s_trimmed_len--; } - /* Validate r and s will fit into signature */ + /* Validate r and s fits into signature */ if(r_trimmed_len > *signature_length / 2 || s_trimmed_len > *signature_length / 2) { return LIBSSH2_ERROR_INVAL; @@ -2495,7 +2495,7 @@ int _libssh2_wincng_ecdh_gen_k( goto cleanup; } - /* And populate the secret bignum */ + /* Populate the secret bignum */ status = BCryptDeriveKey( agreed_secret_handle, BCRYPT_KDF_RAW_SECRET, @@ -2878,13 +2878,13 @@ int _libssh2_wincng_ecdsa_new_private_frommemory( data_buffer.dataptr = data_buffer.data + strlen(OPENSSL_PRIVATEKEY_AUTH_MAGIC) + 1; - /* Read ciphername, should be 'none' as we don't support passphrases */ + /* Read ciphername, should be 'none' as we do not support passphrases */ result = _libssh2_match_string(&data_buffer, "none"); if(result != LIBSSH2_ERROR_NONE) { goto cleanup; } - /* Read kdfname, should be 'none' as we don't support passphrases */ + /* Read kdfname, should be 'none' as we do not support passphrases */ result = _libssh2_match_string(&data_buffer, "none"); if(result != LIBSSH2_ERROR_NONE) { goto cleanup; @@ -3523,7 +3523,7 @@ void _libssh2_dh_dtor(struct wincng_dh_ctx *dhctx) } if(dhctx->dh_params) { /* Since public dh_params are shared in clear text, - * we don't need to securely zero them out here */ + * we do not need to securely zero them out here */ free(dhctx->dh_params); dhctx->dh_params = NULL; } @@ -3598,7 +3598,7 @@ int _libssh2_dh_key_pair(struct wincng_dh_ctx *dhctx, libssh2_bn *public, free(dh_params); } else { - /* Pass ownership to dhctx; these parameters will be freed when + /* Pass ownership to dhctx; these parameters are freed when * the context is destroyed. We need to keep the parameters more * easily available so that we have access to the `g` value when * _libssh2_dh_secret() is called later. */ @@ -3808,7 +3808,7 @@ int _libssh2_dh_secret(struct wincng_dh_ctx *dhctx, libssh2_bn *secret, goto out; } - /* And populate the secret bignum */ + /* Populate the secret bignum */ status = BCryptDeriveKey(agreement, BCRYPT_KDF_RAW_SECRET, NULL, secret->bignum, secret_len_bytes, &secret_len_bytes, 0); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 709097f2..eabf68ef 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -87,7 +87,7 @@ foreach(_test IN LISTS DOCKER_TESTS STANDALONE_TESTS SSHD_TESTS) message(STATUS "Skip test requiring static libssh2 lib: ${_test}") endif() - # We support the same target as both Docker and SSHD test. Build those just once. + # We support the same target as both Docker and SSHD test. Build those only once. # Skip building tests that require the static lib when the static lib is not built. if(NOT TARGET ${_test} AND _lib_for_tests) add_executable(${_test} "${_test}.c") diff --git a/tests/openssh_fixture.c b/tests/openssh_fixture.c index cad486c7..2837e76f 100644 --- a/tests/openssh_fixture.c +++ b/tests/openssh_fixture.c @@ -250,7 +250,7 @@ static int is_running_inside_a_container(void) int found = 0; f = fopen(cgroup_filename, "r"); if(!f) { - /* Don't go further, we are not in a container */ + /* Do not go further, we are not in a container */ return 0; } while(fgets(line, sizeof(line), f)) { @@ -390,7 +390,7 @@ static libssh2_socket_t open_socket_to_container(char *container_id) } /* 0.0.0.0 is returned by Docker for Windows, because the container - is reachable from anywhere. But we cannot connect to 0.0.0.0, + is reachable from anywhere. We cannot connect to 0.0.0.0, instead we assume localhost and try to connect to 127.0.0.1. */ if(ip_address && strcmp(ip_address, "0.0.0.0") == 0) { free(ip_address); diff --git a/tests/ossfuzz/ssh2_client_fuzzer.cc b/tests/ossfuzz/ssh2_client_fuzzer.cc index a49016aa..417ef710 100644 --- a/tests/ossfuzz/ssh2_client_fuzzer.cc +++ b/tests/ossfuzz/ssh2_client_fuzzer.cc @@ -44,11 +44,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) written = send(socket_fds[1], data, size, 0); if(written != (ssize_t)size) { - /* Handle whatever error case we're in. */ + /* Handle whatever error case we are in. */ fprintf(stderr, "send() of %zu bytes returned %zu (%d)\n", - size, - written, - errno); + size, written, errno); goto EXIT_LABEL; } diff --git a/tests/ossfuzz/standaloneengine.cc b/tests/ossfuzz/standaloneengine.cc index b7525e11..e13e153b 100644 --- a/tests/ossfuzz/standaloneengine.cc +++ b/tests/ossfuzz/standaloneengine.cc @@ -47,7 +47,7 @@ int main(int argc, char **argv) printf("complete."); - /* Free the buffer as it's no longer needed. */ + /* Free the buffer as it is no longer needed. */ free(buffer); buffer = NULL; } @@ -58,7 +58,7 @@ int main(int argc, char **argv) buffer_len); } - /* Close the file as it's no longer needed. */ + /* Close the file as it is no longer needed. */ fclose(infile); infile = NULL; } diff --git a/tests/session_fixture.c b/tests/session_fixture.c index e84e3db6..65d4b720 100644 --- a/tests/session_fixture.c +++ b/tests/session_fixture.c @@ -75,7 +75,7 @@ static int connect_to_server(void) static char const *skip_crypt[] = { #ifdef LIBSSH2_MBEDTLS /* Due to a bug with mbedTLS support, these crypt methods fail. - Until that bug is fixed, don't run them there to avoid this + Until that bug is fixed, do not run them there to avoid this known issue causing red tests. See: https://github.com/libssh2/libssh2/issues/793 */ diff --git a/tests/test_auth_keyboard_info_request.c b/tests/test_auth_keyboard_info_request.c index b7bf3c84..5c885370 100644 --- a/tests/test_auth_keyboard_info_request.c +++ b/tests/test_auth_keyboard_info_request.c @@ -178,7 +178,7 @@ static const struct test_case test_cases[TEST_CASES_LEN] = { "\0\0\0\x0aPassword: \0" "\0\0\0\x07Token: \1", 44, { FAIL, -6, "Unable to decode keyboard-interactive prompt message" } }, - /* overflow language on 32 bit platform */ + /* overflow language on 32-bit platform */ { "<" "\0\0\0\x19" diff --git a/tests/test_read.c b/tests/test_read.c index db06434b..7562bf25 100644 --- a/tests/test_read.c +++ b/tests/test_read.c @@ -107,7 +107,7 @@ int test(LIBSSH2_SESSION *session) for(i = 0; i < (unsigned long)err; ++i) { if(buf[i]) { fprintf(stderr, "Bad data received\n"); - /* Test will fail below due to bad data length */ + /* Test fails below due to bad data length */ break; } } diff --git a/tests/test_ssh2.c b/tests/test_ssh2.c index 557b2344..df74abb6 100644 --- a/tests/test_ssh2.c +++ b/tests/test_ssh2.c @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) goto shutdown; } - /* Create a session instance and start it up. This will trade welcome + /* Create a session instance and start it up. This trades welcome * banners, exchange keys, and setup crypto, compression, and MAC layers */ session = libssh2_session_init(); @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) /* At this point we have not yet authenticated. The first thing to do * is check the hostkey's fingerprint against our known hosts Your app * may have it hard coded, may go to a file, may present it to the - * user, that's your call + * user, that is your call */ fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1); fprintf(stderr, "Fingerprint: "); @@ -222,7 +222,7 @@ int main(int argc, char *argv[]) } /* Some environment variables may be set, - * It's up to the server which ones it'll allow though + * It is up to the server which ones it allows though */ libssh2_channel_setenv(channel, "FOO", "bar"); diff --git a/vms/libssh2_config.h b/vms/libssh2_config.h index 2cbe78a7..208490b6 100644 --- a/vms/libssh2_config.h +++ b/vms/libssh2_config.h @@ -54,8 +54,8 @@ typedef unsigned int socklen_t; /* missing in headers on VMS */ * #define SS_ISCONNECTED 0x002 socket connected to a peer * #define SS_ISCONNECTING 0x004 in process of connecting to peer * #define SS_ISDISCONNECTING 0x008 in process of disconnecting - * #define SS_CANTSENDMORE 0x010 can't send more data to peer - * #define SS_CANTRCVMORE 0x020 can't receive more data from peer + * #define SS_CANTSENDMORE 0x010 cannot send more data to peer + * #define SS_CANTRCVMORE 0x020 cannot receive more data from peer * #define SS_RCVATMARK 0x040 at mark on input * #define SS_PRIV 0x080 privileged for broadcast, raw... * #define SS_NBIO 0x100 non-blocking ops diff --git a/vms/libssh2_make_example.dcl b/vms/libssh2_make_example.dcl index c6185256..528f8107 100644 --- a/vms/libssh2_make_example.dcl +++ b/vms/libssh2_make_example.dcl @@ -98,7 +98,7 @@ $ else $ what = f$parse(what,,,"name") $ if f$search("exadir:''what'.c") .eqs. "" $ then -$ write sys$output "Can't make ''what'" +$ write sys$output "Cannot make ''what'" $ init_status = 0 $ endif $ endif diff --git a/vms/libssh2_make_kit.dcl b/vms/libssh2_make_kit.dcl index b1a03529..89af95bf 100644 --- a/vms/libssh2_make_kit.dcl +++ b/vms/libssh2_make_kit.dcl @@ -213,12 +213,12 @@ $ write pt "=prompt Release notes and the libssh2 help library are available in $ write pt "" $ write pt "1 EXAMPLE" $ write pt "=prompt Do you want the libssh2 C programming examples ? " -$ write pt "The libssh2 coding examples will be available in backup saveset " +$ write pt "The libssh2 coding examples are available in backup saveset " $ write pt "[gnv.usr.share.doc.libssh2.examples]libssh2_examples_''versionname'.bck" $ write pt "" $ write pt "1 SOURCE" $ write pt "=prompt Do you want the complete libssh2 source tree ? " -$ write pt "The libssh2 source tree will be available in backup saveset " +$ write pt "The libssh2 source tree are available in backup saveset " $ write pt "[gnv.common_src]libssh2_''versionname'''datename'_src.bck" $close pt $exit diff --git a/vms/libssh2_make_lib.dcl b/vms/libssh2_make_lib.dcl index 9fef8d9d..606e578b 100644 --- a/vms/libssh2_make_lib.dcl +++ b/vms/libssh2_make_lib.dcl @@ -188,7 +188,7 @@ $! low$'shortened-uppercase-name' with as value lowercase shortened $! name in it, so we can add the proper lower or mixed case $! shortened name later when building the transfer vectors $! for the shared image. -$! This is to prevent two very long similar function names +$! This is to prevent two long similar function names $! that are shortened getting mixed up when sorted alphabetically. $! $ inputfile = "[.cxx_repository]cxx$demangler_db.lowercase" diff --git a/vms/readme.vms b/vms/readme.vms index 93f83ec9..50d1a695 100644 --- a/vms/readme.vms +++ b/vms/readme.vms @@ -1,6 +1,6 @@ *These are the porting notes to OpenVMS, as of 7 April 2010 -by Jose Baars. This file will be installed as -libssh2*.release_notes by the product install kit. +by Jose Baars. This file is installed as libssh2*.release_notes +by the product install kit. LIBSSH2 ------- @@ -30,19 +30,19 @@ Prerequisites See the remarks at prerequisites for building the kit The first three dependencies are tested at installation time, and -installation will fail if any these products are not installed. +installation fails if any these products are not installed. The ZLIB dependency is not tested by the product installation -procedure, as libssh2 will probably be installed as part of -multiple libraries including zlib. +procedure, as libssh2 is probably installed as part of multiple +libraries including zlib. Install ------- -The kit will install gnv$libssh2.exe in a directory tree that might +The kit installs gnv$libssh2.exe in a directory tree that might already be available on your system if you have installed other gnv* libraries or utilities. -The directory tree for gnv$libssh2.exe will be like this: +The directory tree for gnv$libssh2.exe is like this: [gnv] -- [usr] -- [include] -- [libssh2] include files for libssh2 [lib] gnv$libssh2_x_y_z.exe @@ -54,7 +54,7 @@ optional: [example] libssh2_examples-x_y_z.bck [common_src] libssh2-x_y_z_src.bck -By default, it will install the shared image and include files to +By default, it installs the shared image and include files to SYS$COMMON:[GNV...]. You can override this destination by specifying the destination @@ -70,7 +70,7 @@ Please ignore the following warnings, as the kit is not signed : Optionally, you can install a backup saveset with some programming examples, or a backupo saveset with the complete libssh2 source tree. -you will need to answer 'NO' to the question +you need to answer 'NO' to the question 'Do you want the default for all options'. and 'YES' to either or both the following questions: @@ -82,11 +82,11 @@ and 'YES' to either or both the following questions: Post installation tasks ----------------------- -Although we will try to maintain upward compatibility of libssh2, +Although we try to maintain upward compatibility of libssh2, this can not be guaranteed by the libssh2 project itself for OpenVMS, nor eternally by us. -To use libssh2 effectively, you will have to define a system logical +To use libssh2 effectively, you have to define a system logical to point to the shared image. If you are willing to take the gamble, define this logical in your systartup like so: @@ -138,7 +138,7 @@ Building gnv$libssh2 ==================== You can build gnv$libssh2 yourself, which may have advantages, as the library is -in full development, very regularly new features are added. +in full development, regularly new features are added. For production use, it is probably advisable to use a stable version, and link against that. To check out new features, statically linking against @@ -148,7 +148,7 @@ issues. Prerequisites ------------- -You will need to have the following available: +You need to have the following available: - An Alpha or Itanium VMS system. Due to dependencies on zlib, ssl and ODS-5, support on VAXen would be cumbersome at least. @@ -167,10 +167,10 @@ You will need to have the following available: - The HP OpenSSL product. Of course, with tweaking, you can probably link it against the OpenSSL library, but that is not what I have used. -- A C compiler. I don't know any other working C compilers than +- A C compiler. I do not know any other working C compilers than the DEC/Compac/HP-C compiler on VMS. -- An ODS-5 disk. With tweaking you'll get it to work on an ODS-2 +- An ODS-5 disk. With tweaking you can get it to work on an ODS-2 disk, but it is unpractical to do so. - A version of VMSTAR that understands ODS-5 disks and extended @@ -191,7 +191,7 @@ Downloading libssh2 ------------------- At the website of libssh2, you can find stable and daily gzipped -tarballs. if you have a computer connected to internet you can +tarballs. if you have a computer connected to Internet you can download a daily build yourself by a procedure that looks a lot like this ( fill out your own proxy user/password, set up right symbols to gunzip, vmstar and curl and set up the libssh2 build version): @@ -223,7 +223,7 @@ $! $ tarfile = f$search("libssh2-''libssh2_version'-''currentday'.tar.;") $ vmstar xf 'tarfile' -Downloading a stable build will need you to get rid of the currentday. +Downloading a stable build needs you to get rid of the currentday. After the download, you should have a directory tree with a toplevel directory called [libssh2-x.y.z-yyyymmdd]. @@ -280,7 +280,7 @@ the procedure like so: @libssh2_make_example.dcl sftp "SHARED" The procedure defines a process logical gnv$libssh2 pointing to the shared -image library in the directory, which obviously will not survive a logout. +image library in the directory, which obviously does not survive a logout. Building the help library -------------------------